ModuloInteger
org.jscience.mathematics.number

Class ModuloInteger

    • Field Detail

      • ZERO

        public static final ModuloInteger ZERO
        The modulo integer representing the additive identity.
      • ONE

        public static final ModuloInteger ONE
        The modulo integer representing the multiplicative identity.
    • Method Detail

      • valueOf

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

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

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

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

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

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

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

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

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

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

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

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

SCaVis 2.0 © jWork.ORG