of_search


pfcapsrv.pbl   >   pfc_n_cst_tree   >   of_search   

Full name pfc_n_cst_tree.of_search
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_search(ref n_cst_treenode,n_cst_treenode)

Name Datatype
No Data

Name Datatype
No Data

protected function integer of_search (ref n_cst_treenode anv_currentnode, n_cst_treenode anv_keynode);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_search
//
//	Access:  protected
//
//	Arguments : 
//	anv_currentnode n_cst_treenode : node to be examined, also used to return the 
//											node that was found
//	anv_keynode n_cst_treenode : contains the key information to be searched for
//
//	Returns:  integer
//	1 : success, node was found
//	-1 : failure, node was not found
//
//	Description:  
//	Recursively search the tree until the node is found (success) or the 
//	end of a branch is found (failure)
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

choose case inv_compare.of_compare(anv_keynode,anv_currentnode)
	case inv_compare.LESSTHAN 
		// anv_keynode < anv_currentnode
		anv_currentnode.of_getprev(anv_currentnode)
		if isvalid(anv_currentnode) then 
			return of_search(anv_currentnode,anv_keynode)
		end if
		
	case inv_compare.EQUAL
		// anv_keynode = anv_currentnode
		return 1
		
	case inv_compare.GREATERTHAN 
		// anv_keynode > anv_currentnode
		anv_currentnode.of_getnext(anv_currentnode)
		if isvalid(anv_currentnode) then 
			return of_search(anv_currentnode,anv_keynode)
		end if
		
end choose

return -1

end function

     
Name Owner
pfc_n_cst_tree.of_search pfc_n_cst_tree
pfc_n_cst_tree.of_find pfc_n_cst_tree

     
Name Owner
systemfunctions.isvalid systemfunctions
pfc_n_cst_nodecomparebase.of_compare pfc_n_cst_nodecomparebase
pfc_n_cst_tree.of_search pfc_n_cst_tree
pfc_n_cst_nodebase.of_getnext pfc_n_cst_nodebase
pfc_n_cst_nodebase.of_getprev pfc_n_cst_nodebase

     
Full name
No Data

     
Name Scope
No Data