public abstract class AbstractCompositeNumber extends CompositeNumber
CompositeNumber
implementations. This
implementation is based on an array. Concrete subclasses should initialize
the array upon construction.MAXIMUM_RADIX
ROUND_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, trunc
protected 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 null
elements
- the elements for this composite number, not null
, not
empty and not containing any null
values.public RealNumber[] getElements()
CompositeNumber
getElements
in class CompositeNumber
public int getElementCount()
CompositeNumber
getElementCount
in class CompositeNumber
public RealNumber getElement(int n) throws java.lang.IndexOutOfBoundsException
CompositeNumber
getElement
in class CompositeNumber
n
- the index of the operand, >= 0 and <
CompositeNumber.getElementCount()
.null
.java.lang.IndexOutOfBoundsException
- if one of the following applies:
n < 0
n >= operandCount