of_remove


pfcapsrv.pbl   >   pfc_n_cst_tree   >   of_remove   

Full name pfc_n_cst_tree.of_remove
Access public
Extend of integer
Return value integer
Prototype public function integer of_remove(ref n_cst_treenode)

Name Datatype
No Data

Name Datatype
lb_height boolean
li_rc integer
lnv_keynode n_cst_treenode

public function integer of_remove (ref n_cst_treenode anv_currentnode);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_remove
//
//	Access:  public
//
//	Arguments : 
//	anv_currentnode (by ref) : pointer to the node that contains 
//			the key/data that is to be removed
//
//	Returns:  integer
// 1 : Success, the node was removed
//	-1 : Failure, the node was not found
// -2 : Failure, the node passed in is invalid
//
//	Description: 
//	Removes the node that anv_currentnode identifies. However due to
//	the rotations that may have occurred while rebalancing the tree after 
//	the deletion occurs, the data in the original node may have been 
//	moved. This function does return the node that was actually 
//	removed but it may not be the same node that was requested to be 
//	removed. So be careful and if you need the contents of the node 
//	after removing it make a copy before removal or use a dummy node 
//	to identify the node to be deleted. We suggest that you not call this 
//	function yourself, but use the destroy function to remove and 
//	destroy the node.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

boolean 		lb_height = false
n_cst_treenode 	lnv_keynode
integer 		li_rc

// Validate arguments.
if isnull(anv_currentnode) or not isvalid(anv_currentnode) then 
	return -2
end if

setpointer(hourglass!)

// make a copy of the node so that it contains the key and data information
of_create(lnv_keynode)
anv_currentnode.of_copyto(lnv_keynode)

// use the copy to specify the search for the node
li_rc = of_delnode(lnv_keynode,inv_root,lb_height)
anv_currentnode = inv_removednode
destroy lnv_keynode

return li_rc

end function

     
Name Owner
pfc_n_cst_tree.of_destroy pfc_n_cst_tree

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.setpointer systemfunctions
pfc_n_cst_tree.of_create pfc_n_cst_tree
pfc_n_cst_tree.of_delnode pfc_n_cst_tree
pfc_n_cst_treenode.of_copyto pfc_n_cst_treenode

     
Full name
No Data

     
Name Scope
No Data