Package uk.me.nxg.unity
Class FunctionDefinitionMap
java.lang.Object
uk.me.nxg.unity.FunctionDefinitionMap
Provides a mapping from function abbreviations to function definitions.
This is a singleton class, so clients must first obtain the
instance of the class using getInstance()
.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructs a new function-definition map. -
Method Summary
Modifier and TypeMethodDescriptionstatic FunctionDefinitionMap
Obtain an instance of the function-definition map.static FunctionDefinition
lookupFunctionDefinition
(Syntax syntax, String functionName) Return the FunctionDefinition corresponding to a name, in a particular syntax.static String
lookupFunctionName
(Syntax syntax, FunctionDefinition fd) Return the name corresponding to a function definition in a particular syntax.
-
Constructor Details
-
FunctionDefinitionMap
protected FunctionDefinitionMap()Constructs a new function-definition map. This is protected on purpose – instances should be retrieved using thegetInstance()
method.
-
-
Method Details
-
getInstance
Obtain an instance of the function-definition map.- Returns:
- the singleton instance of this class
-
lookupFunctionDefinition
Return the FunctionDefinition corresponding to a name, in a particular syntax. Returns null if the function is not known in this syntax.- Parameters:
syntax
- one of the syntaxes ofSyntax
functionName
- the name of the function (eg "log") to be looked up- Returns:
- a function definition
-
lookupFunctionName
Return the name corresponding to a function definition in a particular syntax. The 'name' is the name of the function for display, for examplelog
for Logarithm, and this is in principle syntax-specific (though in fact there is no variation between syntaxes).- Parameters:
syntax
- we look up functions known in only this syntaxfd
- the definition of the function, which we want the name of- Returns:
- the name of a function, for display
-