Class 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 Detail

      • DEFAULT_CAPACITY

        public static final int DEFAULT_CAPACITY
        Default capacity.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ExpressionVariableContext

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

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

      • clear

        public void clear()
        Clears the context.
      • 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.