org.jscience.mathematics.algebraic.numbers
Class Integer

java.lang.Object
  extended by java.lang.Number
      extended by org.jscience.mathematics.algebraic.numbers.ComparableNumber<Integer>
          extended by org.jscience.mathematics.algebraic.numbers.Integer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Integer>, Ring.Member, AbelianGroup.Member, Member

public final class Integer
extends ComparableNumber<Integer>
implements java.lang.Cloneable, java.io.Serializable, Ring.Member

The Integer class encapsulates integer numbers.

See Also:
IntegerRing, Serialized Form

Field Summary
static int MAX_VALUE
          DOCUMENT ME!
static int MIN_VALUE
          DOCUMENT ME!
static int NEGATIVE_INFINITY
          DOCUMENT ME!
static Integer ONE
          DOCUMENT ME!
static int POSITIVE_INFINITY
          DOCUMENT ME!
static java.lang.Class TYPE
          DOCUMENT ME!
static Integer ZERO
          DOCUMENT ME!
 
Constructor Summary
Integer(int num)
          Constructs an integer number.
Integer(Integer num)
          Constructs an integer number.
Integer(java.lang.String s)
          Constructs the integer number represented by a string.
 
Method Summary
 Integer abs()
          Returns the abs of this number.
 AbelianGroup.Member add(AbelianGroup.Member n)
          Returns the addition of this number and another.
 Integer add(Integer n)
          Returns the addition of this integer number and another.
 java.lang.Object clone()
          DOCUMENT ME!
 int compareTo(ComparableNumber obj)
          Compares two comparable numbers.
 int compareTo(Integer obj)
          Compares two integer numbers.
 double doubleValue()
          DOCUMENT ME!
 boolean equals(java.lang.Object obj)
          Compares two integer numbers for equality.
 float floatValue()
          DOCUMENT ME!
 Integer gcd(Integer val)
           
 Integer getDistance(ComparableNumber n)
          DOCUMENT ME!
 Integer getNaN()
          DOCUMENT ME!
 Integer getNegativeInfinity()
          DOCUMENT ME!
 Integer getPositiveInfinity()
          DOCUMENT ME!
 int hashCode()
          Returns a hash code for this Integer object.
 Integer integerDivision(Integer val)
          DOCUMENT ME!
 int intValue()
          DOCUMENT ME!
 boolean isEven()
          Returns true if this number is even.
 boolean isInfinite()
          Returns true if this number is infinite.
 boolean isNaN()
          Returns true if this number is NaN.
 boolean isNegativeInfinity()
          DOCUMENT ME!
 boolean isOdd()
          Returns true if this number is odd.
 boolean isPositiveInfinity()
          DOCUMENT ME!
 Integer lcm(Integer val)
           
 long longValue()
          DOCUMENT ME!
 Integer max(Integer val)
          Returns the max of this number and another, according to compareTo rules.
 Integer min(Integer val)
          Returns the min of this number and another, according to compareTo rules.
 Integer multiply(Integer n)
          Returns the multiplication of this integer number and another.
 Ring.Member multiply(Ring.Member n)
          Returns the multiplication of this number and another.
 AbelianGroup.Member negate()
          Returns the negative of this number.
 Integer pow(Integer n)
          Returns this integer number raised to the power of another.
 Integer remainder(Integer val)
          DOCUMENT ME!
 int signum()
          Returns the sign of this number.
 AbelianGroup.Member subtract(AbelianGroup.Member n)
          Returns the subtraction of this number and another.
 Integer subtract(Integer n)
          Returns the subtraction of this integer number and another.
 java.lang.String toString()
          Returns a string representing the value of this integer number.
 int value()
          Returns the integer value.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final Integer ZERO
DOCUMENT ME!


ONE

public static final Integer ONE
DOCUMENT ME!


MAX_VALUE

public static final int MAX_VALUE
DOCUMENT ME!

See Also:
Constant Field Values

MIN_VALUE

public static final int MIN_VALUE
DOCUMENT ME!

See Also:
Constant Field Values

NEGATIVE_INFINITY

public static final int NEGATIVE_INFINITY
DOCUMENT ME!

See Also:
Constant Field Values

POSITIVE_INFINITY

public static final int POSITIVE_INFINITY
DOCUMENT ME!

See Also:
Constant Field Values

TYPE

public static final java.lang.Class TYPE
DOCUMENT ME!

Constructor Detail

Integer

public Integer(int num)
Constructs an integer number.


Integer

public Integer(Integer num)
Constructs an integer number.


Integer

public Integer(java.lang.String s)
        throws java.lang.NumberFormatException
Constructs the integer number represented by a string.

Parameters:
s - a string representing an integer number.
Throws:
java.lang.NumberFormatException - if the string does not contain a parsable number.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two integer numbers for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - an integer number.
Returns:
DOCUMENT ME!

compareTo

public int compareTo(ComparableNumber obj)
              throws java.lang.IllegalArgumentException
Compares two comparable numbers.

Parameters:
obj - a number.
Returns:
a negative value if this<obj, zero if this==obj, and a positive value if this>obj.
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

compareTo

public int compareTo(Integer obj)
              throws java.lang.IllegalArgumentException
Compares two integer numbers.

Specified by:
compareTo in interface java.lang.Comparable<Integer>
Parameters:
obj - an integer number.
Returns:
a negative value if this<obj, zero if this==obj, and a positive value if this>obj.
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

toString

public java.lang.String toString()
Returns a string representing the value of this integer number.

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

value

public int value()
Returns the integer value.

Returns:
DOCUMENT ME!

intValue

public int intValue()
DOCUMENT ME!

Specified by:
intValue in class java.lang.Number
Returns:
DOCUMENT ME!

longValue

public long longValue()
DOCUMENT ME!

Specified by:
longValue in class java.lang.Number
Returns:
DOCUMENT ME!

floatValue

public float floatValue()
DOCUMENT ME!

Specified by:
floatValue in class java.lang.Number
Returns:
DOCUMENT ME!

doubleValue

public double doubleValue()
DOCUMENT ME!

Specified by:
doubleValue in class java.lang.Number
Returns:
DOCUMENT ME!

isEven

public boolean isEven()
Returns true if this number is even.

Returns:
DOCUMENT ME!

isOdd

public boolean isOdd()
Returns true if this number is odd.

Returns:
DOCUMENT ME!

abs

public Integer abs()
Returns the abs of this number.

Returns:
DOCUMENT ME!

signum

public int signum()
Returns the sign of this number.

Returns:
DOCUMENT ME!

min

public Integer min(Integer val)
Returns the min of this number and another, according to compareTo rules.

Overrides:
min in class ComparableNumber<Integer>
Parameters:
val - DOCUMENT ME!
Returns:
DOCUMENT ME!

max

public Integer max(Integer val)
Returns the max of this number and another, according to compareTo rules.

Overrides:
max in class ComparableNumber<Integer>
Parameters:
val - DOCUMENT ME!
Returns:
DOCUMENT ME!

hashCode

public int hashCode()
Returns a hash code for this Integer object.

Overrides:
hashCode in class java.lang.Object
Returns:
DOCUMENT ME!

isNaN

public boolean isNaN()
Returns true if this number is NaN.

Specified by:
isNaN in class ComparableNumber<Integer>
Returns:
DOCUMENT ME!

isInfinite

public boolean isInfinite()
Returns true if this number is infinite.

Specified by:
isInfinite in class ComparableNumber<Integer>
Returns:
DOCUMENT ME!

isNegativeInfinity

public boolean isNegativeInfinity()
DOCUMENT ME!

Specified by:
isNegativeInfinity in class ComparableNumber<Integer>
Returns:
DOCUMENT ME!

isPositiveInfinity

public boolean isPositiveInfinity()
DOCUMENT ME!

Specified by:
isPositiveInfinity in class ComparableNumber<Integer>
Returns:
DOCUMENT ME!

getNaN

public Integer getNaN()
DOCUMENT ME!

Specified by:
getNaN in class ComparableNumber<Integer>
Returns:
DOCUMENT ME!

getNegativeInfinity

public Integer getNegativeInfinity()
DOCUMENT ME!

Specified by:
getNegativeInfinity in class ComparableNumber<Integer>
Returns:
DOCUMENT ME!

getPositiveInfinity

public Integer getPositiveInfinity()
DOCUMENT ME!

Specified by:
getPositiveInfinity in class ComparableNumber<Integer>
Returns:
DOCUMENT ME!

getDistance

public Integer getDistance(ComparableNumber n)
DOCUMENT ME!

Specified by:
getDistance in class ComparableNumber<Integer>
Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!

negate

public AbelianGroup.Member negate()
Returns the negative of this number.

Specified by:
negate in interface AbelianGroup.Member
Returns:
DOCUMENT ME!

add

public AbelianGroup.Member add(AbelianGroup.Member n)
Returns the addition of this number and another.

Specified by:
add in interface AbelianGroup.Member
Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

add

public Integer add(Integer n)
Returns the addition of this integer number and another.

Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!

subtract

public AbelianGroup.Member subtract(AbelianGroup.Member n)
Returns the subtraction of this number and another.

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

subtract

public Integer subtract(Integer n)
Returns the subtraction of this integer number and another.

Parameters:
n - an integer number.
Returns:
DOCUMENT ME!

multiply

public Ring.Member multiply(Ring.Member n)
Returns the multiplication of this number and another.

Specified by:
multiply in interface Ring.Member
Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

multiply

public Integer multiply(Integer n)
Returns the multiplication of this integer number and another.

Parameters:
n - an integer number.
Returns:
DOCUMENT ME!

pow

public Integer pow(Integer n)
Returns this integer number raised to the power of another.

Parameters:
n - an integer number.
Returns:
DOCUMENT ME!

gcd

public Integer gcd(Integer val)

lcm

public Integer lcm(Integer val)

integerDivision

public Integer integerDivision(Integer val)
DOCUMENT ME!

Parameters:
val - DOCUMENT ME!
Returns:
DOCUMENT ME!

remainder

public Integer remainder(Integer val)
DOCUMENT ME!

Parameters:
val - DOCUMENT ME!
Returns:
DOCUMENT ME!

clone

public java.lang.Object clone()
DOCUMENT ME!

Overrides:
clone in class java.lang.Object
Returns:
DOCUMENT ME!