/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; }
/** * @return A DTMAxisIterator which has been reset to the start node, * which may or may not be the same as this iterator. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; return this; }
/** * Clone a <code>SortingIterator</code> by cloning its source * iterator and then sharing the factory and the array of * <code>NodeSortRecords</code>. */ public DTMAxisIterator cloneIterator() { try { final SortingIterator clone = (SortingIterator) super.clone(); clone._source = _source.cloneIterator(); clone._factory = _factory; // shared between clones clone._data = _data; // shared between clones clone._free = _free; clone._current = _current; clone.setRestartable(false); return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } }
/** * Returns the number of nodes in this iterator. * * @return the number of nodes */ public int getLast() { // If nodes are stored in _nodes, take advantage of the fact that // there are no duplicates. Otherwise, fall back to the base heap // implementaiton and hope it does a good job with this. return (_nodes != null) ? _nodes.cardinality() : super.getLast(); }
/** * Clone a <code>SortingIterator</code> by cloning its source * iterator and then sharing the factory and the array of * <code>NodeSortRecords</code>. */ public DTMAxisIterator cloneIterator() { try { final SortingIterator clone = (SortingIterator) super.clone(); clone._source = _source.cloneIterator(); clone._factory = _factory; // shared between clones clone._data = _data; // shared between clones clone._free = _free; clone._current = _current; clone.setRestartable(false); return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } }
/** * Returns the number of nodes in this iterator. * * @return the number of nodes */ public int getLast() { // If nodes are stored in _nodes, take advantage of the fact that // there are no duplicates. Otherwise, fall back to the base heap // implementaiton and hope it does a good job with this. return (_nodes != null) ? _nodes.cardinality() : super.getLast(); }
/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; }
/** * @return A DTMAxisIterator which has been reset to the start node, * which may or may not be the same as this iterator. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; return this; }
/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; }
/** * @return A DTMAxisIterator which has been reset to the start node, * which may or may not be the same as this iterator. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; return this; }
/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; }
/** * @return A DTMAxisIterator which has been reset to the start node, * which may or may not be the same as this iterator. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; return this; }
/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; }
/** * @return A DTMAxisIterator which has been reset to the start node, * which may or may not be the same as this iterator. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; return this; }
/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; }