Class StandardEvaluator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Stack<java.lang.Object> stack  
    • Field Detail

      • stack

        protected transient java.util.Stack<java.lang.Object> stack
    • Constructor Detail

      • StandardEvaluator

        public StandardEvaluator()
    • Method Detail

      • init

        public void init​(Jep jep)
        Description copied from interface: JepComponent
        Initialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.
        Specified by:
        init in interface JepComponent
        Parameters:
        jep - the current Jep instance
      • eval

        public java.lang.Object eval​(Node node)
                              throws EvaluationException
        Description copied from interface: Evaluator
        Evaluates a sub expression. This method can be called by PostfixMathCommands which implement CallbackEvaluationI
        Specified by:
        eval in interface Evaluator
        Parameters:
        node - node to evaluate
        Returns:
        The value after evaluating the sub expression.
        Throws:
        EvaluationException - if errors occur during evaluation;
      • evaluate

        public java.lang.Object evaluate​(Node node)
                                  throws EvaluationException
        Description copied from interface: Evaluator
        Main entry point, evaluates a node and returns and object with the value of the node.
        Specified by:
        evaluate in interface Evaluator
        Parameters:
        node - node to evaluate
        Returns:
        value after evaluation
        Throws:
        EvaluationException - if errors occur during evaluation;
      • visitFun

        protected void visitFun​(Node node)
                         throws EvaluationException
        Visits a function/operator node. This is the most visited method for most expression evaluations. Keeping it fast is important.
        Parameters:
        node -
        Throws:
        EvaluationException
      • isTrapNullValues

        public boolean isTrapNullValues()
        Whether null values for variables are trapped.
        Returns:
        the status if the trap null values flag.
      • setTrapNullValues

        public void setTrapNullValues​(boolean trapNullValues)
        Sets whether null values for variables are trapped. If set (the default) then an EvaluationException is thrown for null values of variables. If not set then null values are passed to PostfixMathCommands who will need to test for null values.
        Parameters:
        trapNullValues -
      • isTrapNaN

        public boolean isTrapNaN()
      • setTrapNaN

        public void setTrapNaN​(boolean trapNaN)
      • isTrapInfinity

        public boolean isTrapInfinity()
      • setTrapInfinity

        public void setTrapInfinity​(boolean trapInfinity)