NegativeInt

@SinceKotoolsTypes(version = "1.1")
value class NegativeInt constructor(val value: Int) : Comparable<Int>

Represents negative integers, including 0.

Constructors

Link copied to clipboard
fun NegativeInt(value: Int)

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
open infix operator override fun compareTo(other: Int): Int
infix operator fun compareTo(other: NegativeInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: StrictlyNegativeInt): Int

Compares this value with the other value for order. Returns 0 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.

@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: PositiveInt): Int

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

@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: StrictlyPositiveInt): Int

Compares this value with the other value and returns a negative number for order.

Link copied to clipboard
operator fun dec(): NegativeInt

Returns this value decremented by 1. If this value is the minimum, it returns the maximum value instead.

Link copied to clipboard
infix operator fun div(other: Int): Int
infix operator fun div(other: NegativeInt): PositiveInt
infix operator fun div(other: PositiveInt): NegativeInt

Divides this value by the other value, truncating the result to an integer that is closer to 0. Throws an ArithmeticException if the other value equals 0.

infix operator fun div(other: NonZeroInt): Int
infix operator fun div(other: StrictlyNegativeInt): PositiveInt
infix operator fun div(other: StrictlyPositiveInt): NegativeInt

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

Link copied to clipboard
operator fun inc(): NegativeInt

Returns this value incremented by 1. If this value is the maximum, it returns the minimum value instead.

Link copied to clipboard
infix operator fun minus(other: Int): Int
infix operator fun minus(other: NegativeInt): Int
infix operator fun minus(other: NonZeroInt): Int
infix operator fun minus(other: PositiveInt): NegativeInt
infix operator fun minus(other: StrictlyNegativeInt): Int
infix operator fun minus(other: StrictlyPositiveInt): StrictlyNegativeInt

Subtracts the other value from this value.

Link copied to clipboard
infix operator fun plus(other: Int): Int
infix operator fun plus(other: NegativeInt): NegativeInt
infix operator fun plus(other: NonZeroInt): Int
infix operator fun plus(other: PositiveInt): Int
infix operator fun plus(other: StrictlyNegativeInt): StrictlyNegativeInt
infix operator fun plus(other: StrictlyPositiveInt): Int

Adds the other value to this value.

Link copied to clipboard
infix operator fun times(other: Int): Int
infix operator fun times(other: NegativeInt): PositiveInt
infix operator fun times(other: NonZeroInt): Int
infix operator fun times(other: PositiveInt): NegativeInt
infix operator fun times(other: StrictlyNegativeInt): PositiveInt
infix operator fun times(other: StrictlyPositiveInt): NegativeInt

Multiplies this value by the other value.

Link copied to clipboard

Returns this value as a non-zero int, or throws an IllegalArgumentException if this value equals 0.

Link copied to clipboard

Returns this value as a non-zero int, or returns null if this value equals 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.2")
fun toNotBlankString(): NotBlankString

Returns the string representation of this value as a not blank string.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Returns this value as a strictly negative int, or throws an IllegalArgumentException if this value equals 0.

Link copied to clipboard

Returns this value as a strictly negative int, or returns null if this value equals 0.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
operator fun unaryMinus(): PositiveInt

Returns the negative of this value.

Link copied to clipboard
operator fun unaryPlus(): NegativeInt

Returns this value.

Properties

Link copied to clipboard
val value: Int