Class EquImpl


  • public class EquImpl
    extends Object
    Create an instance of this class and send it an evaluate() message. The result will always be an instance of Double or String or ZonedDateTime.
    You can also register your own functions and operators by calling the static methods registerFunction and registerOperator. These add to a static Map so there are then available for the duration of your application.
    A support instance can be handed to an instance of Equ with the setSupport() method. This must be done prior to calling evaluate. When a variable is found in the equation then the support instance is asked to instantiate the variable. It is expected that it will do what is necessary to come up with it. The test cases show a support instance that maintains a local Map of variable name / value pairs. But a database could be used as well.
    • Constructor Detail

      • EquImpl

        public EquImpl()
    • Method Detail

      • gatherVariables

        public Set<String> gatherVariables()
      • getInstance

        public static EquImpl getInstance​(com.codetaco.math.impl.support.EquationSupport support)
      • getInstance

        public static EquImpl getInstance()
      • getInstance

        public static EquImpl getInstance​(boolean fresh)
      • compile

        public void compile​(String _equ)
      • evaluate

        public Object evaluate()
      • function

        public Function function​(com.codetaco.math.impl.token.TokVariable varTok)
      • getBaseDate

        public Date getBaseDate()
      • getMetaphone

        public org.apache.commons.codec.language.Metaphone getMetaphone()
      • getSupport

        public com.codetaco.math.impl.support.EquationSupport getSupport()
      • initialize

        public void initialize()
      • operator

        public Operator operator​(com.codetaco.math.impl.token.Token tok)
      • registerFunction

        public void registerFunction​(String name,
                                     Class<?> functionSubclass)
      • setBaseDate

        public void setBaseDate​(Date newBaseDate)
      • setSupport

        public EquImpl setSupport​(com.codetaco.math.impl.support.EquationSupport newSupport)
      • showRPN

        public String showRPN()
      • unregisterFunction

        public void unregisterFunction​(String name)
      • unregisterOperator

        public void unregisterOperator​(String name)