| |
|
| java.lang.Object com.tc.util.AATree
AATree | public class AATree (Code) | | Implements an AA-tree. AA tree provides all the advantages of a Red Black Tree while keeping the implementation
simple. For more details on AA tree, check out http://user.it.uu.se/~arnea/abs/simp.html and
http://en.wikipedia.org/wiki/AA_tree This source code is taken from
http://www.cs.fiu.edu/~weiss/dsaa_java/Code/DataStructures/ and modified slightly. Note:: "matching" is based on the
compareTo method. This class is *NOT* thread safe. Synchronize externally if you want it to be thread safe.
author: Mark Allen Weiss |
Constructor Summary | |
public | AATree() Construct the tree. |
AATree | public AATree()(Code) | | Construct the tree.
|
clear | public void clear()(Code) | | Make the tree logically empty.
|
find | public Comparable find(Comparable x)(Code) | | Find an item in the tree.
Parameters: x - the item to search for. the matching item of null if not found. |
findMax | public Comparable findMax()(Code) | | Find the largest item in the tree.
the largest item or null if empty. |
findMin | public Comparable findMin()(Code) | | Find the smallest item in the tree.
the smallest item or null if empty. |
insert | public boolean insert(Comparable x)(Code) | | Insert into the tree.
Parameters: x - the item to insert. true if the item was inserted, false if was already present throws: DuplicateItemException - if x is already present. |
isEmpty | public boolean isEmpty()(Code) | | Test if the tree is logically empty.
true if empty, false otherwise. |
remove | public Comparable remove(Comparable x)(Code) | | Remove from the tree.
Parameters: x - the item to remove. throws: ItemNotFoundException - if x is not found. |
|
|
|