/** * This is a very special method. This allows the navigator to step once it has reached the * existing OM. At this point the isNavigable method will return false but the isComplete method * may return false which means that the navigating the given element is not complete but the * navigator cannot proceed. */ public void step() { if (!end) { next = node; updateNextNode(); } }
/** * Gets the next node. * * @return Returns OMNode in the sequence of preorder traversal. Note however that an element * node is treated slightly differently. Once the element is passed it returns the same * element in the next encounter as well. */ public OMNode next() { if (next == null) { return null; } node = next; visited = backtracked; backtracked = false; updateNextNode(); // set the starting and ending flags if (root.equals(node)) { if (!start) { end = true; } else { start = false; } } return node; }