\n\n\n\nModuloInteger\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\n
\n
\n
\n\n\n\n
\n
org.jscience.mathematics.number
\n

## Class ModuloInteger

\n
\n
\n
\n
\n
\n
\n
\n
\n
• \n\n
\n
• \n\n\n

### Field Summary

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Fields
Modifier and TypeField and Description
`static ModuloInteger``ONE`\n
The modulo integer representing the multiplicative identity.
\n
`static ModuloInteger``ZERO`\n
The modulo integer representing the additive identity.
\n
\n
• \n
\n\n
\n
• \n\n\n

### Method Summary

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Methods
Modifier and TypeMethod and Description
`int``compareTo(ModuloInteger that)`\n
Compares this number with the specified number for order.
\n
`ModuloInteger``copy()`\n
Returns a copy of this number \n `allocated` \n by the calling thread (possibly on the stack).
\n
`double``doubleValue()`\n
Returns the value of this number as a `double`.
\n
`boolean``equals(Object that)`\n
Compares this modulo integer against the specified object\n independently of the current modulus.
\n
`static LargeInteger``getModulus()`\n
Returns the `local` modulus \n for modular arithmetic or `null` if the arithmetic operations\n are non-modular (default).
\n
`int``hashCode()`\n
Returns the hash code for this large integer number.
\n
`ModuloInteger``inverse()`\n
Returns the multiplicative inverse of this object.
\n
`boolean``isLargerThan(ModuloInteger that)`\n
Compares the magnitude of this number with that number.
\n
`long``longValue()`\n
Returns the value of this number as a `long`.
\n
`LargeInteger``moduloValue()`\n
Returns the current modulo value of this number.
\n
`ModuloInteger``opposite()`\n
Returns the additive inverse of this object.
\n
`ModuloInteger``plus(ModuloInteger that)`\n
Returns the sum of this object with the one specified.
\n
`static void``setModulus(LargeInteger modulus)`\n
Sets the `local` modulus \n for modular arithmetic.
\n
`ModuloInteger``times(ModuloInteger that)`\n
Returns the product of this object with the one specified.
\n
`javolution.text.Text``toText()`\n
Returns the text representation of the current modulo value of \n this number.
\n
`static ModuloInteger``valueOf(CharSequence chars)`\n
Returns the modulo integer for the specified character sequence in\n decimal number.
\n
`static ModuloInteger``valueOf(LargeInteger value)`\n
Returns the modulo integer having the specified value (independently of\n the current modulo).
\n
\n
\n
• \n\n\n

### Methods inherited from class org.jscience.mathematics.number.Number

\n`byteValue, floatValue, intValue, isGreaterThan, isLessThan, minus, pow, shortValue, toString`
• \n
\n
\n
• \n\n\n

### Methods inherited from class java.lang.Object

\n`getClass, notify, notifyAll, wait, wait, wait`
• \n
\n
• \n
\n
• \n
\n
\n
\n
\n
• \n\n
\n
• \n\n\n

### Field Detail

\n\n\n\n
\n
• \n

#### ZERO

\n
`public static final ModuloInteger ZERO`
\n
The modulo integer representing the additive identity.
\n
• \n
\n\n\n\n
\n
• \n

#### ONE

\n
`public static final ModuloInteger ONE`
\n
The modulo integer representing the multiplicative identity.
\n
• \n
\n
• \n
\n\n
\n
• \n\n\n

### Method Detail

\n\n\n\n
\n
• \n

#### valueOf

\n
`public static ModuloInteger valueOf(LargeInteger value)`
\n
Returns the modulo integer having the specified value (independently of\n the current modulo).
\n
Parameters:
`value` - the modulo integer intrinsic value.
\n
Returns:
the corresponding modulo number.
\n
• \n
\n\n\n\n
\n
• \n

#### valueOf

\n
`public static ModuloInteger valueOf(CharSequence chars)`
\n
Returns the modulo integer for the specified character sequence in\n decimal number.
\n
Parameters:
`chars` - the character sequence.
\n
Returns:
the corresponding modulo number.
\n
• \n
\n\n\n\n
\n
• \n

#### getModulus

\n
`public static LargeInteger getModulus()`
\n
Returns the `local` modulus \n for modular arithmetic or `null` if the arithmetic operations\n are non-modular (default).
\n
Returns:
the local modulus or `null` if none.
`setModulus(org.jscience.mathematics.number.LargeInteger)`
\n
• \n
\n\n\n\n
\n
• \n

#### setModulus

\n
`public static void setModulus(LargeInteger modulus)`
\n
Sets the `local` modulus \n for modular arithmetic.
\n
Parameters:
`modulus` - the new modulus or `null` to unset the modulus.
\n
Throws:
\n
`IllegalArgumentException` - if `modulus <= 0`
\n
• \n
\n\n\n\n
\n
• \n

#### moduloValue

\n
`public LargeInteger moduloValue()`
\n
Returns the current modulo value of this number. If the modulus \n is `set` to `null` the intrinsic value\n (the creation value) is returned.
\n
Returns:
the positive number equals to this number modulo modulus or\n this modulo creation value.
\n
• \n
\n\n\n\n
\n
• \n

#### toText

\n
`public javolution.text.Text toText()`
\n
Returns the text representation of the current modulo value of \n this number.
\n
\n
Specified by:
\n
`toText` in interface `javolution.lang.Realtime`
\n
Specified by:
\n
`toText` in class `Number<ModuloInteger>`
\n
Returns:
the representation of its modulo value.
\n
• \n
\n\n\n\n
\n
• \n

#### equals

\n
`public boolean equals(Object that)`
\n
Compares this modulo integer against the specified object\n independently of the current modulus.
\n
\n
Specified by:
\n
`equals` in class `Number<ModuloInteger>`
\n
Parameters:
`that` - the object to compare with.
\n
Returns:
`true` if that is a modulo number with the same \n intrinsic value; `false` otherwise.
\n
• \n
\n\n\n\n
\n
• \n

#### hashCode

\n
`public int hashCode()`
\n
Returns the hash code for this large integer number.
\n
\n
Specified by:
\n
`hashCode` in class `Number<ModuloInteger>`
\n
Returns:
the hash code value.
\n
• \n
\n\n\n\n
\n
• \n

#### isLargerThan

\n
`public boolean isLargerThan(ModuloInteger that)`
\n
Description copied from class: `Number`
\n
Compares the magnitude of this number with that number.
\n
\n
Specified by:
\n
`isLargerThan` in class `Number<ModuloInteger>`
\n
Returns:
`|this| > |that|`
\n
• \n
\n\n\n\n
\n
• \n

#### longValue

\n
`public long longValue()`
\n
Description copied from class: `Number`
\n
Returns the value of this number as a `long`.
\n
\n
Specified by:
\n
`longValue` in class `Number<ModuloInteger>`
\n
Returns:
the numeric value represented by this object after conversion\n to type `long`.
\n
• \n
\n\n\n\n
\n
• \n

#### doubleValue

\n
`public double doubleValue()`
\n
Description copied from class: `Number`
\n
Returns the value of this number as a `double`.
\n
\n
Specified by:
\n
`doubleValue` in class `Number<ModuloInteger>`
\n
Returns:
the numeric value represented by this object after conversion\n to type `double`.
\n
• \n
\n\n\n\n
\n
• \n

#### compareTo

\n
`public int compareTo(ModuloInteger that)`
\n
Description copied from class: `Number`
\n
Compares this number with the specified number for order. Returns a\n negative integer, zero, or a positive integer as this number is less\n than, equal to, or greater than the specified number. \n Implementation must ensure that this method is consistent with equals \n `(x.compareTo(y)==0) == (x.equals(y))`,
\n
\n
Specified by:
\n
`compareTo` in interface `Comparable<ModuloInteger>`
\n
Specified by:
\n
`compareTo` in class `Number<ModuloInteger>`
\n
Parameters:
`that` - the number to be compared.
\n
Returns:
a negative integer, zero, or a positive integer as this number\n is less than, equal to, or greater than the specified number.
\n
• \n
\n\n\n\n
\n
• \n

#### times

\n
`public ModuloInteger times(ModuloInteger that)`
\n
Description copied from interface: `Ring`
\n
Returns the product of this object with the one specified.
\n
\n
Specified by:
\n
`times` in interface `GroupMultiplicative<ModuloInteger>`
\n
Specified by:
\n
`times` in interface `Ring<ModuloInteger>`
\n
Parameters:
`that` - the object multiplier.
\n
Returns:
`this \xc2\xb7 that`.
\n
• \n
\n\n\n\n
\n
• \n

#### plus

\n
`public ModuloInteger plus(ModuloInteger that)`
\n
Description copied from interface: `GroupAdditive`
\n
Returns the sum of this object with the one specified.
\n
\n
Specified by:
\n
`plus` in interface `GroupAdditive<ModuloInteger>`
\n
Parameters:
`that` - the object to be added.
\n
Returns:
`this + that`.
\n
• \n
\n\n\n\n
\n
• \n

#### opposite

\n
`public ModuloInteger opposite()`
\n
Description copied from interface: `GroupAdditive`
\n
Returns the additive inverse of this object. It is the object such as\n `this.plus(this.opposite()) == ZERO`,\n with `ZERO` being the additive identity.
\n
\n
Specified by:
\n
`opposite` in interface `GroupAdditive<ModuloInteger>`
\n
Returns:
`-this`.
\n
• \n
\n\n\n\n
\n
• \n

#### inverse

\n
`public ModuloInteger inverse()`
\n
Description copied from interface: `GroupMultiplicative`
\n
Returns the multiplicative inverse of this object. It it the object\n such as `this.times(this.inverse()) == ONE `,\n with `ONE` being the multiplicative identity.
\n
\n
Specified by:
\n
`inverse` in interface `GroupMultiplicative<ModuloInteger>`
\n
Returns:
`ONE / this`.
\n
• \n
\n\n\n\n
\n
• \n

#### copy

\n
`public ModuloInteger copy()`
\n
Description copied from class: `Number`
\n
Returns a copy of this number \n `allocated` \n by the calling thread (possibly on the stack).
\n
\n
Specified by:
\n
`copy` in interface `javolution.lang.ValueType`
\n
Specified by:
\n
`copy` in class `Number<ModuloInteger>`
\n
Returns:
an identical and independant copy of this number.
\n
• \n
\n
• \n
\n
• \n
\n
\n
\n\n\n
\n\n\n\n\n
\n
\n
\n\n\n