Class VariableContext


  • public class VariableContext
    extends Object
    • Constructor Detail

      • VariableContext

        public VariableContext()
        Constructor for VariableContext.
      • VariableContext

        public VariableContext​(boolean delegateSets)
    • Method Detail

      • setGlobalValue

        public void setGlobalValue​(String variable,
                                   Object value)
      • setValue

        public Object setValue​(Object variable,
                               Object value)
        Set the value for the given, if the variable already exits replaces its value with the given value else adds a new variable to the map.
        Parameters:
        variable - The ElementSymbol to be added as a variable.
        value - The value to be set for the given variable.
      • getValue

        public Object getValue​(Object variable)
        Get the value for the given variable, if the variable exits in the current context just return the value of the variable else lookup the parent context and return the value of the variable.
        Parameters:
        variable - The ElementSymbol whose value needs to be returned.
        Returns:
        The value of the given variable
      • setParentContext

        public void setParentContext​(VariableContext parent)
        Set the parent variable context for this variable context, when looking up the variable's value, if the variable is not present in the current context, the parent context is lookedup.
        Parameters:
        parent - The parent VariableContext.
      • getParentContext

        public VariableContext getParentContext()
        Get the parent context for this variable context. When looking up the variable's value, if the variable is not present in the current context, the parent context is lookedup.
        Returns:
        The parent VariableContext.
      • getFlattenedContextMap

        public void getFlattenedContextMap​(Map values)
        Helper Methods
      • containsVariable

        public boolean containsVariable​(Object variable)
        Check if this context or any of it's parent contexts contain this variable
        Parameters:
        variable - The variable which may be present on this context
        Returns:
        A boolean value indiating if the given variable is present on this context or any of it's parent contexts.
      • isEmpty

        public boolean isEmpty()
        Check if the current context and its parents contain any variables
        Returns:
        A boolean bollean value indicating if this context is empty
      • clear

        public void clear()
      • getLocalValues

        public List<Object> getLocalValues()