| ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hussam.math.operations.factory.OperatorFactoryImpl<Function> hussam.math.operations.extra.CustomFunctionFactory
public class CustomFunctionFactory
This is custom function factory. This can be used to create custom function. when you create a custom factory it is automatically added to a dataSource. OperatorFactoryDB
OperatorFactoryDB
, Serialized FormNested Class Summary | |
---|---|
protected class | CustomFunctionFactory.CustomFunction This class acts as a Function which is backed up by an expression held by the mother class. |
Constructor Summary | |
---|---|
CustomFunctionFactory(OperatorSourceImpl source, java.lang.String name, java.lang.String description, java.lang.String expression) Creates a new Factory given the expression. | |
CustomFunctionFactory(java.lang.String name, java.lang.String description, java.lang.String expression) Creates a new Factory given the expression. |
Method Summary | |
---|---|
protected OperationReader | createReader() Prepares the reader. |
Operation | getBasicModel() Returns the Operation Model for this factory. |
int | getDefaultArgumentCount() Returns the default number of arguments for this operator. |
java.lang.String | getExpression() Returns the expression. |
Function | getNewOperator() Returns a new Operator. |
OperatorSource | getOperatorSource() Returns the operator source used by this factory. |
java.lang.String | getVariable(int i) Returns the name of the variable at the specified index. |
protected void | prepareModel() Prepares the operation model from which thie constructor builds new Functions from the expression used. |
protected void | setExpression(java.lang.String exp) changes the expression. |
java.lang.String | toString() Returns a description of this factory. |
Methods inherited from class hussam.math.operations.factory.OperatorFactoryImpl |
---|
compareTo, getDescription, getName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CustomFunctionFactory(OperatorSourceImpl source, java.lang.String name, java.lang.String description, java.lang.String expression)
CustomFunctionFactory fac=new CustomFunctionFactory(OperatorFactoryDB.getInstance(), "Add", adds two arguments", "x+y"); Function f=fac.getNewOperator(); f.setOperation(0, 10); f.setOperation(1,30); System.out.println(f.result()); // output: 40Notice that the factory is added into this source.
source
- The dataSource from which the expression will be evaluted.name
- The name of the function.description
- The description of the function.expression
- The expression.public CustomFunctionFactory(java.lang.String name, java.lang.String description, java.lang.String expression)
name
- The name of the function.description
- The description of the function.expression
- The expression.Method Detail |
---|
protected OperationReader createReader()
protected void prepareModel()
public int getDefaultArgumentCount()
OperatorFactory
getDefaultArgumentCount
in interface OperatorFactory<Function>
getDefaultArgumentCount
in class OperatorFactoryImpl<Function>
public Operation getBasicModel()
public java.lang.String getVariable(int i)
i
- index number. public Function getNewOperator()
OperatorFactory
public java.lang.String getExpression()
protected void setExpression(java.lang.String exp)
exp
- The new expression for this factory.public OperatorSource getOperatorSource()
public java.lang.String toString()
OperatorFactoryImpl
toString
in class OperatorFactoryImpl<Function>
| ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |