mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2024-11-04 22:33:47 +00:00
make LimitStatus and Limits to be comparable
This commit is contained in:
parent
eec32de472
commit
7727d2400e
@ -2,6 +2,9 @@
|
||||
|
||||
## 0.14.0
|
||||
|
||||
* `LimitStatus` is `Comparable<LimitStatus>` since this update
|
||||
* `Limits` is `Comparable<Limits>` since this update
|
||||
|
||||
## 0.13.0
|
||||
|
||||
* Versions:
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
|
@ -29,15 +29,27 @@ val Header.accountInfo
|
||||
data class LimitStatus(
|
||||
val remain: Int = Int.MAX_VALUE,
|
||||
val limit: Int = Int.MAX_VALUE
|
||||
)
|
||||
) : Comparable<LimitStatus> {
|
||||
override fun compareTo(other: LimitStatus): Int = when {
|
||||
limit == other.limit && remain == other.remain -> 0
|
||||
else -> remain.compareTo(other.remain)
|
||||
}
|
||||
}
|
||||
|
||||
data class Limits(
|
||||
val short: LimitStatus = LimitStatus(),
|
||||
val long: LimitStatus = LimitStatus()
|
||||
)
|
||||
) : Comparable<Limits> {
|
||||
override fun compareTo(other: Limits): Int = when {
|
||||
long == other.long && short == other.short -> 0
|
||||
else -> short.remain.compareTo(other.short.remain)
|
||||
}
|
||||
}
|
||||
|
||||
data class AccountInfo(
|
||||
val accountType: AccountType = defaultAccountType,
|
||||
val userId: UserId? = null,
|
||||
val limits: Limits = Limits()
|
||||
)
|
||||
) : Comparable<AccountInfo> {
|
||||
override fun compareTo(other: AccountInfo): Int = limits.compareTo(other.limits)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user