|
of_balance
|
|
Full name
|
pfc_n_cst_tree.of_balance
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_balance(ref n_cst_treenode,ref boolean)
|
Name
|
Datatype
|
lnv_temp
|
n_cst_treenode
|
protected function integer of_balance (ref n_cst_treenode anv_delnode, ref boolean ab_height);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_balance
//
// Access: protected
//
// Arguments :
// anv_delnode n_cst_treenode : node to be searched
// ab_height boolean : indicates whether the 'height; of the tree has changed or not
//
// Returns: integer
// 1 : success
//
// Description:
// Recursively searches the tree to balance it after a deletion
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
n_cst_treenode lnv_temp
anv_delnode.of_getnext(lnv_temp)
if isvalid(lnv_temp) then
of_balance(lnv_temp,ab_height)
anv_delnode.of_setnext(lnv_temp)
if ab_height then of_balanceright(anv_delnode,ab_height)
else
anv_delnode.of_copyto(inv_shiftnode)
inv_removednode = anv_delnode
anv_delnode.of_getprev(lnv_temp)
anv_delnode =lnv_temp
ab_height = true
end if
return 1
end function