Package redempt.crunch.functional
Class EvaluationEnvironment
java.lang.Object
redempt.crunch.functional.EvaluationEnvironment
Represents an environment containing functions that can be called in expressions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFunction(String name, int argCount, ToDoubleFunction<double[]> func) Adds a Function that can be called from expressions with this environmentvoidaddFunction(Function function) Adds a Function that can be called from expressions with this environmentvoidaddFunctions(Function... functions) Adds any number of Functions that can be called from expressions with this environmentvoidaddLazyVariable(String name, DoubleSupplier supply) Adds a lazily-evaluated variable that will not need to be passed with the variable valuesvoidRemoves all functionsvoidsetVariableNames(String... names)
-
Constructor Details
-
EvaluationEnvironment
public EvaluationEnvironment()Creates a new EvaluationEnvironment
-
-
Method Details
-
addFunction
Adds a Function that can be called from expressions with this environment- Parameters:
function- The function
-
addFunctions
Adds any number of Functions that can be called from expressions with this environment- Parameters:
functions- The functions to add
-
addLazyVariable
Adds a lazily-evaluated variable that will not need to be passed with the variable values- Parameters:
name- The name of the lazy variablesupply- A function to supply the value of the variable when needed
-
setVariableNames
-
addFunction
Adds a Function that can be called from expressions with this environment- Parameters:
name- The function nameargCount- The argument count for the functionfunc- The lambda to accept the arguments as a double array and return a value
-
clearFunctions
public void clearFunctions()Removes all functions -
getNamedTokens
-