hussam.math.operations.extra
Class CustomFunctionFactory.CustomFunction

java.lang.Object
extended by hussam.math.operations.Function
extended by hussam.math.operations.extra.CustomFunctionFactory.CustomFunction
All Implemented Interfaces:
Operation, Operator, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Operator>
Direct Known Subclasses:
DynamicFunctionFactory.DynamicFunction
Enclosing class:
CustomFunctionFactory

protected class CustomFunctionFactory.CustomFunction
extends Function

This class acts as a Function which is backed up by an expression held by the mother class. When the result method is called, it calls the prepare method which prepares a new Operation for the function. This class interacts with the mother factory which create instances. Warning, this class has not been tested for serialization. If you needed serialization please email me to have a version which supports long term serialization support.

See Also:
Serialized Form

Field Summary
protected  Operationoperation
           
protected  OperatorSourceWrappersource
           
 
Fields inherited from interface hussam.math.operations.Operator
COMMA, FUNCTION, INDEFINITE, LOGICAL, MULTIPLY, NOTHING, PLUS, POWER
 
Constructor Summary
CustomFunctionFactory.CustomFunction()
          Constructing using An operatorSource, the name of the function, the expression used to evalute the arguments.
 
Method Summary
 VariablegetVariable(int i)
          Returns the variable contained in the expression.
protected  voidprepare()
          Prepares a copy of the Operation Model.
 doubleresult()
          returns the result of the operation.
 voidsetOperation(int i, Operation op)
           
 java.lang.StringtoString()
          Returns a String describing the name of the function and the list of arguments.
 
Methods inherited from class hussam.math.operations.Function
checkReady, clone, compareTo, getCurrentArgumentCount, getDiscription, getName, getOperation, getOperationGroup, getType, optimize, setOperationGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

source

protected transient OperatorSourceWrapper source

operation

protected Operation operation
Constructor Detail

CustomFunctionFactory.CustomFunction

public CustomFunctionFactory.CustomFunction()
Constructing using An operatorSource, the name of the function, the expression used to evalute the arguments.

Method Detail

prepare

protected void prepare()
                throws MathException
Prepares a copy of the Operation Model. This is called by the result method.

Throws:
MathException - if the model is null, or if anything goes wrong in the cloning operation.

result

public double result()
              throws MathException
Description copied from interface: Operation
returns the result of the operation.

Returns:
The result value.
Throws:
MathException - if there is a Math Exception!!

getVariable

public Variable getVariable(int i)
Returns the variable contained in the expression.
 You can set the value of the Variable afterwords!

Returns:
The Variable at the spicified position.
 The Variables are sorted in alphabatical order.!
Throws:
java.lang.ArrayIndexOutOfBoundsException - If i is not in the variable array!
See Also:
setOperation(int, Operation)

setOperation

public void setOperation(int i,
Operation op)

toString

public java.lang.String toString()
Description copied from class: Function
Returns a String describing the name of the function and the list of arguments.

Overrides:
toString in class Function
Returns:
a describtion of the Function.