ehcache

net.sf.ehcache.store.compound.factories
Class AATreeSet<T extends java.lang.Comparable>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<T>
          extended by net.sf.ehcache.store.compound.factories.AATreeSet<T>
Type Parameters:
T - type of values stored
All Implemented Interfaces:
java.lang.Iterable<T>, java.util.Collection<T>, java.util.Set<T>, java.util.SortedSet<T>

public class AATreeSet<T extends java.lang.Comparable>
extends java.util.AbstractSet<T>
implements java.util.SortedSet<T>

A AA-Tree based SortedSet implementation

Author:
Chris Dennis

Nested Class Summary
static class AATreeSet.AbstractTreeNode<E>
          Abstract node implementation that can be extended with a custom payload.
static interface AATreeSet.Node<E>
          Interface implemented by nodes within this tree.
 
Constructor Summary
AATreeSet()
           
 
Method Summary
 boolean add(T o)
           
 void clear()
           
 java.util.Comparator<? super T> comparator()
          
 T find(java.lang.Object probe)
          Find the node within this tree equal to the probe node.
 T first()
          
protected  AATreeSet.Node<T> getRoot()
          Returns the root node of this tree.
 java.util.SortedSet<T> headSet(T toElement)
          
 boolean isEmpty()
           
 java.util.Iterator<T> iterator()
           
 T last()
          
 boolean remove(java.lang.Object o)
           
 T removeAndReturn(java.lang.Object o)
          Remove the node matching this object and return it.
 int size()
           
 java.util.SortedSet<T> subSet(T fromElement, T toElement)
          
 java.util.SortedSet<T> tailSet(T fromElement)
          
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, contains, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

AATreeSet

public AATreeSet()
Method Detail

add

public boolean add(T o)
Specified by:
add in interface java.util.Collection<T extends java.lang.Comparable>
Specified by:
add in interface java.util.Set<T extends java.lang.Comparable>
Overrides:
add in class java.util.AbstractCollection<T extends java.lang.Comparable>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<T extends java.lang.Comparable>
Specified by:
remove in interface java.util.Set<T extends java.lang.Comparable>
Overrides:
remove in class java.util.AbstractCollection<T extends java.lang.Comparable>

removeAndReturn

public T removeAndReturn(java.lang.Object o)
Remove the node matching this object and return it.


clear

public void clear()
Specified by:
clear in interface java.util.Collection<T extends java.lang.Comparable>
Specified by:
clear in interface java.util.Set<T extends java.lang.Comparable>
Overrides:
clear in class java.util.AbstractCollection<T extends java.lang.Comparable>

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T extends java.lang.Comparable>
Specified by:
iterator in interface java.util.Collection<T extends java.lang.Comparable>
Specified by:
iterator in interface java.util.Set<T extends java.lang.Comparable>
Specified by:
iterator in class java.util.AbstractCollection<T extends java.lang.Comparable>

size

public int size()
Specified by:
size in interface java.util.Collection<T extends java.lang.Comparable>
Specified by:
size in interface java.util.Set<T extends java.lang.Comparable>
Specified by:
size in class java.util.AbstractCollection<T extends java.lang.Comparable>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<T extends java.lang.Comparable>
Specified by:
isEmpty in interface java.util.Set<T extends java.lang.Comparable>
Overrides:
isEmpty in class java.util.AbstractCollection<T extends java.lang.Comparable>

comparator

public java.util.Comparator<? super T> comparator()

Specified by:
comparator in interface java.util.SortedSet<T extends java.lang.Comparable>

subSet

public java.util.SortedSet<T> subSet(T fromElement,
                                     T toElement)

Specified by:
subSet in interface java.util.SortedSet<T extends java.lang.Comparable>

headSet

public java.util.SortedSet<T> headSet(T toElement)

Specified by:
headSet in interface java.util.SortedSet<T extends java.lang.Comparable>

tailSet

public java.util.SortedSet<T> tailSet(T fromElement)

Specified by:
tailSet in interface java.util.SortedSet<T extends java.lang.Comparable>

first

public T first()

Specified by:
first in interface java.util.SortedSet<T extends java.lang.Comparable>

last

public T last()

Specified by:
last in interface java.util.SortedSet<T extends java.lang.Comparable>

find

public T find(java.lang.Object probe)
Find the node within this tree equal to the probe node.


getRoot

protected final AATreeSet.Node<T> getRoot()
Returns the root node of this tree.


ehcache

true