/** * Returns the next preceding node. * * @return the next preceding node * * @throws NoSuchElementException if no preceding nodes remain * * @see java.util.Iterator#next() */ public Object next() throws NoSuchElementException { if (!hasNext()) { throw new NoSuchElementException(); } while (true) { Object result = childrenOrSelf.previous(); if (childrenOrSelf.hasPrevious()) { // if this isn't 'self' construct 'descendant-or-self' stack.add(childrenOrSelf); childrenOrSelf = childrenOrSelf(result); continue; } return result; } }
childrenOrSelf = childrenOrSelf(node);