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

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

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

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

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

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

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

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

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

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