public Node nextNode ( ) { if ( currentNode == null ) return null ; Node result = getFirstChild ( currentNode ) ; if ( result != null ) { currentNode = result ; return result ; } result = getNextSibling ( currentNode ) ; if ( result != null ) { currentNode = result ; return result ; } // return parent's 1st sibling. Node parent = getParentNode ( currentNode ) ; while ( parent != null ) { result = getNextSibling ( parent ) ; if ( result != null ) { currentNode = result ; return result ; } else { parent = getParentNode ( parent ) ; } } // end , return null return null ; }
Return the next Node from the current node after applying filter whatToshow . If result is not null set the current Node .