org.jscience.mathematics.algebraic.numbers
Class Long

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

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

The Long class encapsulates 64 bits integer numbers.

See Also:
IntegerRing, Serialized Form

Field Summary
static long MAX_VALUE
          DOCUMENT ME!
static long MIN_VALUE
          DOCUMENT ME!
static long NEGATIVE_INFINITY
          DOCUMENT ME!
static Long ONE
          DOCUMENT ME!
static long POSITIVE_INFINITY
          DOCUMENT ME!
static java.lang.Class TYPE
          DOCUMENT ME!
static Long ZERO
          DOCUMENT ME!
 
Constructor Summary
Long(int num)
          Constructs a long number.
Long(Integer num)
          Constructs a long number.
Long(long num)
          Constructs an long number.
Long(Long num)
          Constructs a long number.
Long(java.lang.String s)
          Constructs the long number represented by a string.
 
Method Summary
 Long abs()
          Returns the abs of this number.
 AbelianGroup.Member add(AbelianGroup.Member n)
          Returns the addition of this number and another.
 Long add(Long 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(Long obj)
          Compares two long numbers.
 double doubleValue()
          DOCUMENT ME!
 boolean equals(java.lang.Object obj)
          Compares two long numbers for equality.
 float floatValue()
          DOCUMENT ME!
 Long getDistance(ComparableNumber n)
          DOCUMENT ME!
 Long getNaN()
          DOCUMENT ME!
 Long getNegativeInfinity()
          DOCUMENT ME!
 Long getPositiveInfinity()
          DOCUMENT ME!
 int hashCode()
          Returns a hash code for this Long object.
 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!
 long longValue()
          DOCUMENT ME!
 Long max(Long val)
          Returns the max of this number and another, according to compareTo rules.
 Long min(Long val)
          Returns the min of this number and another, according to compareTo rules.
 Long multiply(Long 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.
 Long pow(Long n)
          Returns this integer number raised to the power of another.
 int signum()
          Returns the sign of this number.
 AbelianGroup.Member subtract(AbelianGroup.Member n)
          Returns the subtraction of this number and another.
 Long subtract(Long n)
          Returns the subtraction of this integer number and another.
 java.lang.String toString()
          Returns a string representing the value of this long number.
 long value()
          Returns the long 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 Long ZERO
DOCUMENT ME!


ONE

public static final Long ONE
DOCUMENT ME!


MAX_VALUE

public static final long MAX_VALUE
DOCUMENT ME!

See Also:
Constant Field Values

MIN_VALUE

public static final long MIN_VALUE
DOCUMENT ME!

See Also:
Constant Field Values

NEGATIVE_INFINITY

public static final long NEGATIVE_INFINITY
DOCUMENT ME!

See Also:
Constant Field Values

POSITIVE_INFINITY

public static final long POSITIVE_INFINITY
DOCUMENT ME!

See Also:
Constant Field Values

TYPE

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

Constructor Detail

Long

public Long(long num)
Constructs an long number.


Long

public Long(int num)
Constructs a long number.


Long

public Long(Long num)
Constructs a long number.


Long

public Long(Integer num)
Constructs a long number.


Long

public Long(java.lang.String s)
     throws java.lang.NumberFormatException
Constructs the long 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 long numbers for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - an long 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(Long obj)
              throws java.lang.IllegalArgumentException
Compares two long numbers.

Specified by:
compareTo in interface java.lang.Comparable<Long>
Parameters:
obj - an long 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 long number.

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

value

public long value()
Returns the long 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 Long 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 Long min(Long val)
Returns the min of this number and another, according to compareTo rules.

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

max

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

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

hashCode

public int hashCode()
Returns a hash code for this Long 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<Long>
Returns:
DOCUMENT ME!

isInfinite

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

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

isNegativeInfinity

public boolean isNegativeInfinity()
DOCUMENT ME!

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

isPositiveInfinity

public boolean isPositiveInfinity()
DOCUMENT ME!

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

getNaN

public Long getNaN()
DOCUMENT ME!

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

getNegativeInfinity

public Long getNegativeInfinity()
DOCUMENT ME!

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

getPositiveInfinity

public Long getPositiveInfinity()
DOCUMENT ME!

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

getDistance

public Long getDistance(ComparableNumber n)
DOCUMENT ME!

Specified by:
getDistance in class ComparableNumber<Long>
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 Long add(Long 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 Long subtract(Long 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 Long multiply(Long n)
Returns the multiplication of this integer number and another.

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

pow

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

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

clone

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

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