|
of_traverse
|
|
Full name
|
pfc_n_cst_tree.of_traverse
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_traverse(n_cst_treenode,ref n_cst_treenode[],ref long)
|
Name
|
Datatype
|
lnv_temp
|
n_cst_treenode
|
protected function integer of_traverse (n_cst_treenode anv_currentnode, ref n_cst_treenode anv_list[], ref long al_cnt);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_traverse
//
// Access: protected
//
// Arguments :
// anv_currentnode Node to be examined
// anv_list[] (by reference) list of nodes found
// al_cnt long (by reference) count of nodes in anv_list
//
// Returns: integer
// 1 : Success, it was passed a valid node
// -1 : failure, it was passed an invalid node
//
// Description:
// Traverse the tree, adding the nodes visited to the anv_list after the
// left node has been visited but before the right node has been visited.
// This gives a list of all of the nodes in the tree in sorted order.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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
// Validate arguments.
if isnull(anv_currentnode) or not isvalid(anv_currentnode) then return -1
// Get the previous node.
anv_currentnode.of_getprev(lnv_temp)
// Recursive call to traverse.
if isvalid(lnv_temp) then of_traverse(lnv_temp,anv_list,al_cnt)
// Add entry into array.
al_cnt++
anv_list[al_cnt] = anv_currentnode
// Get the next node.
anv_currentnode.of_getnext(lnv_temp)
// Recursive call to traverse.
if isvalid(lnv_temp) then of_traverse(lnv_temp,anv_list,al_cnt)
return 1
end function