public abstract class AbsFunction extends AbsExpression
Abstract super class for all function classes.
All functions that extend the abstract class only need take care of the result computation. Everything else, like checking if arguments are valid and adding the result with the corresponding type to the transaction list is done by the abstract super class.
Must extend <code>AbstractFunction</code> and implement <code>IAxis</code>. And the implement the abstract method computeResult(), that returns the computed value as a bye-array public class ExampleFunctionAxis extends AbstractFunction implements IAxis { public ExampleAxis(final INodeReadTrx rtx, final List<IAxis> args, final int min, final int max, final int returnType) { // Must be called as first. super(rtx, args, min, max, returnType); } protected byte[] computeResult() { .... compute value and return as byte array } }
Constructor and Description |
---|
AbsFunction(INodeReadTrx rtx,
List<AbsAxis> args,
int min,
int max,
int returnType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract byte[] |
computeResult()
Computes the result value of the function.
|
AtomicValue |
evaluate()
Performs the expression dependent evaluation of the expression.
|
protected List<AbsAxis> |
getArgs() |
void |
reset(long mNodeKey)
Resetting the nodekey of this axis to a given nodekey.
|
void |
varifyParam(int mNumber)
Checks if the number of input arguments of this function is a valid
according to the function specification in XQuery 1.0 and XPath 2.0
Functions and Operators.
|
hasNext
addAtomicToItemList, close, getItemList, getNode, getStartKey, isSelfIncluded, iterator, moveTo, next, remove, resetToLastKey, resetToStartKey
public AbsFunction(INodeReadTrx rtx, List<AbsAxis> args, int min, int max, int returnType) throws TTXPathException
rtx
- Transaction to operate onargs
- List of function argumentsmin
- min number of allowed function argumentsmax
- max number of allowed function argumentsreturnType
- the type that the function's result will haveTTXPathException
- if the verify process is failing.public final void varifyParam(int mNumber) throws TTXPathException
mNumber
- number of given function argumentsTTXPathException
- if function call fails.public void reset(long mNodeKey)
reset
in class AbsExpression
mNodeKey
- the nodekey where the reset should occur to.public AtomicValue evaluate() throws TTXPathException
evaluate
in class AbsExpression
TTXPathException
- if evaluation fails.protected abstract byte[] computeResult() throws TTXPathException
TTXPathException
- if anythin odd happens while executionCopyright © 2013. All Rights Reserved.