mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 12:27:58 +01:00
Add equals() and hashCode() methods to Depth
This commit is contained in:
parent
9c1b060034
commit
b9727a9436
1 changed files with 12 additions and 0 deletions
|
@ -93,7 +93,19 @@ class Depth(val limit: Int?) : Comparable<Depth> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (other !is Depth) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return limit == other.limit
|
||||||
|
}
|
||||||
|
|
||||||
override fun toString() : String {
|
override fun toString() : String {
|
||||||
return if (isUnconstrained()) { "unconstrained" } else { limit!!.toString() }
|
return if (isUnconstrained()) { "unconstrained" } else { limit!!.toString() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return limit ?: 0
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue