-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support case with bag list score being greater then latest bag (#1060)
- Loading branch information
Showing
7 changed files
with
47 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
common/src/main/java/io/novafoundation/nova/common/utils/SemiUnboundedRange.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.novafoundation.nova.common.utils | ||
|
||
interface SemiUnboundedRange<T : Comparable<T>> { | ||
|
||
val start: T | ||
|
||
val endInclusive: T? | ||
} | ||
|
||
infix operator fun <T : Comparable<T>> T.rangeTo(another: T?): SemiUnboundedRange<T> { | ||
return ComparableSemiUnboundedRange(this, another) | ||
} | ||
|
||
inline fun <T : Comparable<T>, R : Comparable<R>> SemiUnboundedRange<T>.map(mapper: (T) -> R): SemiUnboundedRange<R> { | ||
return mapper(start)..endInclusive?.let(mapper) | ||
} | ||
|
||
class ComparableSemiUnboundedRange<T : Comparable<T>>(override val start: T, override val endInclusive: T?) : SemiUnboundedRange<T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...ain/java/io/novafoundation/nova/feature_staking_impl/domain/bagList/BagScoreBoundaries.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.novafoundation.nova.feature_staking_impl.domain.bagList | ||
|
||
import io.novafoundation.nova.common.utils.SemiUnboundedRange | ||
import io.novafoundation.nova.feature_staking_impl.domain.model.BagListNode.Score | ||
|
||
typealias BagScoreBoundaries = SemiUnboundedRange<Score> |
3 changes: 2 additions & 1 deletion
3
...in/java/io/novafoundation/nova/feature_staking_impl/domain/bagList/rebag/RebagMovement.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters