Package com.ezylang.evalex.config
Class MapBasedFunctionDictionary
- java.lang.Object
-
- com.ezylang.evalex.config.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 localMap.Entry<String, FunctionIfc>for storage.
-
-
Constructor Summary
Constructors Constructor Description MapBasedFunctionDictionary()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFunction(java.lang.String functionName, FunctionIfc function)Allows to add a function to the dictionary.FunctionIfcgetFunction(java.lang.String functionName)Get the function definition for a function name.static FunctionDictionaryIfcofFunctions(java.util.Map.Entry<java.lang.String,FunctionIfc>... functions)Creates a new function dictionary with the specified list of functions.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ezylang.evalex.config.FunctionDictionaryIfc
hasFunction
-
-
-
-
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:FunctionDictionaryIfcGet the function definition for a function name.- Specified by:
getFunctionin interfaceFunctionDictionaryIfc- Parameters:
functionName- The name of the function.- Returns:
- The function definition or
nullif no function was found.
-
addFunction
public void addFunction(java.lang.String functionName, FunctionIfc function)Description copied from interface:FunctionDictionaryIfcAllows 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:
addFunctionin interfaceFunctionDictionaryIfc- Parameters:
functionName- The function name.function- The function implementation.
-
-