| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
  |
  +--java.lang.Number
        |
        +--org.znerd.math.RealNumber
              |
              +--org.znerd.math.RationalNumber
                    |
                    +--org.znerd.math.DigitSet
A set of digits, having a radix and an exponent. Objects of this type are used to implement rounding.
The value of a DigitSet number is the sum of:
 
digits[0] * radixexponent
digits[1] * radixexponent - 1
digits[2] * radixexponent - 2
...
digits[precision - 1] * radixexponent - (precision - 1)
| Fields inherited from class org.znerd.math.RealNumber | 
MAXIMUM_RADIX | 
| Constructor Summary | |
protected  | 
DigitSet(IntegerNumber[] parts,
         String asString)
Creates a new DigitSet instance. | 
| Method Summary | |
abstract  int[] | 
getDigits()
Returns a new array containing all the digits.  | 
abstract  int | 
getExponent()
Returns the exponent.  | 
abstract  int | 
getPrecision()
Returns the precision, the total number of digits.  | 
abstract  int | 
getRadix()
Returns the radix or base.  | 
 DigitSet | 
toPrecision(int precision)
Returns a digit set with the specified precision.  | 
protected abstract  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 | 
| Methods inherited from class java.lang.Object | 
clone, 
finalize, 
getClass, 
hashCode, 
notify, 
notifyAll, 
wait, 
wait, 
wait | 
| Constructor Detail | 
protected DigitSet(IntegerNumber[] parts,
                   String asString)
            throws IllegalArgumentException
DigitSet instance.parts - an array containing the numerator and denonimator, not
    null, having at least 2 elements and not having a
    null at index 0 or 1.asString - textual presentation of this number, not null.asString == null.| Method Detail | 
public abstract int getRadix()
public abstract int getExponent()
public abstract int[] getDigits()
int value between 0 and the radix
 (i.e. 0 <= n < radix, where n is the digit).nullpublic abstract int getPrecision()
public final DigitSet toPrecision(int precision)
                           throws IllegalArgumentException
this) will be returned.
 No rounding will be performed, only truncation. If the specified
 precision is smaller than the precision of this DigitSet,
 then some of the digits will just be removed.
This method calls toPrecisionImpl(int) after checking the
 preconditions.
precision - the precision, >= 1.DigitSet that is equal to this number, truncated to
    the specified precision, never null.precision < 1.protected abstract DigitSet toPrecisionImpl(int precision)
toPrecision(int).precision - the precision, guaranteed to be >= 1.DigitSet that is equal to this number, truncated to
    the specified precision.
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||