/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { int node = DTMAxisIterator.END; // If nodes are stored in _nodes, take advantage of the fact that // there are no duplicates and they are stored in document order. // Otherwise, fall back to the base heap implementation to do a // good job with this. if (_nodes != null) { if (position > 0) { if (position <= _nodes.cardinality()) { _position = position; node = _nodes.at(position-1); } else { _position = _nodes.cardinality(); } } } else { node = super.getNodeByPosition(position); } return node; } }
/** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { int node = DTMAxisIterator.END; // If nodes are stored in _nodes, take advantage of the fact that // there are no duplicates and they are stored in document order. // Otherwise, fall back to the base heap implementation to do a // good job with this. if (_nodes != null) { if (position > 0) { if (position <= _nodes.cardinality()) { _position = position; node = _nodes.at(position-1); } else { _position = _nodes.cardinality(); } } } else { node = super.getNodeByPosition(position); } return node; } }