Package-level declarations

Contains types such as NonZeroInt for manipulating numbers.

Types

Link copied to clipboard
@Serializable(with = AnyIntSerializer::class)
sealed interface AnyInt : Comparable<AnyInt>

Represents an integer number of type Int.

Link copied to clipboard
@Serializable(with = NegativeIntSerializer::class)
sealed interface NegativeInt : AnyInt

Represents an integer number of type Int that is less than or equals zero.

Link copied to clipboard
@Serializable(with = NonZeroIntSerializer::class)
sealed interface NonZeroInt : AnyInt

Represents an integer number of type Int that is other than zero.

Link copied to clipboard
@Serializable(with = PositiveIntSerializer::class)
sealed interface PositiveInt : AnyInt

Represents an integer number of type Int that is greater than or equals zero.

Link copied to clipboard

Represents an integer number of type Int that is less than zero.

Link copied to clipboard

Represents an integer number of type Int that is greater than zero.

Link copied to clipboard

Represents an integer number of type Int that equals zero.

Functions

Link copied to clipboard
operator fun Int.div(other: NonZeroInt): Int
operator fun AnyInt.div(other: NonZeroInt): Int

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

Link copied to clipboard
operator fun Int.minus(other: AnyInt): Int
operator fun AnyInt.minus(other: Int): Int
operator fun AnyInt.minus(other: AnyInt): Int

Subtracts the other integer from this one.

Link copied to clipboard
operator fun Int.plus(other: AnyInt): Int
operator fun AnyInt.plus(other: Int): Int
operator fun AnyInt.plus(other: AnyInt): Int

Adds the other integer to this one.

Link copied to clipboard
operator fun Int.rem(other: NonZeroInt): Int
operator fun AnyInt.rem(other: NonZeroInt): Int
operator fun NegativeInt.rem(other: NonZeroInt): NegativeInt
operator fun PositiveInt.rem(other: NonZeroInt): PositiveInt

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

Link copied to clipboard
operator fun Int.times(other: AnyInt): Int
operator fun AnyInt.times(other: Int): Int
operator fun AnyInt.times(other: AnyInt): Int

Multiplies this integer by the other one.

Link copied to clipboard

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

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

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

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

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