Package-level declarations

Contains types such as NonZeroInt for manipulating numbers.

Types

Link copied to clipboard
@Serializable(with = AnyIntSerializerImplementation::class)
@SinceKotoolsTypes(version = "4.0")
interface AnyInt : Comparable<AnyInt>

Representation of all integers.

Link copied to clipboard
@Serializable(with = NegativeIntSerializer::class)
@SinceKotoolsTypes(version = "1.1")
interface NegativeInt : AnyInt

Representation of negative integers including zero.

Link copied to clipboard
@Serializable(with = NonZeroIntSerializer::class)
@SinceKotoolsTypes(version = "1.1")
interface NonZeroInt : AnyInt

Representation of integers other than zero.

Link copied to clipboard
@Serializable(with = PositiveIntSerializer::class)
@SinceKotoolsTypes(version = "1.1")
interface PositiveInt : AnyInt

Representation of positive integers including zero.

Link copied to clipboard
@Serializable(with = StrictlyNegativeIntSerializer::class)
@SinceKotoolsTypes(version = "1.1")
value class StrictlyNegativeInt : NonZeroInt, NegativeInt

Representation of negative integers excluding zero.

Link copied to clipboard
@ExperimentalSinceKotoolsTypes(version = "4.2")
@Serializable(with = StrictlyPositiveDoubleSerializer::class)
value class StrictlyPositiveDouble : Comparable<StrictlyPositiveDouble>

Represents strictly positive floating-point numbers represented by the Double type.

Link copied to clipboard
@Serializable(with = StrictlyPositiveIntSerializer::class)
@SinceKotoolsTypes(version = "1.1")
value class StrictlyPositiveInt : NonZeroInt, PositiveInt

Representation of positive integers excluding zero.

Link copied to clipboard
@Serializable(with = ZeroIntSerializer::class)
@SinceKotoolsTypes(version = "4.0")
object ZeroInt : PositiveInt, NegativeInt

Representation of the zero integer.

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
operator fun Int.div(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.div(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "4.1")
operator fun NegativeInt.div(other: StrictlyNegativeInt): PositiveInt
@SinceKotoolsTypes(version = "4.1")
operator fun NegativeInt.div(other: StrictlyPositiveInt): NegativeInt
@SinceKotoolsTypes(version = "4.1")
operator fun PositiveInt.div(other: StrictlyNegativeInt): NegativeInt
@SinceKotoolsTypes(version = "4.1")
operator fun PositiveInt.div(other: StrictlyPositiveInt): PositiveInt

Divides this integer by the other one, truncating the result to an integer that is closer to zero.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
operator fun Int.minus(other: AnyInt): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.minus(other: Int): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.minus(other: AnyInt): Int

Subtracts the other integer from this one.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
operator fun Int.plus(other: AnyInt): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.plus(other: Int): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.plus(other: AnyInt): Int

Adds the other integer to this one.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
operator fun Int.rem(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.rem(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "4.1")
operator fun NegativeInt.rem(other: NonZeroInt): NegativeInt
@SinceKotoolsTypes(version = "4.1")
operator fun PositiveInt.rem(other: NonZeroInt): PositiveInt

Calculates the remainder of truncating division of this integer by the other one.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
operator fun Int.times(other: AnyInt): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.times(other: Int): Int
@SinceKotoolsTypes(version = "4.1")
operator fun AnyInt.times(other: AnyInt): Int

Multiplies this integer by the other one.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
fun Number.toNegativeInt(): Result<NegativeInt>

Returns this number as an encapsulated NegativeInt, which may involve rounding or truncation, or returns an encapsulated IllegalArgumentException if this number is strictly positive.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
fun Number.toNonZeroInt(): Result<NonZeroInt>

Returns this number as an encapsulated NonZeroInt, which may involve rounding or truncation, or returns an encapsulated IllegalArgumentException if this number equals zero.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
fun Number.toPositiveInt(): Result<PositiveInt>

Returns this number as an encapsulated PositiveInt, which may involve rounding or truncation, or returns an encapsulated IllegalArgumentException if this number is strictly negative.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
fun Number.toStrictlyNegativeInt(): Result<StrictlyNegativeInt>

Returns this number as an encapsulated StrictlyNegativeInt, which may involve rounding or truncation, or returns an encapsulated IllegalArgumentException if this number is positive.

Link copied to clipboard
@ExperimentalSinceKotoolsTypes(version = "4.2")
fun Number.toStrictlyPositiveDouble(): Result<StrictlyPositiveDouble>

Returns this number as an encapsulated StrictlyPositiveDouble, which may involve rounding or truncation, or returns an encapsulated IllegalArgumentException if this number is negative.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
fun Number.toStrictlyPositiveInt(): Result<StrictlyPositiveInt>

Returns this number as an encapsulated StrictlyPositiveInt, which may involve rounding or truncation, or returns an encapsulated IllegalArgumentException if this number is negative.

Link copied to clipboard
@ExperimentalSinceKotoolsTypes(version = "4.2")
operator fun AnyInt.unaryMinus(): Int
@ExperimentalSinceKotoolsTypes(version = "4.2")
operator fun NegativeInt.unaryMinus(): PositiveInt
@ExperimentalSinceKotoolsTypes(version = "4.2")
operator fun NonZeroInt.unaryMinus(): NonZeroInt
@ExperimentalSinceKotoolsTypes(version = "4.2")
operator fun PositiveInt.unaryMinus(): NegativeInt
@ExperimentalSinceKotoolsTypes(version = "4.2")
operator fun StrictlyNegativeInt.unaryMinus(): StrictlyPositiveInt
@ExperimentalSinceKotoolsTypes(version = "4.2")
operator fun StrictlyPositiveInt.unaryMinus(): StrictlyNegativeInt

Returns the negative of this integer.