net.sf.saxon.functions
Class Aggregate

java.lang.Object
  |
  +--net.sf.saxon.expr.ComputedExpression
        |
        +--net.sf.saxon.expr.FunctionCall
              |
              +--net.sf.saxon.functions.SystemFunction
                    |
                    +--net.sf.saxon.functions.Aggregate
All Implemented Interfaces:
Expression, java.io.Serializable

public class Aggregate
extends SystemFunction

This class implements the sum(), avg(), count() functions,

See Also:
Serialized Form

Field Summary
static int AVG
           
static int COUNT
           
static int SUM
           
 
Fields inherited from class net.sf.saxon.functions.SystemFunction
operation
 
Fields inherited from class net.sf.saxon.expr.FunctionCall
argument
 
Fields inherited from class net.sf.saxon.expr.ComputedExpression
lineNumber, NO_ARGUMENTS, staticProperties
 
Constructor Summary
Aggregate()
           
 
Method Summary
 void checkArguments(StaticContext env)
          Static analysis: prevent sorting of the argument
static int count(SequenceIterator enum)
          Get the number of items in a sequence identified by a SequenceIterator
 Item evaluateItem(XPathContext context)
          Evaluate the function
 
Methods inherited from class net.sf.saxon.functions.SystemFunction
addContextDocumentArgument, computeCardinality, display, getDetails, getItemType, getName, getRequiredType, main, makeSystemFunction, useContextItemAsDefault
 
Methods inherited from class net.sf.saxon.expr.FunctionCall
analyze, checkArgumentCount, getNumberOfArguments, getSubExpressions, preEvaluate, promote, setArguments, simplify, simplifyArguments
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, getCardinality, getDependencies, getIntrinsicDependencies, getLineNumber, getSourceLocator, getSpecialProperties, iterate, markTailFunctionCalls, setLineNumber, typeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUM

public static final int SUM
See Also:
Constant Field Values

AVG

public static final int AVG
See Also:
Constant Field Values

COUNT

public static final int COUNT
See Also:
Constant Field Values
Constructor Detail

Aggregate

public Aggregate()
Method Detail

checkArguments

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

Overrides:
checkArguments in class SystemFunction
XPathException

evaluateItem

public Item evaluateItem(XPathContext context)
                  throws XPathException
Evaluate the function

Specified by:
evaluateItem in interface Expression
Overrides:
evaluateItem in class ComputedExpression
Parameters:
context - The context in which the expression is to be evaluated
Returns:
the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
Throws:
XPathException - if any dynamic error occurs evaluating the expression

count

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

Parameters:
enum - 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().
Returns:
the number of items in the underlying sequence
Throws:
XPathException