mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 04:17:59 +01:00
Add sugar to Depth
This commit is contained in:
parent
1773bbcd32
commit
4488f37394
1 changed files with 5 additions and 12 deletions
|
@ -78,18 +78,11 @@ class Depth private constructor(val limit: Int?) : Comparable<Depth> {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun compareTo(other: Depth): Int {
|
override fun compareTo(other: Depth): Int {
|
||||||
return if (isUnconstrained()) {
|
return when (Pair(isUnconstrained(), other.isUnconstrained())) {
|
||||||
if (other.isUnconstrained()) {
|
Pair(true, true) -> 0
|
||||||
0
|
Pair(true, false) -> 1
|
||||||
} else {
|
Pair(false, true) -> -1
|
||||||
1
|
else -> limit!!.compareTo(other.limit!!)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (other.isUnconstrained()) {
|
|
||||||
-1
|
|
||||||
} else {
|
|
||||||
limit!!.compareTo(other.limit!!)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue