public abstract class AbstractCompositeNumber extends CompositeNumber
CompositeNumber implementations. This
implementation is based on an array. Concrete subclasses should initialize
the array upon construction.MAXIMUM_RADIXROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_UP| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCompositeNumber(int sign,
java.lang.String asString,
RealNumber[] elements)
Constructs a new
AbstractCompositeNumber object. |
| Modifier and Type | Method and Description |
|---|---|
RealNumber |
getElement(int n)
Returns the nth operand.
|
int |
getElementCount()
Counts the number of operands.
|
RealNumber[] |
getElements()
Returns the operands.
|
abs, add, byteValue, compareTo, compareTo, compareToImpl, divide, doubleValue, equals, fitsByte, fitsDouble, fitsFloat, fitsInt, fitsLong, fitsShort, floatValue, getSign, intValue, invert, longValue, multiply, negate, pow, powImpl, round, shortValue, subtract, toBigDecimal, toBigDecimal, toBigInteger, toString, truncprotected AbstractCompositeNumber(int sign,
java.lang.String asString,
RealNumber[] elements)
AbstractCompositeNumber object.
The sign of the value needs to be specified. Any negative value is
interpreted as meaning that the value of this number is negative. Any
positive value is interpreted as meaning that the value of this number
is positive.sign - the sign of this number.asString - a textual presentation for this number, not nullelements - the elements for this composite number, not null, not
empty and not containing any null values.public RealNumber[] getElements()
CompositeNumbergetElements in class CompositeNumberpublic int getElementCount()
CompositeNumbergetElementCount in class CompositeNumberpublic RealNumber getElement(int n) throws java.lang.IndexOutOfBoundsException
CompositeNumbergetElement in class CompositeNumbern - the index of the operand, >= 0 and <
CompositeNumber.getElementCount().null.java.lang.IndexOutOfBoundsException - if one of the following applies:
n < 0n >= operandCount