public final class ModuloInteger extends Number<ModuloInteger> implements Field<ModuloInteger>
This class represents a modulo integer. It can be used in conjonction
with the Matrix
class to resolve modulo equations (ref. number theory).
Modifier and Type | Field and Description |
---|---|
static ModuloInteger |
ONE
The modulo integer representing the multiplicative identity.
|
static ModuloInteger |
ZERO
The modulo integer representing the additive identity.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ModuloInteger that)
Compares this number with the specified number for order.
|
ModuloInteger |
copy()
Returns a copy of this number
allocated
by the calling thread (possibly on the stack). |
double |
doubleValue()
Returns the value of this number as a
double . |
boolean |
equals(java.lang.Object that)
Compares this modulo integer against the specified object
independently of the current modulus.
|
static LargeInteger |
getModulus()
Returns the
local modulus
for modular arithmetic or null if the arithmetic operations
are non-modular (default). |
int |
hashCode()
Returns the hash code for this large integer number.
|
ModuloInteger |
inverse()
Returns the multiplicative inverse of this object.
|
boolean |
isLargerThan(ModuloInteger that)
Compares the magnitude of this number with that number.
|
long |
longValue()
Returns the value of this number as a
long . |
LargeInteger |
moduloValue()
Returns the current modulo value of this number.
|
ModuloInteger |
opposite()
Returns the additive inverse of this object.
|
ModuloInteger |
plus(ModuloInteger that)
Returns the sum of this object with the one specified.
|
static void |
setModulus(LargeInteger modulus)
Sets the
local modulus
for modular arithmetic. |
ModuloInteger |
times(ModuloInteger that)
Returns the product of this object with the one specified.
|
javolution.text.Text |
toText()
Returns the text representation of the current modulo value of
this number.
|
static ModuloInteger |
valueOf(java.lang.CharSequence chars)
Returns the modulo integer for the specified character sequence in
decimal number.
|
static ModuloInteger |
valueOf(LargeInteger value)
Returns the modulo integer having the specified value (independently of
the current modulo).
|
byteValue, floatValue, intValue, isGreaterThan, isLessThan, minus, pow, shortValue, toString
public static final ModuloInteger ZERO
public static final ModuloInteger ONE
public static ModuloInteger valueOf(LargeInteger value)
value
- the modulo integer intrinsic value.public static ModuloInteger valueOf(java.lang.CharSequence chars)
chars
- the character sequence.public static LargeInteger getModulus()
local
modulus
for modular arithmetic or null
if the arithmetic operations
are non-modular (default).null
if none.setModulus(org.jscience.mathematics.number.LargeInteger)
public static void setModulus(LargeInteger modulus)
local
modulus
for modular arithmetic.modulus
- the new modulus or null
to unset the modulus.java.lang.IllegalArgumentException
- if modulus <= 0
public LargeInteger moduloValue()
set
to null
the intrinsic value
(the creation value) is returned.public javolution.text.Text toText()
toText
in interface javolution.lang.Realtime
toText
in class Number<ModuloInteger>
public boolean equals(java.lang.Object that)
equals
in class Number<ModuloInteger>
that
- the object to compare with.true
if that is a modulo number with the same
intrinsic value; false
otherwise.public int hashCode()
hashCode
in class Number<ModuloInteger>
public boolean isLargerThan(ModuloInteger that)
Number
isLargerThan
in class Number<ModuloInteger>
|this| > |that|
public long longValue()
Number
long
.longValue
in class Number<ModuloInteger>
long
.public double doubleValue()
Number
double
.doubleValue
in class Number<ModuloInteger>
double
.public int compareTo(ModuloInteger that)
Number
(x.compareTo(y)==0) == (x.equals(y))
,compareTo
in interface java.lang.Comparable<ModuloInteger>
compareTo
in class Number<ModuloInteger>
that
- the number to be compared.public ModuloInteger times(ModuloInteger that)
Ring
times
in interface GroupMultiplicative<ModuloInteger>
times
in interface Ring<ModuloInteger>
that
- the object multiplier.this ยท that
.public ModuloInteger plus(ModuloInteger that)
GroupAdditive
plus
in interface GroupAdditive<ModuloInteger>
that
- the object to be added.this + that
.public ModuloInteger opposite()
GroupAdditive
this.plus(this.opposite()) == ZERO
,
with ZERO
being the additive identity.opposite
in interface GroupAdditive<ModuloInteger>
-this
.public ModuloInteger inverse()
GroupMultiplicative
this.times(this.inverse()) == ONE
,
with ONE
being the multiplicative identity.inverse
in interface GroupMultiplicative<ModuloInteger>
ONE / this
.public ModuloInteger copy()
Number
allocated
by the calling thread (possibly on the stack).copy
in interface javolution.lang.ValueType
copy
in class Number<ModuloInteger>