Class ExpressionVariableContext

java.lang.Object
com.blackrook.expression.ExpressionVariableContext
All Implemented Interfaces:
ExpressionVariableSet

public class ExpressionVariableContext extends Object implements ExpressionVariableSet
An open variable set in which values can be set. The internals are written so that the storage uses few memory allocations/deletions.
Author:
Matthew Tropiano
  • Field Details

    • DEFAULT_CAPACITY

      public static final int DEFAULT_CAPACITY
      Default capacity.
      See Also:
  • Constructor Details

    • ExpressionVariableContext

      public ExpressionVariableContext()
      Creates a context with a default size.
      See Also:
    • ExpressionVariableContext

      public ExpressionVariableContext(int capacity)
      Creates a context with a default size.
      Parameters:
      capacity - the initial capacity.
  • Method Details

    • clear

      public void clear()
      Clears the context.
    • get

      public ExpressionValue get(String name)
      Description copied from interface: ExpressionVariableSet
      Gets a corresponding expression value by name.
      Specified by:
      get in interface ExpressionVariableSet
      Parameters:
      name - the name of the variable.
      Returns:
      the value or null if no variable.
    • set

      public void set(String name, boolean value)
      Gets a corresponding expression value by name.
      Parameters:
      name - the name of the variable.
      value - the value to set.
    • set

      public void set(String name, long value)
      Gets a corresponding expression value by name.
      Parameters:
      name - the name of the variable.
      value - the value to set.
    • set

      public void set(String name, double value)
      Gets a corresponding expression value by name.
      Parameters:
      name - the name of the variable.
      value - the value to set.
    • set

      public void set(String name, ExpressionValue value)
      Gets a corresponding expression value by name.
      Parameters:
      name - the name of the variable.
      value - the value to set.
    • size

      public int size()
      Returns:
      the amount of variables maintained by this context.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if this has no variables, false of not.
    • toString

      public String toString()
      Overrides:
      toString in class Object