Class MapBasedFunctionDictionary

  • All Implemented Interfaces:
    FunctionDictionaryIfc

    public class MapBasedFunctionDictionary
    extends java.lang.Object
    implements FunctionDictionaryIfc
    A default case-insensitive implementation of the function dictionary that uses a local Map.Entry<String, FunctionIfc> for storage.
    • Constructor Detail

      • MapBasedFunctionDictionary

        public MapBasedFunctionDictionary()
    • Method Detail

      • ofFunctions

        public static FunctionDictionaryIfc ofFunctions​(java.util.Map.Entry<java.lang.String,​FunctionIfc>... functions)
        Creates a new function dictionary with the specified list of functions.
        Parameters:
        functions - variable number of arguments that specify the function names and definitions that will initially be added.
        Returns:
        A newly created function dictionary with the specified functions.
      • getFunction

        public FunctionIfc getFunction​(java.lang.String functionName)
        Description copied from interface: FunctionDictionaryIfc
        Get the function definition for a function name.
        Specified by:
        getFunction in interface FunctionDictionaryIfc
        Parameters:
        functionName - The name of the function.
        Returns:
        The function definition or null if no function was found.
      • addFunction

        public void addFunction​(java.lang.String functionName,
                                FunctionIfc function)
        Description copied from interface: FunctionDictionaryIfc
        Allows to add a function to the dictionary. Implementation is optional, if you have a fixed set of functions, this method can throw an exception.
        Specified by:
        addFunction in interface FunctionDictionaryIfc
        Parameters:
        functionName - The function name.
        function - The function implementation.