tuweni / org.apache.tuweni.units.bigints / BaseUInt64Value

BaseUInt64Value

abstract class BaseUInt64Value<T : UInt64Value<T>!> : UInt64Value<T> (source)

Base class for UInt64Value.

This class is abstract as it is not meant to be used directly, but it has no abstract methods. As mentioned in UInt64Value, this is used to create strongly-typed type aliases of UInt64. In other words, this allow to "tag" numbers with the unit of what they represent for the type-system, which can help clarity, but also forbid mixing numbers that are mean to be of different units (the strongly-typed part).

This class implements UInt64Value, but also adds a few operations that take a UInt64 directly, for instance #multiply(UInt64). The rational is that multiplying a given quantity of something by a "raw" number is always meaningful, and return a new quantity of the same thing.

Constructors

<init>

BaseUInt64Value(value: UInt64!, ctor: Function<UInt64!, T>!)
BaseUInt64Value(value: Long, ctor: Function<UInt64!, T>!)
BaseUInt64Value(value: BigInteger!, ctor: Function<UInt64!, T>!)

Functions

add

open fun add(value: T): T
open fun add(value: Long): T

Returns a value that is (this + value).

open fun add(value: UInt64!): T

addMod

open fun addMod(value: T, modulus: UInt64!): T
open fun addMod(value: Long, modulus: UInt64!): T
open fun addMod(value: Long, modulus: Long): T

Returns a value equivalent to ((this + value) mod modulus).

open fun addMod(value: UInt64!, modulus: UInt64!): T

compareTo

open fun compareTo(other: T): Int

Compare two UInt64 values.

open fun compareTo(other: UInt64!): Int

copy

Return a copy of this value, or itself if immutable.

open fun copy(): T

divide

open fun divide(value: T): T
open fun divide(value: Long): T

Returns a value that is (this / value).

open fun divide(value: UInt64!): T

equals

open fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

mod

open fun mod(modulus: UInt64!): T
open fun mod(modulus: Long): T

multiply

open fun multiply(value: T): T
open fun multiply(value: Long): T

Returns a value that is (this * value).

open fun multiply(value: UInt64!): T

multiplyMod

open fun multiplyMod(value: T, modulus: UInt64!): T
open fun multiplyMod(value: Long, modulus: UInt64!): T
open fun multiplyMod(value: Long, modulus: Long): T

Returns a value that is ((this * value) mod modulus).

open fun multiplyMod(value: UInt64!, modulus: UInt64!): T

pow

open fun pow(exponent: UInt64!): T
open fun pow(exponent: Long): T

subtract

open fun subtract(value: T): T
open fun subtract(value: Long): T

Returns a value that is (this - value).

open fun subtract(value: UInt64!): T

toBytes

open fun toBytes(): Bytes!

toMinimalBytes

open fun toMinimalBytes(): Bytes!

toString

open fun toString(): String

toUInt64

open fun toUInt64(): UInt64!

zero

Return the zero value for this type.

open fun zero(): T