Package kotools.types.number

Types

IntHolder
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.0")
interface IntHolder : Comparable<IntHolder>

Parent of classes responsible for holding integers.

IntHolderDsl
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.1", stability = StabilityLevel.Alpha)
interface IntHolderDsl<out T : IntHolder>

Context responsible for building an IntHolder.

NegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
interface NegativeInt : IntHolder

Representation of negative integers, including zero.

NonZeroInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
interface NonZeroInt : IntHolder

Representation of integers other than zero.

PositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
interface PositiveInt : IntHolder

Representation of positive integers, including zero.

StrictlyNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
interface StrictlyNegativeInt : NonZeroInt, NegativeInt

Representation of strictly negative integers, excluding zero.

StrictlyPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
interface StrictlyPositiveInt : NonZeroInt, PositiveInt

Representation of strictly positive integers, excluding zero.

Functions

compareTo
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.0")
operator fun Int.compareTo(other: IntHolder): Int

Compares this value with the other value for order. Returns zero if this value equals the other value, a negative number if this value is less than the other value, or a positive number if this value is greater than the other value.

div
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
operator fun Int.div(other: NonZeroInt): Int

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

minus
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.0")
operator fun Int.minus(other: IntHolder): Int

Subtracts the other value from this value.

NegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun NegativeInt(value: Int): NegativeInt

Returns the value as a NegativeInt, or throws an NegativeInt.ConstructionError if the value is strictly positive.

NegativeIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun negativeIntOrNull(value: Int): NegativeInt?

Returns the value as a NegativeInt, or returns null if the value is strictly positive.

negativeIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun negativeIntOrThrow(value: Int): NegativeInt

Returns the value as a NegativeInt, or throws an IllegalArgumentException if the value is strictly positive.

NonZeroInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun NonZeroInt(value: Int): NonZeroInt

Returns the value as a NonZeroInt, or throws an NonZeroInt.ConstructionError if the value equals zero.

NonZeroIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun nonZeroIntOrNull(value: Int): NonZeroInt?

Returns the value as a NonZeroInt, or returns null if the value equals zero.

nonZeroIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun nonZeroIntOrThrow(value: Int): NonZeroInt

Returns the value as a NonZeroInt, or throws an IllegalArgumentException if the value equals zero.

plus
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.0")
operator fun Int.plus(other: IntHolder): Int

Adds the other value to this value.

PositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun PositiveInt(value: Int): PositiveInt

Returns the value as a PositiveInt, or throws an PositiveInt.ConstructionError if the value is strictly negative.

PositiveIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun positiveIntOrNull(value: Int): PositiveInt?

Returns the value as a PositiveInt, or returns null if the value is strictly negative.

positiveIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun positiveIntOrThrow(value: Int): PositiveInt

Returns the value as a PositiveInt, or throws an IllegalArgumentException if the value is strictly negative.

randomNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun randomNegativeInt(): NegativeInt

Returns a random NegativeInt.

randomNonZeroInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun randomNonZeroInt(): NonZeroInt

Returns a random NonZeroInt.

randomPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun randomPositiveInt(): PositiveInt

Returns a random PositiveInt.

randomStrictlyNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun randomStrictlyNegativeInt(): StrictlyNegativeInt

Returns a random StrictlyNegativeInt.

randomStrictlyPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun randomStrictlyPositiveInt(): StrictlyPositiveInt

Returns a random StrictlyPositiveInt.

StrictlyNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun StrictlyNegativeInt(value: Int): StrictlyNegativeInt

Returns the value as a StrictlyNegativeInt, or throws an StrictlyNegativeInt.ConstructionError if the value is positive.

StrictlyNegativeIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun strictlyNegativeIntOrNull(value: Int): StrictlyNegativeInt?

Returns the value as a StrictlyNegativeInt, or returns null if the value is positive.

strictlyNegativeIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun strictlyNegativeIntOrThrow(value: Int): StrictlyNegativeInt

Returns the value as a StrictlyNegativeInt, or throws an IllegalArgumentException if the value is positive.

StrictlyPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun StrictlyPositiveInt(value: Int): StrictlyPositiveInt

Returns the value as a StrictlyPositiveInt, or throws an StrictlyPositiveInt.ConstructionError if the value is negative.

StrictlyPositiveIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun strictlyPositiveIntOrNull(value: Int): StrictlyPositiveInt?

Returns the value as a StrictlyPositiveInt, or returns null if the value is negative.

strictlyPositiveIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun strictlyPositiveIntOrThrow(value: Int): StrictlyPositiveInt

Returns the value as a StrictlyPositiveInt, or throws an IllegalArgumentException if the value is negative.

times
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.0")
operator fun Int.times(other: IntHolder): Int

Multiplies this value by the other value.

toNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toNegativeInt(): NegativeInt

Returns this value as a NegativeInt, or throws an NegativeInt.ConstructionError if this value is strictly positive.

toNegativeIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toNegativeIntOrNull(): NegativeInt?

Returns this value as a NegativeInt, or returns null if this value is strictly positive.

toNegativeIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun Int.toNegativeIntOrThrow(): NegativeInt

Returns this value as a NegativeInt, or throws an IllegalArgumentException if this value is strictly positive.

toNonZeroInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toNonZeroInt(): NonZeroInt

Returns this value as a NonZeroInt, or throws an NonZeroInt.ConstructionError if this value equals zero.

toNonZeroIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toNonZeroIntOrNull(): NonZeroInt?

Returns this value as a NonZeroInt, or returns null if this value equals zero.

toNonZeroIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun Int.toNonZeroIntOrThrow(): NonZeroInt

Returns this value as a NonZeroInt, or throws a IllegalArgumentException if this value equals zero.

toPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toPositiveInt(): PositiveInt

Returns this value as a PositiveInt, or throws an PositiveInt.ConstructionError if this value is strictly negative.

toPositiveIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toPositiveIntOrNull(): PositiveInt?

Returns this value as a PositiveInt, or returns null if this value is strictly negative.

toPositiveIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun Int.toPositiveIntOrThrow(): PositiveInt

Returns this value as a PositiveInt, or throws an IllegalArgumentException if this value is strictly negative.

toStrictlyNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toStrictlyNegativeInt(): StrictlyNegativeInt

Returns this value as a StrictlyNegativeInt, or throws an StrictlyNegativeInt.ConstructionError if this value is positive.

toStrictlyNegativeIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toStrictlyNegativeIntOrNull(): StrictlyNegativeInt?

Returns this value as a StrictlyNegativeInt, or returns null if this value is positive.

toStrictlyNegativeIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun Int.toStrictlyNegativeIntOrThrow(): StrictlyNegativeInt

Returns this value as a StrictlyNegativeInt, or throws an IllegalArgumentException if this value is positive.

toStrictlyPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toStrictlyPositiveInt(): StrictlyPositiveInt

Returns this value as a StrictlyPositiveInt, or throws an StrictlyPositiveInt.ConstructionError if this value is negative.

toStrictlyPositiveIntOrNull
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "1.1")
fun Int.toStrictlyPositiveIntOrNull(): StrictlyPositiveInt?

Returns this value as a StrictlyPositiveInt, or returns null if this value is negative.

toStrictlyPositiveIntOrThrow
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2", stability = StabilityLevel.Alpha)
fun Int.toStrictlyPositiveIntOrThrow(): StrictlyPositiveInt

Returns this value as a StrictlyPositiveInt, or throws an IllegalArgumentException if this value is negative.

Properties

negative
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.1", stability = StabilityLevel.Alpha)
val negative: IntHolderDsl<NegativeInt>

Context responsible for building a NegativeInt.

nonZero
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.1", stability = StabilityLevel.Alpha)
val nonZero: IntHolderDsl<NonZeroInt>

Context responsible for building a NonZeroInt.

positive
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.1", stability = StabilityLevel.Alpha)
val positive: IntHolderDsl<PositiveInt>

Context responsible for building a PositiveInt.

strictlyNegative
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.1", stability = StabilityLevel.Alpha)
val strictlyNegative: IntHolderDsl<StrictlyNegativeInt>

Context responsible for building a StrictlyNegativeInt.

strictlyPositive
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.1", stability = StabilityLevel.Alpha)
val strictlyPositive: IntHolderDsl<StrictlyPositiveInt>

Context responsible for building a StrictlyPositiveInt.