public Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException { return new FollowingAxisIterator( contextNode, this ); // throw new UnsupportedAxisException("following"); }
/** * Returns true if there are any following nodes remaining; * false otherwise. * * @return true if any following nodes remain * * @see java.util.Iterator#hasNext() */ public boolean hasNext() { while ( ! currentSibling.hasNext() ) { if ( ! goForward() ) { return false; } } return true; }
/** * Returns the next following node. * * @return the next following node * * @throws NoSuchElementException if no following nodes remain * * @see java.util.Iterator#next() */ public Object next() throws NoSuchElementException { if ( ! hasNext() ) { throw new NoSuchElementException(); } return currentSibling.next(); }
private boolean goForward() { while ( ! siblings.hasNext() ) { if ( !goUp() ) { return false; } } Object nextSibling = siblings.next(); this.currentSibling = new DescendantOrSelfAxisIterator(nextSibling, navigator); return true; }
@Override public Iterator<?> getFollowingAxisIterator(final Object contextNode) throws UnsupportedAxisException { return new FollowingAxisIterator(contextNode, this); }