private Node getNextSibling ( Node node ) { if ( node == null || node == root ) return null ; Node newNode = node . getNextSibling ( ) ; if ( newNode == null ) { newNode = node . getParentNode ( ) ; if ( newNode == null || node == root ) return null ; int parentAccept = acceptNode ( newNode ) ; if ( parentAccept == NodeFilter . FILTER_SKIP ) { return getNextSibling ( newNode ) ; } return null ; } int accept = acceptNode ( newNode ) ; if ( accept == NodeFilter . FILTER_ACCEPT ) return newNode ; else if ( accept == NodeFilter . FILTER_SKIP ) { Node fChild = getFirstChild ( newNode ) ; if ( fChild == null ) return getNextSibling ( newNode ) ; return fChild ; } else // if (accept == NodeFilter.REJECT_NODE) return getNextSibling ( newNode ) ; }
Internal function . Return the nextSibling Node from the input node after applying filter whatToshow . The current node is not consulted or set .