Class ContextStack


  • class ContextStack
    extends java.lang.Object
    Realizes a context stack for evaluating nested self expressions.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • ContextStack

        ContextStack()
    • Method Detail

      • push

        void push​(EvaluationAccessor ex)
        Pushes a context frame for the given expression.
        Parameters:
        ex - the expression (will not be released
      • push

        void push()
        Pushes an empty frame.
      • setVariable

        void setVariable​(DecisionVariableDeclaration var)
        Sets the (top-level) variable in the actual frame. Requires push() before.
        Parameters:
        var - the variable
      • setContainerInitializer

        void setContainerInitializer​(ContainerInitializer init)
        Sets the container initializer in the actual frame. Requires push() before.
        Parameters:
        init - the initializer
        See Also:
        push()
      • setContainerIndex

        void setContainerIndex​(int index)
        Sets the container index in the actual frame. Requires push() before.
        Parameters:
        index - the index value
        See Also:
        push()
      • setCompoundSlot

        void setCompoundSlot​(java.lang.String slot)
        Sets the compound slot in the actual frame. Requires push() before.
        Parameters:
        slot - the new slot
        See Also:
        push()
      • pop

        void pop()
        Pops a context frame.
      • clear

        void clear()
        Clears the whole stack.
      • getSelfValue

        Value getSelfValue()
        Returns the value for self in the current context.
        Returns:
        the expression for self
      • ensureCapacity

        private void ensureCapacity​(IDecisionVariable var,
                                    ContextStack.StackFrame frame)
        Ensures the capacity of a container variable.
        Parameters:
        var - the variable
        frame - the stack frame with the access index to ensure fore