PositiveInt

@SinceKotools(project = Project.Types, version = "1.1")
interface PositiveInt : IntHolder

Representation of positive integers, including zero.

Types

Companion
Link copied to clipboard
common
object Companion

Contains declarations for holding or building a PositiveInt.

ConstructionError
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.0")
class ConstructionError(value: Int) : IllegalArgumentException

Error thrown when creating a PositiveInt fails.

Functions

compareTo
Link copied to clipboard
common
open operator fun compareTo(other: Int): Int
open operator override fun 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.

dec
Link copied to clipboard
common
open operator override fun dec(): PositiveInt

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

div
Link copied to clipboard
common
open operator fun div(other: NonZeroInt): Int

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

open operator fun div(other: StrictlyNegativeInt): NegativeInt
open operator fun div(other: StrictlyPositiveInt): PositiveInt

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

inc
Link copied to clipboard
common
open operator override fun inc(): PositiveInt

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

minus
Link copied to clipboard
common
open operator fun minus(other: Int): Int
open operator fun minus(other: IntHolder): Int

Subtracts the other value from this value.

plus
Link copied to clipboard
common
open operator fun plus(other: Int): Int
open operator fun plus(other: IntHolder): Int

Adds the other value to this value.

times
Link copied to clipboard
common
open operator fun times(other: Int): Int
open operator fun times(other: IntHolder): Int

Multiplies this value by the other value.

unaryMinus
Link copied to clipboard
common
open operator override fun unaryMinus(): NegativeInt

Returns the negative of this value.

Properties

value
Link copied to clipboard
common
abstract val value: Int

The value to hold.

Inheritors

StrictlyPositiveInt
Link copied to clipboard