net.sf.saxon.expr

Class CardinalityCheckingIterator

public final class CardinalityCheckingIterator extends Object implements SequenceIterator

CardinalityCheckingIterator returns the items in an underlying sequence unchanged, but checks that the number of items conforms to the required cardinality. Because cardinality checks are required to take place even if the consumer of the sequence does not require all the items, we read the first two items at initialization time. This is sufficient to perform the checks; after that we can simply return the items from the base sequence.
Constructor Summary
CardinalityCheckingIterator(SequenceIterator base, int requiredCardinality, RoleLocator role, SourceLocator locator)
Construct an CardinalityCheckingIterator that will return the same items as the base sequence, checking how many there are
Method Summary
voidclose()
Itemcurrent()
SequenceIteratorgetAnother()
intgetProperties()
Get properties of this iterator, as a bit-significant integer.
Itemnext()
intposition()

Constructor Detail

CardinalityCheckingIterator

public CardinalityCheckingIterator(SequenceIterator base, int requiredCardinality, RoleLocator role, SourceLocator locator)
Construct an CardinalityCheckingIterator that will return the same items as the base sequence, checking how many there are

Parameters: base the base iterator requiredCardinality the required Cardinality

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.

next

public Item next()

position

public int position()