public class SumFunctionCall extends FunctionCallImpl
INVALID_NUMBER_PARAMS, INVALID_RESULT
EXPR, FUNCTION_CALL, LITERAL, NUMBER, VARIABLE_REFERENCE
BOOLEAN, ERROR, FILTER_EXPR, LOCATION_PATH, NODE_TEST, PATH_EXPR, PRIMARY, STEP, STRING, UNION_EXPR
Constructor and Description |
---|
SumFunctionCall()
Creates a new SumFunctionCall
|
Modifier and Type | Method and Description |
---|---|
double |
computeSum(NodeSet nodeSet)
Computes the sum of the given NodeSet.
|
XPathResult |
evaluate(XPathContext context)
Evaluates the expression and returns the XPath result.
|
addParameter, getFunctionName, getParameter, getParameterCount, toString
getExprType, getType
public XPathResult evaluate(XPathContext context) throws XPathException
context
- The XPathContext to use during evaluation.XPathException
- if an error occured while
evaluating this expression.public double computeSum(NodeSet nodeSet) throws XPathException
nodeSet
- the NodeSet to the compute the sum ofXPathException
- when a non-numeric value is
encountered.