Class MetaEvaluator

    • Constructor Detail

      • MetaEvaluator

        public MetaEvaluator()
    • Method Detail

      • getInstance

        public static MetaEvaluator getInstance()
        Factory method. You should not override this class to add more of your own evaluators. Just get the instance and addEvaluator(int, AbstractEvaluator) to it at index 0 (or it will get missed -- last index is for functions and throws and exception if no function found. It will snoop through your evaluator too. If you are writing your own evaluator, your type numbers should be negative.
        Returns:
      • addE

        protected static void addE​(int index,
                                   AbstractEvaluator evaluator)
        Add evaluator at a given index in the list
        Parameters:
        index -
        evaluator -
      • addE

        protected static void addE​(AbstractEvaluator evaluator)
        Add evaluator to the end of the list.
        Parameters:
        evaluator -
      • getArgCount

        public int[] getArgCount​(String name)
        Given the name of a built in function, find the number of possible arguments it can take. This is needed for resolving function references.
        Parameters:
        name -
        Returns:
      • setFunctionEvaluator

        public void setFunctionEvaluator​(FunctionEvaluator functionEvaluator)
      • isSystemNS

        public static boolean isSystemNS​(String name)
      • getNamespace

        public String getNamespace()
      • setMetaEvaluator

        public static void setMetaEvaluator​(MetaEvaluator metaEvaluator)
      • addEvaluator

        public void addEvaluator​(int index,
                                 AbstractEvaluator evaluator)
      • getType

        public int getType​(String name)
      • evaluateNEW

        public boolean evaluateNEW​(Polyad polyad,
                                   State state)
        Proposed method to allow for overriding base system functions. Maybe. Still have to decide if this is really a great idea. This can actually the evaluteOLD completely BUT because this requires exception handling to decide if a function is user defined, the performance is slower by a good 15%.

        To do this right will require that the function Evaluator handle missing functions differently. Probably a fairly substantial rewrite for not much of a clear purpose at this point (4/27/2022)

        Parameters:
        polyad -
        state -
        Returns:
      • isBuiltIin

        public boolean isBuiltIin​(String moduleName,
                                  String functionName)
        Check that a FQ function exists. This is used withj isSystemNS(String) to check if the namespace exists in the first place.
        Parameters:
        moduleName -
        functionName -
        Returns:
      • evaluateOLD

        public boolean evaluateOLD​(Polyad polyad,
                                   State state)
      • getSystemNamespaces

        public static List<String> getSystemNamespaces()