All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.extensions.ULongRange.kt Maven / Gradle / Ivy

package io.fluidsonic.stdlib

import kotlin.jvm.*
import kotlin.math.*


public operator fun ULongRange.component1(): ULong =
	first


public operator fun ULongRange.component2(): ULong =
	last


public fun ULongRange.flipped(): ULongRange =
	last .. first


public fun > ULongRange.mapBounds(transform: (ULong) -> R): ClosedRange =
	transform(first) .. transform(last)


@JvmName("mapBoundsToDouble")
public fun ULongRange.mapBounds(transform: (ULong) -> Double): ClosedFloatingPointRange =
	transform(first) .. transform(last)


@JvmName("mapBoundsToFloat")
public fun ULongRange.mapBounds(transform: (ULong) -> Float): ClosedFloatingPointRange =
	transform(first) .. transform(last)


public fun ULongRange.mapBounds(transform: (ULong) -> Int): IntRange =
	transform(first) .. transform(last)


public fun ULongRange.mapBounds(transform: (ULong) -> Long): LongRange =
	transform(first) .. transform(last)


public fun ULongRange.mapBounds(transform: (ULong) -> UInt): UIntRange =
	transform(first) .. transform(last)


public fun ULongRange.mapBounds(transform: (ULong) -> ULong): ULongRange =
	transform(first) .. transform(last)


public fun ULongRange.intersection(other: ULongRange): HalfOpenRange? =
	overlaps(other).thenTake { max(first, other.first) rangeToExcluding min(last, other.last) }


public fun ULongRange.overlaps(other: ULongRange): Boolean =
	contains(other.first) || other.contains(first)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy