Class StackContext

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    Context

    public class StackContext
    extends Object
    implements Serializable
    StackContext is the parent of all contexts. Simulated threads carry their context with them containing their stack, their resource environment, etc. This is the stack part of the story
    See Also:
    Serialized Form
    • Field Detail

      • stack

        protected SimulatedStack<Object> stack
        The stack contained in this object. A Stack contains StackFrames
    • Constructor Detail

      • StackContext

        public StackContext()
    • Method Detail

      • evaluate

        public <T> T evaluate​(String string,
                              Class<T> expectedType)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        expectedType - Type expected by the evaluation. It tries to case the type when needed. If the type cannot be case, an evaluation exception is thrown
        Returns:
        The value of the StoEx evaluation
      • evaluate

        public Object evaluate​(String string)
        Parse and evaluate the given Stoex using the current stackframe on top of the stack
        Parameters:
        string - Stoex to evaluate
        Returns:
        The value of the StoEx evaluation
      • evaluate

        public Object evaluate​(String stoex,
                               SimulatedStackframe<Object> currentFrame)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        currentFrame - The Stackframe under which the evaluation is performed
        Returns:
        The value of the StoEx evaluation
      • evaluateStatic

        public static Object evaluateStatic​(String stoex)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        Returns:
        The value of the StoEx evaluation
      • evaluateStatic

        public static Object evaluateStatic​(String stoex,
                                            SimulatedStackframe<Object> currentFrame)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        currentFrame - The Stackframe under which the evaluation is performed
        Returns:
        The value of the StoEx evaluation
      • evaluateStatic

        public static Object evaluateStatic​(String stoex,
                                            SimulatedStackframe<Object> currentFrame,
                                            VariableMode mode)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        currentFrame - The Stackframe under which the evaluation is performed
        mode - Evaluation mode to use
        Returns:
        The value of the StoEx evaluation
      • evaluateStatic

        public static <T> T evaluateStatic​(String string,
                                           Class<T> expectedType)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        expectedType - Type expected by the evaluation. It tries to case the type when needed. If the type cannot be case, an evaluation exception is thrown
        Returns:
        The value of the StoEx evaluation
      • evaluateStatic

        public static <T> T evaluateStatic​(String string,
                                           Class<T> expectedType,
                                           SimulatedStackframe<Object> frame)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        expectedType - Type expected by the evaluation. It tries to case the type when needed. If the type cannot be case, an evaluation exception is thrown
        frame - Stackframe to be used in the evaluation
        Returns:
        The value of the StoEx evaluation
      • evaluateStatic

        public static <T> T evaluateStatic​(String string,
                                           Class<T> expectedType,
                                           SimulatedStackframe<Object> frame,
                                           VariableMode mode)
        Parse and evaluate the given Stoex
        Parameters:
        string - Stoex to evaluate
        expectedType - Type expected by the evaluation. It tries to case the type when needed. If the type cannot be case, an evaluation exception is thrown
        frame - Stackframe to be used in the evaluation
        mode - Evaluation mode to use
        Returns:
        The value of the StoEx evaluation
      • evaluateInner

        public void evaluateInner​(SimulatedStackframe<Object> frame,
                                  String variablename)
        Evaluate all EvaluationProxies starting with "variable name" and store the results in the given stack frame
        Parameters:
        frame - The frame which stores the evaluated proxy results
        variablename -
      • getEvaluationMode

        public VariableMode getEvaluationMode()
        Returns:
        Current evaluation mode
      • setEvaluationMode

        public void setEvaluationMode​(VariableMode mode)
        Set the evaluation method
        Parameters:
        mode - The new evaluation method to set