net.sf.saxon.functions

Class Aggregate

public class Aggregate extends SystemFunction

This class implements the sum(), avg(), count() functions,
Field Summary
static intAVG
static intCOUNT
static intSUM
Method Summary
voidcheckArguments(StaticContext env)
Static analysis: prevent sorting of the argument
static intcount(SequenceIterator iter)
Get the number of items in a sequence identified by a SequenceIterator
ItemevaluateItem(XPathContext context)
Evaluate the function
ItemTypegetItemType(TypeHierarchy th)
Determine the item type of the value returned by the function
static booleanisCountFunction(Expression exp)
Determine whether a given expression is a call to the count() function

Field Detail

AVG

public static final int AVG

COUNT

public static final int COUNT

SUM

public static final int SUM

Method Detail

checkArguments

public void checkArguments(StaticContext env)
Static analysis: prevent sorting of the argument

count

public static int count(SequenceIterator iter)
Get the number of items in a sequence identified by a SequenceIterator

Parameters: 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()).

Returns: the number of items in the underlying sequence

Throws: XPathException if a failure occurs reading the input sequence

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate the function

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the item type of the value returned by the function

Parameters: th

isCountFunction

public static boolean isCountFunction(Expression exp)
Determine whether a given expression is a call to the count() function