All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.it.unibo.tuprolog.bdd.impl.builder.SimpleBinaryDecisionDiagramVariable.kt Maven / Gradle / Ivy

Go to download

Multi-platform library for representing and manipulating Binary Decision Diagrams

There is a newer version: 1.0.4
Show newest version
package it.unibo.tuprolog.bdd.impl.builder

import it.unibo.tuprolog.bdd.BinaryDecisionDiagram

/**
 * @author Jason Dellaluce
 */
internal data class SimpleBinaryDecisionDiagramVariable>(
    override val value: T,
    override val low: BinaryDecisionDiagram,
    override val high: BinaryDecisionDiagram
) : BinaryDecisionDiagram.Variable {

    private val hashCodeCache: Int by lazy {
        var result = value.hashCode()
        result = 31 * result + low.hashCode()
        result = 31 * result + high.hashCode()
        result
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as SimpleBinaryDecisionDiagramVariable<*>

        if (value != other.value) return false
        if (low != other.low) return false
        if (high != other.high) return false

        return true
    }

    override fun hashCode(): Int {
        return hashCodeCache
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy