net.sf.saxon.functions
Class Aggregate
- EvaluableItem, InstructionInfoProvider, SequenceIterable, Serializable, SourceLocator
This class implements the sum(), avg(), count() functions,
addContextDocumentArgument , addDocToPathMap , checkArguments , computeCardinality , computeSpecialProperties , copy , getDetails , getErrorCodeForTypeErrors , getItemType , getRequiredType , makeSystemFunction , optimize , setDetails , useContextItemAsDefault |
addExternalFunctionCallToPathMap , checkArgumentCount , checkArguments , equals , explain , getArguments , getDisplayName , getFunctionName , getNumberOfArguments , hashCode , iterateSubExpressions , optimize , preEvaluate , promote , replaceSubExpression , setArguments , setFunctionName , simplify , simplifyArguments , toString , typeCheck |
addToPathMap , adoptChildExpression , checkPermittedContents , computeCardinality , computeDependencies , computeSpecialProperties , computeStaticProperties , copy , display , doPromotion , dynamicError , effectiveBooleanValue , evaluateAsString , evaluateItem , explain , explain , findParentOf , getCardinality , getColumnNumber , getConstructType , getContainer , getDependencies , getExecutable , getHostLanguage , getImplementationMethod , getInstructionInfo , getIntrinsicDependencies , getItemType , getLineNumber , getLocationId , getLocationProvider , getPublicId , getSlotsUsed , getSpecialProperties , getSystemId , hasLoopingSubexpression , implementsStaticTypeCheck , iterate , iterateEvents , iterateSubExpressions , markTailFunctionCalls , optimize , process , promote , replaceSubExpression , resetLocalStaticProperties , setContainer , setFiltered , setFlattened , setLocationId , simplify , staticTypeCheck , suppressValidation , toString , typeCheck , typeError |
AVG
public static final int AVG
COUNT
public static final int COUNT
SUM
public static final int SUM
average
public static AtomicValue average(SequenceIterator iter,
XPathContext context,
SourceLocator location)
throws XPathException
Calculate average
iter
- iterator over the items to be totalledcontext
- the XPath dynamic contextlocation
- location of the expression in the source for diagnostics
- the average of the values
count
public static int count(SequenceIterator iter)
throws XPathException
Get the number of items in a sequence identified by a SequenceIterator
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()).
- the number of items in the underlying sequence
isCountFunction
public static boolean isCountFunction(Expression exp)
Determine whether a given expression is a call to the count() function
exp
- an expression to be examined
- true if the expression is a call to the count() function
total
public static AtomicValue total(SequenceIterator iter,
XPathContext context,
SourceLocator location)
throws XPathException
Calculate the total of a sequence.
iter
- iterator over the items to be totalledcontext
- the XPath dynamic contextlocation
- location of the expression in the source for diagnostics
- the total, according to the rules of the XPath sum() function, but returning null
if the sequence is empty. (It's then up to the caller to decide what the correct result is
for an empty sequence.