Package com.github.basking2.sdsai.itrex
Class EvaluationContext
java.lang.Object
com.github.basking2.sdsai.itrex.EvaluationContext
-
Constructor Summary
ModifierConstructorDescriptionprotected
EvaluationContext
(EvaluationContext parent, Iterator<?> arguments) EvaluationContext
(Map<Object, Object> env, Map<Object, FunctionInterface<? extends Object>> functionRegistry, Iterator<?> arguments, EvaluationContext parent) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object key) static EvaluationContext
functionCall
(EvaluationContext ctx, Iterator<?> arguments) Get all functions from this context and all parent contexts.Iterator<?>
FunctionInterface<? extends Object>
getFunction
(Object functionName) void
register
(Object name, FunctionInterface<? extends Object> operator) void
void
setArguments
(Iterator<?> arguments) void
This is like set, but updates an already existing variable in the scope it is defined in.
-
Constructor Details
-
EvaluationContext
protected EvaluationContext() -
EvaluationContext
-
EvaluationContext
public EvaluationContext(Map<Object, Object> env, Map<Object, FunctionInterface<? extends Object>> functionRegistry, Iterator<?> arguments, EvaluationContext parent)
-
-
Method Details
-
functionCall
-
set
-
update
This is like set, but updates an already existing variable in the scope it is defined in. A call to set will merely set the variable in the current context, and that value will be lost on exit. This is a way to create side-effects, a very not-function practice, but sometimes necessary. If the value is not found to update an exception is thrown- Parameters:
key
- The key to set.value
- The value to associate with the key.
-
get
-
containsKey
-
register
-
getFunction
-
setArguments
-
getArguments
-
getAllFunctions
Get all functions from this context and all parent contexts.- Returns:
- A set of all function identifiers that may be individually passed to
getFunction(Object)
.
-