trassare.com

com.trassare.calculator.engine
Class Operation

java.lang.Object
  extended by com.trassare.calculator.engine.Operation

public final class Operation
extends Object

This class contains the mathematical operations that are not native to the BigDecimal class. By placing them in this class, the InfixCalculator's primary purpose is to parse the expression.

Version:
8 September 2006
Author:
Samuel T Trassare

Nested Class Summary
static class Operation.OperationException
          An exception to indicate an invalid number in an operation.
 
Field Summary
protected static int BASE_TEN
          The base-10 constant for logarithmic operations.
 
Method Summary
protected static BigDecimal acos(BigDecimal bd)
           
protected static BigDecimal asin(BigDecimal bd)
           
protected static BigDecimal atan(BigDecimal bd)
           
protected static BigDecimal cos(BigDecimal bd)
           
protected static BigDecimal ln(BigDecimal bd)
           
protected static BigDecimal sin(BigDecimal bd)
           
protected static BigDecimal tan(BigDecimal bd)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_TEN

protected static final int BASE_TEN
The base-10 constant for logarithmic operations.

See Also:
Constant Field Values
Method Detail

acos

protected static BigDecimal acos(BigDecimal bd)
                          throws Operation.OperationException
Parameters:
bd - The number to which the arccosine operation will be applied.
Returns:
the arccosine of the input number
Throws:
Operation.OperationException - if the input value > 1 an OperationException is thrown

asin

protected static BigDecimal asin(BigDecimal bd)
                          throws Operation.OperationException
Parameters:
bd - The number to which the arcsine operation will be applied.
Returns:
the arcsine of the input number
Throws:
Operation.OperationException - if the input value > 1 an OperationException is thrown

atan

protected static BigDecimal atan(BigDecimal bd)
Parameters:
bd - The number to which the arctangent operation will be applied.
Returns:
the arctangent of the input number

cos

protected static BigDecimal cos(BigDecimal bd)
Parameters:
bd - The number to which the cosine operation will be applied.
Returns:
the cosine of the input number

ln

protected static BigDecimal ln(BigDecimal bd)
Parameters:
bd - The number to which the natural log operation will be applied.
Returns:
the natural logarithm of the input number

sin

protected static BigDecimal sin(BigDecimal bd)
Parameters:
bd - The number to which the sine operation will be applied.
Returns:
the sine of the input number

tan

protected static BigDecimal tan(BigDecimal bd)
                         throws Operation.OperationException
Parameters:
bd - The number to which the tangent operation will be applied.
Returns:
the tangent of the input number
Throws:
Operation.OperationException - The input number cannot be a factor of PI/2

trassare.com