IntegerSym
org.matheclipse.core.expression

Class IntegerSym

    • Field Detail

      • BI_MINUS_ONE

        public static final BigInteger BI_MINUS_ONE
        The BigInteger constant minus one.
    • Method Detail

      • valueOf

        public static IntegerSym valueOf(long value)
      • valueOf

        public static IntegerSym valueOf(String integerString,                 int radix)
        Returns the IntegerImpl for the specified character sequence stated in the specified radix. The characters must all be digits of the specified radix, except the first character which may be a plus sign '+' or a minus sign '-' .
        Parameters:
        chars - the character sequence to parse.
        radix - the radix to be used while parsing.
        Returns:
        the corresponding large integer.
        Throws:
        NumberFormatException - if the specified character sequence does not contain a parsable large integer.
      • equalsInt

        public boolean equalsInt(int i)
        Description copied from interface: INumber
        Is this number equal an integer number?
        Specified by:
        equalsInt in interface INumber
        Returns:
      • evaluate

        public IExpr evaluate(EvalEngine engine)
        Evaluate an expression
        Specified by:
        evaluate in interface IExpr
        Overrides:
        evaluate in class ExprImpl
        Parameters:
        engine - the evaluation engine
        Returns:
        the evaluated Object or null if the evaluation is not possible (i.e. the evaluation doesn't change the object).
      • numericNumber

        public final INumber numericNumber()
        Description copied from interface: IBigNumber
        Create a numeric number from this exact "symbolic" number.
        Specified by:
        numericNumber in interface IBigNumber
        Returns:
      • hierarchy

        public int hierarchy()
        Description copied from interface: IExpr
        A unique integer ID for the implementation of this expression
        Specified by:
        hierarchy in interface IExpr
        Returns:
        a unique integer id for the implementation of this expression
      • equals

        public boolean equals(Object obj)
        Description copied from interface: Element
        Test if this is equal to b.
        Specified by:
        equals in interface Element<IExpr>
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to b, else false.
      • eabs

        public IntegerSym eabs()
        Description copied from interface: INumber
        Get the absolute value for a given number
        Specified by:
        eabs in interface INumber
        Returns:
      • bitLength

        public int bitLength()
        Returns:
      • divide

        public BigInteger divide(long val)
        Parameters:
        val -
        Returns:
      • gcd

        public IntegerSym gcd(IntegerSym that)
        Returns the greatest common divisor of this large integer and the one specified.
      • gcd

        public IInteger gcd(IInteger that)
        Returns the greatest common divisor of this large integer and the one specified.
        Specified by:
        gcd in interface IInteger
      • lcm

        public IntegerSym lcm(IntegerSym that)
        Returns the least common multiple of this large integer and the one specified.
      • lcm

        public IInteger lcm(IInteger that)
        Returns the least common multiple of this large integer and the one specified.
        Specified by:
        lcm in interface IInteger
      • hashCode

        public final int hashCode()
        Hashcode of this Element.
        Specified by:
        hashCode in interface Element<IExpr>
        Overrides:
        hashCode in class Object
        Returns:
        the hashCode.
      • isLargerThan

        public boolean isLargerThan(BigInteger that)
        Parameters:
        that -
        Returns:
      • isZero

        public boolean isZero()
        Description copied from interface: IExpr
        Test if this expression equals 0 in symbolic or numeric mode.
        Specified by:
        isZero in interface IExpr
        Specified by:
        isZero in interface ISignedNumber
        Overrides:
        isZero in class ExprImpl
      • isOne

        public boolean isOne()
        Description copied from interface: IExpr
        Test if this expression equals 1 in symbolic or numeric mode.
        Specified by:
        isOne in interface IExpr
        Overrides:
        isOne in class ExprImpl
      • isMinusOne

        public boolean isMinusOne()
        Description copied from interface: IExpr
        Test if this expression equals -1 in symbolic or numeric mode.
        Specified by:
        isMinusOne in interface IExpr
        Overrides:
        isMinusOne in class ExprImpl
      • intValue

        public int intValue()
        Description copied from interface: IInteger
        Converts this large integer to int; unlike ISignedNumber.toInt() this method raises no exception, if this integer cannot be represented by an int type.
        Specified by:
        intValue in interface IInteger
        Returns:
        the numeric value represented by this integer after conversion to type int.
      • longValue

        public long longValue()
        Specified by:
        longValue in interface IInteger
        Returns:
      • multiply

        public BigInteger multiply(long val)
        Parameters:
        val -
        Returns:
      • shiftLeft

        public BigInteger shiftLeft(int n)
        Parameters:
        n -
        Returns:
      • shiftRight

        public BigInteger shiftRight(int n)
        Parameters:
        n -
        Returns:
      • times

        public IExpr times(IExpr that)
        Description copied from interface: IExpr
        Returns the product of this object with the one specified.
        Specified by:
        times in interface IExpr
        Overrides:
        times in class ExprImpl
        Parameters:
        that -
        Returns:
      • toByteArray

        public byte[] toByteArray()
      • getNumerator

        public IInteger getNumerator()
        Returns the numerator of this fraction.
        Specified by:
        getNumerator in interface IRational
        Returns:
        denominator
      • getDenominator

        public IInteger getDenominator()
        Returns the denominator of this fraction.
        Specified by:
        getDenominator in interface IRational
        Returns:
        denominator
      • getFraction

        public BigFraction getFraction()
        Returns this number as BigFraction number.
        Specified by:
        getFraction in interface IRational
        Returns:
        this number s big fraction.
      • factorize

        public List<IInteger> factorize()
        Get the factors of this integer
        Returns:
      • factorInteger

        public IAST factorInteger()
      • isEven

        public boolean isEven()
        Specified by:
        isEven in interface IInteger
      • isOdd

        public boolean isOdd()
        Specified by:
        isOdd in interface IInteger
      • toInt

        public int toInt()          throws ArithmeticException
        Converts this number to int; unlike #intValue this method raises ArithmeticException if this number cannot be represented by an int type.
        Specified by:
        toInt in interface ISignedNumber
        Returns:
        the numeric value represented by this integer after conversion to type int.
        Throws:
        ArithmeticException - if conversion to int is not possible.
      • toLong

        public long toLong()            throws ArithmeticException
        Converts this number to long; unlike #longValue this method raises ArithmeticException if this number cannot be represented by an long type.
        Specified by:
        toLong in interface ISignedNumber
        Returns:
        the numeric value represented by this integer after conversion to type long.
        Throws:
        ArithmeticException - if conversion to int is not possible.
      • sign

        public int sign()
        Description copied from interface: ISignedNumber
        Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is negative, zero or positive).
        Specified by:
        sign in interface ISignedNumber
        Returns:
        -1 if this is a negative number;
        0 if this is a zero;
        -1 if this is a negative number;
      • complexSign

        public int complexSign()
        Description copied from interface: INumber
        Gets the signum value of a complex number
        Specified by:
        complexSign in interface INumber
        Returns:
        0 for this == 0; +1 for real(this) > 0 or ( real(this)==0 && imaginary(this) > 0 ); -1 for real(this) < 0 || ( real(this) == 0 && imaginary(this) < 0 )
      • ceil

        public IInteger ceil()
        Description copied from interface: ISignedNumber
        Returns the smallest (closest to negative infinity) IInteger value that is not less than this and is equal to a mathematical integer. This method raises ArithmeticException if a numeric value cannot be represented by an long type.
        Specified by:
        ceil in interface ISignedNumber
        Returns:
        the smallest (closest to negative infinity) IInteger value that is not less than this and is equal to a mathematical integer.
      • floor

        public IInteger floor()
        Description copied from interface: ISignedNumber
        Returns the largest (closest to positive infinity) IInteger value that is not greater than this and is equal to a mathematical integer.
        This method raises ArithmeticException if a numeric value cannot be represented by an long type.
        Specified by:
        floor in interface ISignedNumber
        Returns:
        the largest (closest to positive infinity) IInteger value that is not greater than this and is equal to a mathematical integer.
      • round

        public IInteger round()
        Description copied from interface: ISignedNumber
        Returns the closest IInteger to the argument. The result is rounded to an integer by adding 1/2 and taking the floor of the result.
        This method raises ArithmeticException if a numeric value cannot be represented by an long type.
        Specified by:
        round in interface ISignedNumber
        Returns:
        the closest integer to the argument.
      • compareTo

        public int compareTo(IExpr obj)
        Compares this expression with the specified expression for order. Returns a negative integer, zero, or a positive integer as this expression is canonical less than, equal to, or greater than the specified expression.
        Specified by:
        compareTo in interface Element<IExpr>
        Specified by:
        compareTo in interface Comparable<IExpr>
        Specified by:
        compareTo in interface IExpr
        Returns:
        0 if this is equal to b, -1 if this is less then b, else +1.
      • head

        public ISymbol head()
        Description copied from interface: IExpr
        If this object is an instance of IAST get the first element (offset 0) of the IAST list (i.e. get(0) ).
        Specified by:
        head in interface IExpr
        Specified by:
        head in class ExprImpl
        Returns:
        the head of the expression, which must not be null.
      • internalFormString

        public String internalFormString(boolean symbolsAsFactoryMethod,                        int depth)
        Description copied from interface: IExpr
        Return the internal Java form of this expression.
        Specified by:
        internalFormString in interface IExpr
        Overrides:
        internalFormString in class ExprImpl
        Parameters:
        symbolsAsFactoryMethod - if true use the F.symbol() method, otherwise print the symbol name.
        depth - the recursion depth of this call. 0 indicates "recurse without a limit".
      • accept

        public <T> T accept(IVisitor<T> visitor)
        Accept a visitor with return type T
        Specified by:
        accept in interface IExpr
      • accept

        public boolean accept(IVisitorBoolean visitor)
        Accept a visitor with return type boolean
        Specified by:
        accept in interface IExpr
      • accept

        public int accept(IVisitorInt visitor)
        Accept a visitor with return type int
        Specified by:
        accept in interface IExpr
        Returns:
      • getIm

        public ISignedNumber getIm()
        Returns the imaginary part of a complex number
        Specified by:
        getIm in interface INumber
        Returns:
        real part
      • getRe

        public ISignedNumber getRe()
        Returns the real part of a complex number
        Specified by:
        getRe in interface INumber
        Returns:
        real part

SCaVis 1.8 © jWork.org