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

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
@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.0")
fun Int.toNegativeInt(): Result<NegativeInt>

Returns this integer as a NegativeInt, or returns an IllegalArgumentException if this integer is strictly positive.

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

Returns this integer as a NonZeroInt, or returns an IllegalArgumentException if this integer equals zero.

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

Returns this integer as a PositiveInt, or returns an IllegalArgumentException if this integer is strictly negative.

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

Returns this integer as a StrictlyNegativeInt, or returns an IllegalArgumentException if this integer is positive.

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

Returns this integer as a StrictlyPositiveInt, or returns an IllegalArgumentException if this integer is negative.