net.sf.saxon.expr

Class ItemMappingIterator

public final class ItemMappingIterator extends Object implements SequenceIterator, LookaheadIterator

ItemMappingIterator applies a mapping function to each item in a sequence. The mapping function either returns a single item, or null (representing an empty sequence).

This is a specialization of the more general MappingIterator class, for use in cases where a single input item never maps to a sequence of more than one output item.

Constructor Summary
ItemMappingIterator(SequenceIterator base, ItemMappingFunction action)
Construct an ItemMappingIterator that will apply a specified ItemMappingFunction to each Item returned by the base iterator.
ItemMappingIterator(SequenceIterator base, ItemMappingFunction action, boolean oneToOne)
Construct an ItemMappingIterator that will apply a specified ItemMappingFunction to each Item returned by the base iterator.
Method Summary
voidclose()
Itemcurrent()
SequenceIteratorgetAnother()
intgetProperties()
Get properties of this iterator, as a bit-significant integer.
booleanhasNext()
booleanisOneToOne()
Ask whether this ItemMappingIterator is one-to-one: that is, for every input item, there is always exactly one output item.
Itemnext()
intposition()
voidsetOneToOne(boolean oneToOne)
Say whether this ItemMappingIterator is one-to-one: that is, for every input item, there is always exactly one output item.

Constructor Detail

ItemMappingIterator

public ItemMappingIterator(SequenceIterator base, ItemMappingFunction action)
Construct an ItemMappingIterator that will apply a specified ItemMappingFunction to each Item returned by the base iterator.

Parameters: base the base iterator action the mapping function to be applied

ItemMappingIterator

public ItemMappingIterator(SequenceIterator base, ItemMappingFunction action, boolean oneToOne)
Construct an ItemMappingIterator that will apply a specified ItemMappingFunction to each Item returned by the base iterator.

Parameters: base the base iterator action the mapping function to be applied oneToOne true if this iterator is one-to-one

Method Detail

close

public void close()

current

public Item current()

getAnother

public SequenceIterator getAnother()

getProperties

public int getProperties()
Get properties of this iterator, as a bit-significant integer.

Returns: the properties of this iterator. This will be some combination of properties such as GROUNDED, LAST_POSITION_FINDER, and 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.

hasNext

public boolean hasNext()

isOneToOne

public boolean isOneToOne()
Ask whether this ItemMappingIterator is one-to-one: that is, for every input item, there is always exactly one output item. The default is false.

Returns: true if this iterator is one-to-one

Throws: XPathException

next

public Item next()

position

public int position()

setOneToOne

public void setOneToOne(boolean oneToOne)
Say whether this ItemMappingIterator is one-to-one: that is, for every input item, there is always exactly one output item. The default is false.

Parameters: oneToOne true if this iterator is one-to-one

Throws: XPathException