Package org.openlca.expressions
Class FormulaInterpreter
java.lang.Object
org.openlca.expressions.FormulaInterpreter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBinds the given variable to the given value in the global scope of the interpreter.voidBinds the given variable to the given expression in the global scope of the interpreter.voidclear()Removes all local scopes and all variable bindings of the global scope from this interpreter.createScope(long id) Creates a new scope with the given ID in the global scope.createScope(long id, Scope parent) Creates a new scope with the given ID in the parent scope.doubleEvaluates the given expression in the global scope of the interpreter.Returns the global scope of the interpreter.getOrCreate(long id) getScope(long id) Returns the scope with the given ID or null if no such scope is defined.getScopeOrGlobal(long id) Get the scope for the given ID or the global scope if no such scope exists.
-
Constructor Details
-
FormulaInterpreter
public FormulaInterpreter()
-
-
Method Details
-
clear
public void clear()Removes all local scopes and all variable bindings of the global scope from this interpreter. -
eval
Evaluates the given expression in the global scope of the interpreter.- Throws:
InterpreterException
-
bind
Binds the given variable to the given expression in the global scope of the interpreter. -
bind
Binds the given variable to the given value in the global scope of the interpreter. -
getGlobalScope
Returns the global scope of the interpreter. -
createScope
Creates a new scope with the given ID in the global scope. -
getOrCreate
-
createScope
Creates a new scope with the given ID in the parent scope. -
getScope
Returns the scope with the given ID or null if no such scope is defined. -
getScopeOrGlobal
Get the scope for the given ID or the global scope if no such scope exists.
-