mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-11-13 15:33:23 +00:00
intersect
This commit is contained in:
1 parent
aa45a4ab13
commit
fb63de7568
4 files changed
+39
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package dev.inmo.micro_utils.pagination
|
||||
|
||||
import dev.inmo.micro_utils.common.intersect
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.floor
|
||||
|
||||
@@ -27,6 +28,12 @@ interface Pagination : ClosedRange<Int> {
|
||||
get() = lastIndex
|
||||
}
|
||||
|
||||
fun Pagination.intersect(
|
||||
other: Pagination
|
||||
): Pagination? = (this as ClosedRange<Int>).intersect(other as ClosedRange<Int>) ?.let {
|
||||
PaginationByIndexes(it.first, it.second)
|
||||
}
|
||||
|
||||
/**
|
||||
* Logical shortcut for comparison that page is 0
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user