Tree
Object Hierarchy:
Description:
[ Compact ]
public class Tree<K,V>
The GTree struct is an opaque data structure representing a balanced binary tree.
It should be accessed only by using the following functions.
Content:
Creation methods:
Methods:
- public void insert (owned K key, owned V value)
Inserts a key/value pair into a Tree.
- public void replace (owned K key, owned V value)
Inserts a new key and value into a Tree
similar to insert.
- public int nnodes ()
Gets the number of nodes in a Tree.
- public int height ()
Gets the height of a Tree.
- public weak V lookup (K key)
Gets the value corresponding to the given key.
- public bool lookup_extended (K lookup_key, out K orig_key, out V value)
Looks up a key in the Tree, returning the
original key and the associated value.
- public void @foreach (TraverseFunc<K,V> traverse_func)
Calls the given function for each of the key/value pairs in the
Tree.
- public weak V search (TreeSearchFunc<K> search_func)
- public weak V search_key (CompareFunc<K> search_func, K key)
Searches a Tree using search_func
.
- public bool remove (K key)
Removes a key/value pair from a Tree.
- public bool steal (K key)
Removes a key and its associated value from a Tree
without calling the key and value destroy functions.