Class Scope

java.lang.Object
org.openlca.expressions.Scope

public final class Scope extends Object
A scope contains bindings of variable names to expressions. Each scope has a reference to a parent scope except of the global scope. An expression can be evaluated in a scope.
  • Method Details

    • bind

      public void bind(String variable, double value)
      Binds the given variable to the given value in this scope.
    • bind

      public void bind(String variable, String expression)
      Binds the given variable to the given expression in this scope.
    • clear

      public void clear()
      Removes all variable bindings from the scope.
    • eval

      public double eval(String expression) throws InterpreterException
      Evaluates the given expression in this scope.
      Throws:
      InterpreterException
    • resolveVariable

      public Object resolveVariable(String name) throws InterpreterException
      Throws:
      InterpreterException