org.znerd.math
Class  BasicDigitSet
java.lang.Object
  |
  +--java.lang.Number
        |
        +--org.znerd.math.RealNumber
              |
              +--org.znerd.math.RationalNumber
                    |
                    +--org.znerd.math.DigitSet
                          |
                          +--org.znerd.math.BasicDigitSet
- public final class BasicDigitSet
- extends DigitSet
  
Basic implementation of a DigitSet.
- Version: 
 - $Revision: 1.9 $ $Date: 2002/06/24 21:43:38 $
 
- Author: 
 - Ernst de Haan (znerd@FreeBSD.org)
 
- See Also: 
 - Serialized Form
 
 
| 
Constructor Summary | 
protected  | 
BasicDigitSet(boolean positive,
              int radix,
              int[] digits,
              int exponent)
 
          Creates a new BasicDigitSet instance. | 
 
| 
Method Summary | 
 int[] | 
getDigits()
 
          Returns a new array containing all the digits. | 
 int | 
getExponent()
 
          Returns the exponent. | 
 int | 
getPrecision()
 
          Returns the precision, the total number of digits. | 
 int | 
getRadix()
 
          Returns the radix or base. | 
 DigitSet | 
toPrecisionImpl(int precision)
 
          Returns a digit set with the specified precision, actual implementation. | 
 
 
| Methods inherited from class org.znerd.math.RationalNumber | 
add, 
add, 
compareTo, 
compareToImpl, 
compareToImpl, 
compareToImpl2, 
divide, 
divide, 
doubleValue, 
getDenominator, 
getNumerator, 
invert, 
multiply, 
multiply, 
negate, 
pow, 
pow, 
subtract, 
subtract, 
toBigDecimal, 
toBigDecimal, 
trunc | 
 
| Methods inherited from class org.znerd.math.RealNumber | 
abs, 
byteValue, 
compareTo, 
compareTo, 
equals, 
fitsByte, 
fitsDouble, 
fitsFloat, 
fitsInt, 
fitsLong, 
fitsShort, 
floatValue, 
getSign, 
intValue, 
longValue, 
shortValue, 
toBigInteger, 
toString | 
 
 
BasicDigitSet
protected BasicDigitSet(boolean positive,
                        int radix,
                        int[] digits,
                        int exponent)
                 throws IllegalArgumentException
- Creates a new 
BasicDigitSet instance.
- Parameters:
 positive - indication if the number is positive or not.radix - the radix for the number, always >= 2 and <=
    RealNumber.MAXIMUM_RADIX.digits - the digits, not null.exponent - the exponent for the number.- Throws:
 - IllegalArgumentException - if 
radix < 2
          || radix > RealNumber.MAXIMUM_RADIX
          || digits == null
          || digits[i] < 0 ||
          || digits[i] >= radix,
    where 0 <= i < digits.length. 
 
 
getRadix
public int getRadix()
- Description copied from class: DigitSet
 
- Returns the radix or base. The radix is for example 10 for a decimal
 number and 16 for a hexadecimal number. A binary number has the smallest
 radix, 2.
- Overrides:
 - getRadix in class DigitSet
 
 
- Tags copied from class: DigitSet
 
- Returns:
 - the radix, always > 1.
 
 
 
getExponent
public int getExponent()
- Description copied from class: DigitSet
 
- Returns the exponent.
- Overrides:
 - getExponent in class DigitSet
 
 
- Tags copied from class: DigitSet
 
- Returns:
 - the exponent.
 
 
 
getDigits
public int[] getDigits()
- Description copied from class: DigitSet
 
- Returns a new array containing all the digits. Every digit in the
 returned array is an 
int value between 0 and the radix
 (i.e. 0 <= n < radix, where n is the digit).
- Overrides:
 - getDigits in class DigitSet
 
 
- Tags copied from class: DigitSet
 
- Returns:
 - a new array containing all the digits, not 
null 
 
 
getPrecision
public int getPrecision()
- Description copied from class: DigitSet
 
- Returns the precision, the total number of digits.
- Overrides:
 - getPrecision in class DigitSet
 
 
- Tags copied from class: DigitSet
 
- Returns:
 - the precision, always >= 0.
 
 
 
toPrecisionImpl
public DigitSet toPrecisionImpl(int precision)
- Description copied from class: DigitSet
 
- Returns a digit set with the specified precision, actual implementation.
 This method is called from 
DigitSet.toPrecision(int).
- Overrides:
 - toPrecisionImpl in class DigitSet
 
 
- Tags copied from class: DigitSet
 
- Parameters:
 precision - the precision, guaranteed to be >= 1.- Returns:
 - a 
DigitSet that is equal to this number, truncated to
    the specified precision. 
 
 
See http://jump-math.sourceforge.net/.