public int next() { while (_current < _nodesSize) { final int next = _nodes.at(_current++); if (next != _lastNext) { return returnNode(_lastNext = next); } } return END; }
public DTMAxisIterator cloneIterator() { try { final DupFilterIterator clone = (DupFilterIterator) super.clone(); clone._nodes = (IntegerArray) _nodes.clone(); clone._source = _source.cloneIterator(); clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } }
/** * Set the start node for this iterator * * @param node The start node * @return A reference to this node iterator */ public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { // KeyIndex iterators are always relative to the root node, so there // is never any point in re-reading the iterator (and we SHOULD NOT). if (_source instanceof KeyIndex && _startNode == DTMDefaultBase.ROOTNODE) { return this; } if (node != _startNode) { _source.setStartNode(_startNode = node); _nodes.clear(); while ((node = _source.next()) != END) { _nodes.add(node); } _nodes.sort(); _nodesSize = _nodes.cardinality(); _current = 0; _lastNext = END; resetPosition(); } } return this; }