org.znerd.math
Class CompositeNumber

java.lang.Object
  |
  +--java.lang.Number
        |
        +--org.znerd.math.RealNumber
              |
              +--org.znerd.math.CompositeNumber
Direct Known Subclasses:
AbstractCompositeNumber, Sum

public abstract class CompositeNumber
extends RealNumber

A composite real number. Examples of composite numbers include sines, logarithms, powers, sums and products.

Version:
$Revision: 1.1 $ $Date: 2002/06/05 22:23:15 $
Author:
Ernst de Haan (znerd@FreeBSD.org)
See Also:
Serialized Form

Fields inherited from class org.znerd.math.RealNumber
MAXIMUM_RADIX
 
Constructor Summary
protected CompositeNumber(int sign, String asString)
          Constructs a new CompositeNumber object.
 
Method Summary
abstract  RealNumber getElement(int n)
          Returns the nth operand.
abstract  int getElementCount()
          Counts the number of operands.
abstract  RealNumber[] getElements()
          Returns the operands.
 
Methods inherited from class org.znerd.math.RealNumber
abs, add, byteValue, compareTo, compareTo, compareToImpl, divide, doubleValue, equals, fitsByte, fitsDouble, fitsFloat, fitsInt, fitsLong, fitsShort, floatValue, getSign, intValue, invert, longValue, multiply, negate, pow, shortValue, subtract, toBigDecimal, toBigDecimal, toBigInteger, toString, trunc
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeNumber

protected CompositeNumber(int sign,
                          String asString)
Constructs a new CompositeNumber 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.

Parameters:
sign - the sign of this number.
Method Detail

getElements

public abstract RealNumber[] getElements()
Returns the operands.
Returns:
a new array, containing the operands.

getElementCount

public abstract int getElementCount()
Counts the number of operands.
Returns:
the operand count, >= 0.

getElement

public abstract RealNumber getElement(int n)
                               throws IndexOutOfBoundsException
Returns the nth operand.
Parameters:
n - the index of the operand, >= 0 and < getElementCount().
Returns:
the nth operand, not null.
Throws:
IndexOutOfBoundsException - if one of the following applies:
  1. n < 0
  2. n >= operandCount


See http://jump-math.sourceforge.net/.