/** * Get the next item from one of the input sequences, * checking that it is a node. * * @param iter the iterator from which the next item is to be taken * @return the next value returned by that iterator * @throws XPathException if a failure occurs reading from the input sequence */ private NodeInfo next(SequenceIterator<? extends NodeInfo> iter) throws XPathException { return iter.next(); // rely on type-checking to prevent a ClassCastException }
/** * Get the context item * @return the context item, or null if the context item is undefined */ public final Item getContextItem() { if (currentIterator==null) { return null; } return currentIterator.current(); }
private static boolean empty(SequenceIterator iter) throws XPathException { boolean result; if ((iter.getProperties() & SequenceIterator.LOOKAHEAD) != 0) { result = !((LookaheadIterator) iter).hasNext(); } else { result = iter.next() == null; } iter.close(); return result; }
public static Sequence<?> toLazySequence2(SequenceIterator<?> iterator) throws XPathException { if ((iterator.getProperties() & SequenceIterator.GROUNDED) != 0 && !(iterator instanceof RangeIterator) && !(iterator instanceof ReverseRangeIterator)) { return iterator.materialize(); } else { return new LazySequence<>(iterator); } }
/** * Get properties of this iterator, as a bit-significant integer. * * @return the properties of this iterator. This will be some combination of * properties such as {@link net.sf.saxon.om.SequenceIterator#GROUNDED}, {@link net.sf.saxon.om.SequenceIterator#LAST_POSITION_FINDER}, * and {@link net.sf.saxon.om.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. */ public int getProperties() { return base.getProperties() & (SequenceIterator.LAST_POSITION_FINDER | SequenceIterator.LOOKAHEAD); }
public SequenceIterator iterateCurrentGroup() throws XPathException { SequenceIterator iter = (SequenceIterator)nodeKeys[(position-1)*recordSize+comparators.length+3]; return iter.getAnother(); } }
/** * Get properties of this iterator, as a bit-significant integer. * * @return the properties of this iterator. This will be some combination of * properties such as {@link #GROUNDED}, {@link #LAST_POSITION_FINDER}, * and {@link #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. * @since 8.6 */ public int getProperties() { return base.getProperties(); }
public void close() { if (currentIter != null) { currentIter.close(); } }
public SequenceIterator iterateCurrentGroup() throws XPathException { SequenceIterator iter = (SequenceIterator)nodeKeys[(position-1)*recordSize+comparators.length+3]; return iter.getAnother(); } }
public static Sequence<?> toLazySequence2(SequenceIterator<?> iterator) throws XPathException { if ((iterator.getProperties() & SequenceIterator.GROUNDED) != 0 && !(iterator instanceof RangeIterator) && !(iterator instanceof ReverseRangeIterator)) { return iterator.materialize(); } else { return new LazySequence<>(iterator); } }
private static boolean exists(SequenceIterator iter) throws XPathException { boolean result; if ((iter.getProperties() & SequenceIterator.LOOKAHEAD) != 0) { result = ((LookaheadIterator) iter).hasNext(); } else { result = iter.next() != null; } iter.close(); return result; }