1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-25 04:17:59 +01:00

Add equals() and hashCode() methods to Depth

This commit is contained in:
Paul Schaub 2023-07-03 15:44:39 +02:00
parent 9c1b060034
commit b9727a9436
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -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
}
} }