1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-05 20:15:59 +01:00

Add sugar to Depth

This commit is contained in:
Paul Schaub 2023-07-05 17:47:43 +02:00
parent 0d45363c18
commit 48379a1c01
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -78,18 +78,11 @@ class Depth private constructor(val limit: Int?) : Comparable<Depth> {
}
override fun compareTo(other: Depth): Int {
return if (isUnconstrained()) {
if (other.isUnconstrained()) {
0
} else {
1
}
} else {
if (other.isUnconstrained()) {
-1
} else {
limit!!.compareTo(other.limit!!)
}
return when (Pair(isUnconstrained(), other.isUnconstrained())) {
Pair(true, true) -> 0
Pair(true, false) -> 1
Pair(false, true) -> -1
else -> limit!!.compareTo(other.limit!!)
}
}