Institut de Robòtica i Informàtica Industrial

get

PURPOSE ^

Get function for BTrees.

SYNOPSIS ^

function out=get(T,field)

DESCRIPTION ^

 Get function for BTrees.

   Retrives information from a tree. Possible fields to query are:
     - root: Root node index.
     - height: Height of the tree.
     - data: All nodes (including leaves).
     - numNodes: Number of nodes (including leaves) in the tree.

 See also BTree.

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:

SOURCE CODE ^

0001 function out=get(T,field)
0002 % Get function for BTrees.
0003 %
0004 %   Retrives information from a tree. Possible fields to query are:
0005 %     - root: Root node index.
0006 %     - height: Height of the tree.
0007 %     - data: All nodes (including leaves).
0008 %     - numNodes: Number of nodes (including leaves) in the tree.
0009 %
0010 % See also BTree.
0011 
0012   r=T.root;
0013   switch field
0014     case 'root'
0015       out=T.root;
0016     case 'height'
0017       out=T.data{r}.heigth;
0018     case 'data'
0019             out=T.data;
0020     case 'numNodes'
0021             out=T.last;
0022     otherwise
0023       error('Unknown field in Balanced-Tree get');
0024   end


Institut de Robòtica i Informàtica Industrial

Generated on Fri 24-Jul-2009 12:32:50 by m2html © 2003