net.sf.saxon.expr

Class MappingIterator

Implemented Interfaces:
SequenceIterator

public final class MappingIterator
extends java.lang.Object
implements SequenceIterator

MappingIterator merges a sequence of sequences into a single flat sequence. It takes as inputs an iteration, and a mapping function to be applied to each Item returned by that iteration. The mapping function itself returns another iteration. The result is an iteration of the concatenation of all the iterations returned by the mapping function.

This is a powerful class. It is used, with different mapping functions, in a great variety of ways. It underpins the way that "for" expressions and path expressions are evaluated, as well as sequence expressions. It is also used in the implementation of the document(), key(), and id() functions.

Nested Class Summary

static interface
MappingIterator.StatefulMappingFunction
Interface representing a mapping function that retains state information and that therefore needs to be cloned if a new mapping iterator is created

Fields inherited from interface net.sf.saxon.om.SequenceIterator

GROUNDED, LAST_POSITION_FINDER, LOOKAHEAD

Constructor Summary

MappingIterator(SequenceIterator base, MappingFunction action)
Construct a MappingIterator that will apply a specified MappingFunction to each Item returned by the base iterator.

Method Summary

Item
current()
SequenceIterator
getAnother()
int
getProperties()
Get properties of this iterator, as a bit-significant integer.
Item
next()
int
position()

Constructor Details

MappingIterator

public MappingIterator(SequenceIterator base,
                       MappingFunction action)
Construct a MappingIterator that will apply a specified MappingFunction to each Item returned by the base iterator.
Parameters:
base - the base iterator
action - the mapping function to be applied

Method Details

current

public Item current()
Specified by:
current in interface SequenceIterator

getAnother

public SequenceIterator getAnother()
            throws XPathException
Specified by:
getAnother in interface SequenceIterator

getProperties

public int getProperties()
Get properties of this iterator, as a bit-significant integer.
Specified by:
getProperties in interface SequenceIterator
Returns:
the properties of this iterator. This will be some combination of properties such as SequenceIterator.GROUNDED, SequenceIterator.LAST_POSITION_FINDER, and SequenceIterator.LOOKAHEAD. It is always acceptable to return the value zero, indicating that there are no known special properties. It is acceptable for the properties of the iterator to change depending on its state.

next

public Item next()
            throws XPathException
Specified by:
next in interface SequenceIterator

position

public int position()
Specified by:
position in interface SequenceIterator