Package adams.parser.plugin
Class AbstractParserFunction
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.parser.plugin.AbstractParserFunction
-
- All Implemented Interfaces:
LoggingSupporter
,SizeOfHandler
,ParserFunction
,Serializable
- Direct Known Subclasses:
Env
public abstract class AbstractParserFunction extends LoggingObject implements ParserFunction
Ancestor for custom functions to be used in parsers. Functions must be stateless, as only a single instance is kept in memory.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractParserFunction()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Object
callFunction(Object[] params)
Gets called from the parser.protected abstract String
check(Object[] params)
Performs some checks on the input parameters.protected abstract Object
doCallFunction(Object[] params)
Gets called from the parser.abstract String
getFunctionHelp()
Returns the help string for the function.abstract String
getFunctionName()
Returns the function name.static String[]
getFunctions()
Returns a list with classnames of functions.abstract String
getFunctionSignature()
Returns the signature of the function.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Method Detail
-
getFunctionName
public abstract String getFunctionName()
Returns the function name. Can only consist of letters, underscores, numbers.- Specified by:
getFunctionName
in interfaceParserFunction
- Returns:
- the name of the function
-
getFunctionSignature
public abstract String getFunctionSignature()
Returns the signature of the function.- Specified by:
getFunctionSignature
in interfaceParserFunction
- Returns:
- the signature
-
getFunctionHelp
public abstract String getFunctionHelp()
Returns the help string for the function.- Specified by:
getFunctionHelp
in interfaceParserFunction
- Returns:
- the help string
-
check
protected abstract String check(Object[] params)
Performs some checks on the input parameters.- Parameters:
params
- the input parameters- Returns:
- null if OK, otherwise error message
-
doCallFunction
protected abstract Object doCallFunction(Object[] params)
Gets called from the parser.- Parameters:
params
- the parameters obtained through the parser- Returns:
- the result to be used further in the parser
-
callFunction
public Object callFunction(Object[] params)
Gets called from the parser.- Specified by:
callFunction
in interfaceParserFunction
- Parameters:
params
- the parameters obtained through the parser- Returns:
- the result to be used further in the parser
-
getFunctions
public static String[] getFunctions()
Returns a list with classnames of functions.- Returns:
- the filter classnames
-
-