Class ExecutionContext


  • public class ExecutionContext
    extends Object
    Makes up the execution context, holding the available operators and the execution stack.
    • Constructor Detail

      • ExecutionContext

        public ExecutionContext​(Operators operatorSet)
        Creates a new execution context.
        Parameters:
        operatorSet - the operator set
    • Method Detail

      • getStack

        public Stack<Object> getStack()
        Returns the stack used by this execution context.
        Returns:
        the stack
      • getOperators

        public Operators getOperators()
        Returns the operator set used by this execution context.
        Returns:
        the operator set
      • popNumber

        public Number popNumber()
        Pops a number (int or real) from the stack. If it's neither data type, a ClassCastException is thrown.
        Returns:
        the number
      • popInt

        public int popInt()
        Pops a value of type int from the stack. If the value is not of type int, a ClassCastException is thrown.
        Returns:
        the int value
      • popReal

        public float popReal()
        Pops a number from the stack and returns it as a real value. If the value is not of a numeric type, a ClassCastException is thrown.
        Returns:
        the real value