java.io.Serializable
, javax.xml.transform.SourceLocator
, LocationProvider
, SaxonLocator
, EvaluableItem
, SequenceIterable
, InstructionInfo
, org.xml.sax.Locator
public class Aggregate extends SystemFunction
Modifier and Type | Field | Description |
---|---|---|
static int |
AVG |
|
static int |
COUNT |
|
static int |
SUM |
EVALUATE_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, staticProperties
argument
operation
Constructor | Description |
---|---|
Aggregate() |
Modifier and Type | Method | Description |
---|---|---|
static AtomicValue |
average(SequenceIterator iter,
XPathContext context,
javax.xml.transform.SourceLocator location) |
Calculate average
|
void |
checkArguments(ExpressionVisitor visitor) |
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,
javax.xml.transform.SourceLocator location) |
Calculate the total of a sequence.
|
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, display, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, findParentOf, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, isUpdatingExpression, iterate, iterateEvents, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, typeError
addExternalFunctionCallToPathMap, checkArgumentCount, equals, explain, getArguments, getDisplayName, getFunctionName, getNumberOfArguments, hashCode, iterateSubExpressions, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionName, simplify, simplifyArguments, toString, typeCheck
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addContextDocumentArgument, addDocToPathMap, computeSpecialProperties, copy, getDetails, getErrorCodeForTypeErrors, getRequiredType, makeSystemFunction, optimize, setDetails, useContextItemAsDefault
public static final int SUM
public static final int AVG
public static final int COUNT
public void checkArguments(ExpressionVisitor visitor) throws XPathException
checkArguments
in class SystemFunction
visitor
- the expression visitorXPathException
public ItemType getItemType(TypeHierarchy th)
getItemType
in class SystemFunction
th
- the type hierarchy cachepublic int computeCardinality()
computeCardinality
in class SystemFunction
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
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 evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic static AtomicValue total(SequenceIterator iter, XPathContext context, javax.xml.transform.SourceLocator location) throws XPathException
iter
- iterator over the items to be totalledcontext
- the XPath dynamic contextlocation
- location of the expression in the source for diagnosticsXPathException
public static AtomicValue average(SequenceIterator iter, XPathContext context, javax.xml.transform.SourceLocator location) throws XPathException
iter
- iterator over the items to be totalledcontext
- the XPath dynamic contextlocation
- location of the expression in the source for diagnosticsXPathException
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)
exp
- an expression to be examined