private void findDelete ( DeleteNode point , DeleteStack stack , Object deleteKey ) { java . util . Comparator comp = deleteComparator ( ) ; GBSNode p ; /* P is used to march down the tree */ int xcc ; /* Compare result */ GBSNode l_last = null ; /* Node from which we last departed by */ /* turning left (logical successor) */ GBSNode r_last = null ; /* Node from which we last departed by */ /* turning right (logical predecessor) */ p = root ( ) ; /* Root of tree */ /* Remember father of root */ stack . start ( dummyTopNode ( ) , "GBSTree.findDelete" ) ; while ( p != null ) { xcc = comp . compare ( deleteKey , p . middleKey ( ) ) ; if ( xcc == 0 ) /* Delete key = median key */ { midDelete ( stack , p , point ) ; p = null ; } else if ( xcc < 0 ) /* Delete key < median key */ { if ( p . leftChild ( ) != null ) { l_last = p ; /* Remember node from which we */ /* last moved left (successor) */ stack . push ( NodeStack . PROCESS_CURRENT , p , "GBSTree.findDelete(1)" ) ; p = p . leftChild ( ) ; } else /* There is no left child */ { /* Delete on left side */ leftDelete ( p , r_last , deleteKey , point ) ; p = null ; } } else /* Delete key > median key */ { if ( p . rightChild ( ) != null ) { r_last = p ; /* Remember node from which we */ /* last moved right (predecessor) */ stack . push ( NodeStack . DONE_VISITS , p , "GBSTree.findDelete(2)" ) ; p = p . rightChild ( ) ; } else /* There is no right child */ { rightDelete ( p , l_last , deleteKey , point ) ; p = null ; } } } }
Find the delete point within the tree .