Class ChainableBinaryFunction
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.misc.overloadedfunctions.AlternateFunctions
com.singularsys.extensions.chained.ChainableBinaryFunction
- All Implemented Interfaces:
ChainedFunctionI,DirtyFunction,CallbackEvaluationI,JepComponent,PostfixMathCommandI,Serializable
public class ChainableBinaryFunction
extends AlternateFunctions
implements ChainedFunctionI, DirtyFunction
Converts a
BinaryFunction so it can be used in a chain or directly as binary function.
If the number of arguments is 1, then the a ChainedBinaryFunction is used,
otherwise the function is used normally.- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.misc.overloadedfunctions.AlternateFunctions
functions, nf, otFields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, description, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluate a chained function using an additional argument.Performs some special evaluation on the node.Return a description of the function from the properties file.Gets a light-weight instance suitable for using in multiple threads.Get the original binary function that is wrapped by this chainable function.Methods inherited from class com.singularsys.jep.misc.overloadedfunctions.AlternateFunctions
checkNumberOfParameters, getFunctionForNArgs, initMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, getDescription, getDescriptionWithType, getName, getNumberOfParameters, run, setCurNumberOfParameters, setDescription, setName, toString, toString
-
Constructor Details
-
ChainableBinaryFunction
-
-
Method Details
-
evaluate
Description copied from interface:CallbackEvaluationIPerforms some special evaluation on the node. This method has the responsibility for evaluating the children of the node, and it should generally callpv.eval(node.jjtGetChild(i))
for each child. The SymbolTable is not passed as an argument. This is because it is better practice to get and set variable values by using node.getVar().setValue() rather that through the SymbolTable with requires a hashtable lookup.- Specified by:
evaluatein interfaceCallbackEvaluationI- Overrides:
evaluatein classAlternateFunctions- Parameters:
node- The current nodepv- The visitor, can be used evaluate the children- Returns:
- the value after evaluation. This value will be passed to other functions higher up the node tree. The value can be any type including Double or Vector<Object>
- Throws:
EvaluationException- if the calculation cannot be performed- See Also:
-
apply
Description copied from interface:ChainedFunctionIEvaluate a chained function using an additional argument.- Specified by:
applyin interfaceChainedFunctionI- Parameters:
ev- the evaluatornode- top node of functionarg- additional argument from previous element in the chain- Returns:
- Throws:
EvaluationException
-
getLightWeightInstance
Description copied from interface:JepComponentGets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstancein interfaceJepComponent- Overrides:
getLightWeightInstancein classAlternateFunctions- Returns:
- either a new instance, null or 'this'.
-
getDescription
Description copied from class:PostfixMathCommandReturn a description of the function from the properties file. The property name is the class name followed by ".description". The property is found using theJepMessagesclass, which can be configured to add additional properties files. IfPostfixMathCommand.setDescription(String)has been called, return the description set by that method instead.- Specified by:
getDescriptionin interfacePostfixMathCommandI- Overrides:
getDescriptionin classAlternateFunctions- Returns:
- the description of the function
-
getRootFunction
Get the original binary function that is wrapped by this chainable function.- Returns:
- the original binary function
-