Skip to content

Commit

Permalink
Add unit tests for Tseitin CNF conversion and implement missing equals
Browse files Browse the repository at this point in the history
method for `Sym`.
  • Loading branch information
gbasler committed Dec 26, 2014
1 parent 841389b commit 52fba08
Show file tree
Hide file tree
Showing 2 changed files with 568 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
Expand Up @@ -122,6 +122,17 @@ trait Logic extends Debugging {

// symbols are propositions
final class Sym private[PropositionalLogic] (val variable: Var, val const: Const) extends Prop {

override def equals(other: scala.Any): Boolean = other match {
case that: Sym => this.variable == that.variable &&
this.const == that.const
case _ => false
}

override def hashCode(): Int = {
variable.hashCode * 41 + const.hashCode
}

private val id: Int = Sym.nextSymId

override def toString = variable + "=" + const + "#" + id
Expand Down

0 comments on commit 52fba08

Please sign in to comment.