|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.expr.Expression
net.sf.saxon.expr.FunctionCall
net.sf.saxon.functions.SystemFunction
net.sf.saxon.functions.Aggregate
public class Aggregate
This class implements the sum(), avg(), count() functions,
Field Summary | |
---|---|
static int |
AVG
|
static int |
COUNT
|
static int |
SUM
|
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD |
Constructor Summary | |
---|---|
Aggregate()
|
Method Summary | |
---|---|
static AtomicValue |
average(SequenceIterator iter,
XPathContext context,
SourceLocator location)
Calculate average |
void |
checkArguments(StaticContext env)
Static analysis: prevent sorting of the argument |
int |
computeCardinality()
Determine the cardinality of the function. |
static int |
count(SequenceIterator iter)
Get the number of items in a sequence identified by a SequenceIterator |
Item |
evaluateItem(XPathContext context)
Evaluate the function |
ItemType |
getItemType(TypeHierarchy th)
Determine the item type of the value returned by the function |
static boolean |
isCountFunction(Expression exp)
Determine whether a given expression is a call to the count() function |
static AtomicValue |
total(SequenceIterator iter,
XPathContext context,
SourceLocator location)
Calculate the total of a sequence. |
Methods inherited from class net.sf.saxon.functions.SystemFunction |
---|
computeSpecialProperties, display, getDetails, getErrorCodeForTypeErrors, main, makeSystemFunction, optimize, setDetails |
Methods inherited from class net.sf.saxon.expr.FunctionCall |
---|
getArguments, getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionNameCode, simplify, typeCheck |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SUM
public static final int AVG
public static final int COUNT
Constructor Detail |
---|
public Aggregate()
Method Detail |
---|
public void checkArguments(StaticContext env) throws XPathException
checkArguments
in class SystemFunction
XPathException
public ItemType getItemType(TypeHierarchy th)
getItemType
in class SystemFunction
th
-
public int computeCardinality()
computeCardinality
in class SystemFunction
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in interface EvaluableItem
evaluateItem
in class Expression
context
- The context in which the expression is to be evaluated
XPathException
- if any dynamic error occurs evaluating the
expressionpublic static AtomicValue total(SequenceIterator iter, XPathContext context, SourceLocator location) throws XPathException
XPathException
public static AtomicValue average(SequenceIterator iter, XPathContext context, SourceLocator location) throws XPathException
XPathException
public static int count(SequenceIterator iter) throws XPathException
iter
- The SequenceIterator. This method moves the current position
of the supplied iterator; if this isn't safe, make a copy of the iterator
first by calling getAnother(). The supplied iterator must be positioned
before the first item (there must have been no call on next()).
XPathException
- if a failure occurs reading the input sequencepublic static boolean isCountFunction(Expression exp)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |