|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
org.znerd.math.RealNumber
org.znerd.math.RationalNumber
org.znerd.math.DigitSet
org.znerd.math.BasicDigitSet
public final class BasicDigitSet
Basic implementation of a DigitSet
.
Field Summary |
---|
Fields inherited from class org.znerd.math.RealNumber |
---|
MAXIMUM_RADIX |
Fields inherited from interface org.znerd.math.RoundingModes |
---|
ROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_UP |
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.DigitSet |
---|
toPrecision |
Methods inherited from class org.znerd.math.RationalNumber |
---|
add, add, compareTo, compareToImpl, compareToImpl, compareToImpl2, divide, divide, doubleValue, getDenominator, getNumerator, invert, multiply, multiply, negate, pow, powImpl, powImpl, 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, pow, round, shortValue, toBigInteger, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected BasicDigitSet(boolean positive, int radix, int[] digits, int exponent) throws java.lang.IllegalArgumentException
BasicDigitSet
instance.
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.
java.lang.IllegalArgumentException
- if radix < 2
|| radix > RealNumber.MAXIMUM_RADIX
|| digits == null
|| digits[i] < 0 ||
|| digits[i] >= radix
,
where i >= 0 &&
i < digits.length
.Method Detail |
---|
public int getRadix()
DigitSet
getRadix
in class DigitSet
public int getExponent()
DigitSet
getExponent
in class DigitSet
public int[] getDigits()
DigitSet
int
value between 0 (inclusive) and
the radix (exclusive).
getDigits
in class DigitSet
r != null &&
r[i] >= 0 &&
r[i] < getRadix()
,
where r is the return value and i is an
int
between 0 and r.length
.public int getPrecision()
DigitSet
getPrecision
in class DigitSet
public DigitSet toPrecisionImpl(int precision)
DigitSet
DigitSet.toPrecision(int)
.
toPrecisionImpl
in class DigitSet
precision
- the precision, guaranteed to be >= 1 and <
DigitSet.getPrecision()
.
DigitSet
that is equal to this number, truncated to
the specified precision.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |