Package com.mckoi.database
Class AbstractFunction
java.lang.Object
com.mckoi.database.AbstractFunction
- All Implemented Interfaces:
Function
- Direct Known Subclasses:
AbstractAggregateFunction
An abstract implementation of Function.
- Author:
- Tobias Downer
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractFunction(String name, Expression[] params) Constructs the Function with the given expression array as parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of all elements that are used by this function.Returns the list of all Variable's that are used by this function.getName()Returns the name of the function.getParameter(int n) Returns the parameter at the given index in the parameters list.voidinit(VariableResolver resolver) The init function.final booleanisAggregate(QueryContext context) Returns whether the function is an aggregate function or not.booleanisGlob()Returns true if the param is the special case glob parameter (*).intReturns the number of parameters for this function.voidprepareParameters(ExpressionPreparer preparer) Prepares the parameters of the function.returnTType(VariableResolver resolver, QueryContext context) By Default, we assume a function returns a Numeric object.protected voidsetAggregate(boolean status) Call this from the constructor if the function is an aggregate.toString()
-
Constructor Details
-
AbstractFunction
Constructs the Function with the given expression array as parameters.
-
-
Method Details
-
setAggregate
protected void setAggregate(boolean status) Call this from the constructor if the function is an aggregate. -
parameterCount
public int parameterCount()Returns the number of parameters for this function. -
getParameter
Returns the parameter at the given index in the parameters list. -
isGlob
public boolean isGlob()Returns true if the param is the special case glob parameter (*). -
getName
Returns the name of the function. The name is a unique identifier that can be used to recreate this function. This identifier can be used to easily serialize the function when grouped with its parameters. -
allVariables
Returns the list of all Variable's that are used by this function. This looks up each expression in the list of parameters. This will cascade if the expressions have a Function, etc.- Specified by:
allVariablesin interfaceFunction
-
allElements
Returns the list of all elements that are used by this function. This looks up each expression in the list of parameters. This will cascade if the expressions have a Function, etc.- Specified by:
allElementsin interfaceFunction
-
isAggregate
Returns whether the function is an aggregate function or not.- Specified by:
isAggregatein interfaceFunction
-
prepareParameters
Prepares the parameters of the function.- Specified by:
prepareParametersin interfaceFunction- Throws:
DatabaseException
-
init
The init function. By default, we don't do anything however this should be overwritten if we need to check the parameter arguments. -
returnTType
By Default, we assume a function returns a Numeric object.- Specified by:
returnTTypein interfaceFunction
-
returnTType
-
toString
-