| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthussam.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 add it to a dataSource. OperatorFactoryDB
OperatorFactoryDB| Constructor Summary | |
|---|---|
CustomFunctionFactory(OperatorSource source, 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. |
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 | prepareReader() |
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(OperatorSource 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: 40
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.| Method Detail |
|---|
protected OperationReader createReader()
protected void prepareReader()
public int getDefaultArgumentCount()
OperatorFactorygetDefaultArgumentCount in interface OperatorFactory<Function>getDefaultArgumentCount in class OperatorFactoryImpl<Function>public java.lang.String getVariable(int i)
i - index number. public Function getNewOperator()
OperatorFactorypublic 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()
OperatorFactoryImpltoString in class OperatorFactoryImpl<Function>
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||