Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class nl.coffee.math.Power

java.lang.Object
  |
  +--java.lang.Number
        |
        +--nl.coffee.math.AbstractRealNumber
              |
              +--nl.coffee.math.AbstractCompositeNumber
                    |
                    +--nl.coffee.math.Power

public class Power
extends AbstractCompositeNumber
A power, consisting of a base and an exponent.

Since:
JUMP_1.0
Version:
1.1 199809.24
Author:
Ernst de Haan
See Also:
Serialized Form

Field Summary
int sign
          The sign of this power.
 
Fields inherited from class nl.coffee.math.AbstractCompositeNumber
elements
 
Constructor Summary
Power(RealNumber base, RealNumber exponent)
          Constructs a Power with the specified base and exponent.
 
Method Summary
static Power createInstance(RealNumber a, RealNumber b)
          Returns a Power with the specified operands.
static int determineSign(RealNumber a, RealNumber b)
          Computes the sign of a power with the specified operands.
RealNumber getBase()
          Returns the base of this power.
RealNumber getExponent()
          Returns the exponent of this power.
int getSign()
          Determines the sign of this number.
int retryCompare(RealNumber n)
           
java.math.BigDecimal toBigDecimal(int precision, int roundingMode)
           
java.lang.String toString()
           
IntegerNumber trunc()
           
 
Methods inherited from class nl.coffee.math.AbstractCompositeNumber
getElement, getElementCount, getElements
 
Methods inherited from class nl.coffee.math.AbstractRealNumber
abs, add, byteValue, compareTo, divide, doubleValue, equals, fitsByte, fitsDouble, fitsFloat, fitsInt, fitsLong, fitsShort, floatValue, hashCode, intValue, invert, longValue, multiply, negate, pow, retryCompare, shortValue, subtract, toBigDecimal, toBigInteger
 
Methods inherited from class java.lang.Number
byteValue, doubleValue, floatValue, intValue, longValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

sign

protected int sign
The sign of this power. This field is set only once upon construction.
Constructor Detail

Power

protected Power(RealNumber base,
                RealNumber exponent)
         throws java.lang.IllegalArgumentException
Constructs a Power with the specified base and exponent.
Parameters:
base - the base for the power.
exponent - the exponent for the power.
Throws:
java.lang.IllegalArgumentException - if either argument is null.
Method Detail

createInstance

public static Power createInstance(RealNumber a,
                                   RealNumber b)
                                          throws java.lang.IllegalArgumentException
Returns a Power with the specified operands.
Parameters:
a - the first operand.
b - the second operand.
Returns:
the Power instance, possibly newly constructed.
Throws:
java.lang.IllegalArgumentException - if either argument is null.

determineSign

protected static int determineSign(RealNumber a,
                                   RealNumber b)
Computes the sign of a power with the specified operands.
Parameters:
operand1 - the first operand.
operand2 - the second operand.

getBase

public RealNumber getBase()
Returns the base of this power.
Returns:
the base.

getExponent

public RealNumber getExponent()
Returns the exponent of this power.
Returns:
the exponent.

getSign

public int getSign()
Determines the sign of this number. This method returns -1, 0, or 1 as this number is negative, zero, or positive.
Returns:
the sign of this number.

retryCompare

public int retryCompare(RealNumber n)
                throws java.lang.IllegalArgumentException
Overrides:
retryCompare in class AbstractRealNumber

toBigDecimal

public java.math.BigDecimal toBigDecimal(int precision,
                               int roundingMode)
                                 throws java.lang.IllegalArgumentException

trunc

public IntegerNumber trunc()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD