Package uk.me.nxg.unity
Class FunctionDefinitionMap
- java.lang.Object
-
- uk.me.nxg.unity.FunctionDefinitionMap
-
public abstract class FunctionDefinitionMap extends java.lang.Object
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
Constructors Modifier Constructor Description protected
FunctionDefinitionMap()
Constructs a new function-definition map.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FunctionDefinitionMap
getInstance()
Obtain an instance of the function-definition map.static FunctionDefinition
lookupFunctionDefinition(Syntax syntax, java.lang.String functionName)
Return the FunctionDefinition corresponding to a name, in a particular syntax.static java.lang.String
lookupFunctionName(Syntax syntax, FunctionDefinition fd)
Return the name corresponding to a function definition in a particular syntax.
-
-
-
Constructor Detail
-
FunctionDefinitionMap
protected FunctionDefinitionMap()
Constructs a new function-definition map. This is protected on purpose – instances should be retrieved using thegetInstance()
method.
-
-
Method Detail
-
getInstance
public static FunctionDefinitionMap getInstance()
Obtain an instance of the function-definition map.- Returns:
- the singleton instance of this class
-
lookupFunctionDefinition
public static FunctionDefinition lookupFunctionDefinition(Syntax syntax, java.lang.String functionName)
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
public static java.lang.String lookupFunctionName(Syntax syntax, FunctionDefinition fd)
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
-
-