Class ChainedBinaryFunction
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.extensions.chained.ChainedBinaryFunction
- All Implemented Interfaces:
ChainedFunctionI,DirtyFunction,JepComponent,PostfixMathCommandI,Serializable
public class ChainedBinaryFunction
extends PostfixMathCommand
implements ChainedFunctionI, JepComponent, DirtyFunction
Converts a
BinaryFunction so it can be used in a chain.
A binary function f(x,y) will be converted to a unary function F(x)
can be used in the middle of a chain as
[1..10] . F(5) . fold([x,y]=>x+y)
The apply(Evaluator, Node, Object) method will first
evaluate the child of the node then call the binary function f(x,y)
with the first argument from the child and the second argument from the chain.- See Also:
-
Field Summary
Fields 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.Return a description of the function from the properties file.getInner()Gets a light-weight instance suitable for using in multiple threads.voidInitialize the component.Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, checkNumberOfParameters, getDescription, getDescriptionWithType, getName, getNumberOfParameters, run, setCurNumberOfParameters, setDescription, setName, toString, toString
-
Constructor Details
-
ChainedBinaryFunction
-
-
Method Details
-
apply
Description copied from interface:ChainedFunctionIEvaluate a chained function using an additional argument.- Specified by:
applyin interfaceChainedFunctionI- Parameters:
ev- the evaluatornode- top node of functionlhs- additional argument from previous element in the chain- Returns:
- Throws:
EvaluationException
-
init
Description copied from interface:JepComponentInitialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.- Specified by:
initin interfaceJepComponent- Parameters:
jep- the current Jep instance
-
getLightWeightInstance
Description copied from interface:JepComponentGets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstancein interfaceJepComponent- Returns:
- either a new instance, null or 'this'.
-
getInner
-
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 classPostfixMathCommand- Returns:
- the description of the function
-