Interface Scope

All Known Implementing Classes:
StdLib, StdScope

public interface Scope
Scope representing a table of functions and variables to be used with expressions.

Symbols are typed and resolved to Suppliers to be able to skip name lookup after compilation. Also symbols can be constants to support constant folding while compiling.

  • Method Details

    • getStringSupplier

      Supplier<String> getStringSupplier(String name)
    • getNumberSupplier

      DoubleSupplier getNumberSupplier(String name)
    • getBooleanSupplier

      BooleanSupplier getBooleanSupplier(String name)
    • getStringArraySupplier

      Supplier<String[]> getStringArraySupplier(String name)
    • getNumberArraySupplier

      Supplier<double[]> getNumberArraySupplier(String name)
    • getBooleanArraySupplier

      Supplier<boolean[]> getBooleanArraySupplier(String name)
    • getFunction

      Scope.Function getFunction(String name)
    • getString

      default String getString(String name)
    • getNumber

      default double getNumber(String name)
    • getBoolean

      default boolean getBoolean(String name)
    • getStringArray

      default String[] getStringArray(String name)
    • getNumberArray

      default double[] getNumberArray(String name)
    • getBooleanArray

      default boolean[] getBooleanArray(String name)
    • isConstant

      boolean isConstant(String name)
      Check if a variable is a constant or a function always returns the same result for the same set of arguments.
      Parameters:
      name - Name of function/variable.
      Returns:
      true if variable is constant or function is invariant
    • getType

      @Nullable ValueType getType(String name)
    • encodeFunctionName

      @Nonnull static String encodeFunctionName(@Nonnull String name, @Nonnull ValueType[] values)
    • encodeType

      static char encodeType(@Nonnull ValueType type)