Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class nl.coffee.math.BasicIntegerNumber

java.lang.Object
  |
  +--java.lang.Number
        |
        +--nl.coffee.math.AbstractRealNumber
              |
              +--nl.coffee.math.AbstractRationalNumber
                    |
                    +--nl.coffee.math.AbstractIntegerNumber
                          |
                          +--nl.coffee.math.BasicIntegerNumber

public class BasicIntegerNumber
extends AbstractIntegerNumber
Basic implementation of an integer number. This implementation is based on a java.math.BigInteger. It can hold all values from -2**32 to (2**32 - 1).

Instances must be obtained by using the createInstance() factory method.

Since:
JUMP_1.0
Version:
1.1 199809.24
Author:
Ernst de Haan
See Also:
java.math.BigInteger, Serialized Form

Field Summary
java.math.BigInteger bigInteger
          The BigInteger this IntegerNumber implementation is based on.
 
Constructor Summary
BasicIntegerNumber(java.math.BigInteger n)
          Constructs a BasicIntegerNumber from a BigInteger.
 
Method Summary
IntegerNumber add(IntegerNumber n)
           
static BasicIntegerNumber createInstance(java.math.BigInteger n)
          Returns an instance of a BasicIntegerNumber based on a java.math.
double doubleValue()
           
int getSign()
           
int hashCode()
           
IntegerNumber integerDivide(IntegerNumber n)
           
long longValue()
           
IntegerNumber multiply(IntegerNumber n)
           
RealNumber negate()
           
java.math.BigInteger toBigInteger()
           
byte[] toByteArray()
           
 
Methods inherited from class nl.coffee.math.AbstractIntegerNumber
add, compareTo, dec, divide, fac, gcd, getDenominator, getNumerator, getSign, hashCode, inc, invert, isRelativePrime, multiply, negate, pow, remainder, subtract, subtract, toBigDecimal, toBigDecimal, toBigDecimal, toBigInteger, toString, trunc
 
Methods inherited from class nl.coffee.math.AbstractRationalNumber
add, add, compareTo, divide, divide, doubleValue, getSign, invert, multiply, multiply, negate, pow, pow, retryCompare, retryCompare, subtract, subtract, toBigDecimal, toBigDecimal, toString, trunc
 
Methods inherited from class nl.coffee.math.AbstractRealNumber
abs, add, byteValue, compareTo, divide, doubleValue, equals, fitsByte, fitsDouble, fitsFloat, fitsInt, fitsLong, fitsShort, floatValue, hashCode, intValue, invert, longValue, multiply, negate, pow, retryCompare, shortValue, subtract, toBigDecimal, toBigInteger
 
Methods inherited from class java.lang.Number
byteValue, doubleValue, floatValue, intValue, longValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

bigInteger

protected java.math.BigInteger bigInteger
The BigInteger this IntegerNumber implementation is based on.
Constructor Detail

BasicIntegerNumber

protected BasicIntegerNumber(java.math.BigInteger n)
                      throws java.lang.IllegalArgumentException
Constructs a BasicIntegerNumber from a BigInteger.
Parameters:
n - the value for the new number.
Method Detail

createInstance

public static BasicIntegerNumber createInstance(java.math.BigInteger n)
                                                       throws java.lang.IllegalArgumentException
Returns an instance of a BasicIntegerNumber based on a java.math.BigInteger.
Parameters:
n - the long number to construct a BasicIntegerNumber from.
Returns:
the (possibly newly constructed) BasicIntegerNumber.
Throws:
java.lang.IllegalArgumentException - if the argument is null.

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractIntegerNumber

getSign

public int getSign()
Overrides:
getSign in class AbstractIntegerNumber

negate

public RealNumber negate()
Overrides:
negate in class AbstractIntegerNumber

add

public IntegerNumber add(IntegerNumber n)
                                throws java.lang.IllegalArgumentException

multiply

public IntegerNumber multiply(IntegerNumber n)
                                     throws java.lang.IllegalArgumentException

integerDivide

public IntegerNumber integerDivide(IntegerNumber n)
                                          throws java.lang.ArithmeticException,
                                                 java.lang.IllegalArgumentException

longValue

public long longValue()
Overrides:
longValue in class AbstractRealNumber

doubleValue

public double doubleValue()
Overrides:
doubleValue in class AbstractRationalNumber

toByteArray

public byte[] toByteArray()

toBigInteger

public java.math.BigInteger toBigInteger()
Overrides:
toBigInteger in class AbstractIntegerNumber

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD