Class ExpressionEvaluator
java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.expression.tree.ExpressionEvaluator
Turns expression trees into variables.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA value cache that is local to a single expression tree.static classExpressionEvaluator.OnceVariable<V extends IValue>A variable that evaluates an operator at most once, without registering invalidation listeners. -
Method Summary
Modifier and TypeMethodDescriptionstatic IVariable<?> buildBound(ExpressionNode node, IVariable[] params, it.unimi.dsi.fastutil.ints.Int2ObjectMap<IVariable<?>> refs) Build a variable for a single evaluation.static IVariable<?> buildLazy(ExpressionNode root, int rootId, ILazyExpressionValueCache rootCache, IntFunction<IVariable<?>> refs) Build a variable tree of cached lazy expressions.
-
Method Details
-
buildLazy
@Nullable public static IVariable<?> buildLazy(ExpressionNode root, int rootId, ILazyExpressionValueCache rootCache, IntFunction<IVariable<?>> refs) Build a variable tree of cached lazy expressions. The root operator node is cached in the given value cache under the given id, inner operator nodes are cached in a cache that is local to this tree.- Parameters:
root- The root node.rootId- The id under which the root is cached.rootCache- The value cache of the root, usually the network.refs- Resolves referenced variables, may return null if not available.- Returns:
- The root variable, or null if a reference could not be resolved.
-
buildBound
public static IVariable<?> buildBound(ExpressionNode node, IVariable[] params, it.unimi.dsi.fastutil.ints.Int2ObjectMap<IVariable<?>> refs) throws EvaluationException Build a variable for a single evaluation. Operator nodes are evaluated lazily and at most once.- Parameters:
node- The node.params- The parameter values.refs- Bound referenced variables.- Returns:
- The variable.
- Throws:
EvaluationException- If a node can not be bound.
-