net.sf.saxon.functions

Class Subsequence

public class Subsequence extends SystemFunction

Implements the XPath 2.0 subsequence() function
Method Summary
intcomputeCardinality()
Determine the cardinality of the function.
intcomputeSpecialProperties()
Get the static properties of this expression (other than its type).
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items in the sequence
SequenceIteratoriterate(XPathContext context)
Evaluate the function to return an iteration of selected nodes.
Expressionoptimize(ExpressionVisitor visitor, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.

Method Detail

computeCardinality

public int computeCardinality()
Determine the cardinality of the function.

computeSpecialProperties

public int computeSpecialProperties()
Get the static properties of this expression (other than its type). The result is bit-significant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items in the sequence

Parameters: th the type hierarchy cache

Returns: the type of the argument

iterate

public SequenceIterator iterate(XPathContext context)
Evaluate the function to return an iteration of selected nodes.

optimize

public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.

This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

Parameters: visitor an expression visitor contextItemType the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to ITEM_TYPE

Returns: the original expression, rewritten if appropriate to optimize execution

Throws: net.sf.saxon.trans.XPathException if an error is discovered during this phase (typically a type error)