Coinjema
1.7

org.coinjema.collections
Class SortedHashTree<T>

java.lang.Object
  extended by org.coinjema.collections.HashTree<T>
      extended by org.coinjema.collections.SortedHashTree<T>
All Implemented Interfaces:
Serializable, Map<T,HashTree<T>>

public class SortedHashTree<T>
extends HashTree<T>
implements Serializable

SortedHashTree is a different implementation of the HashTree collection class. In the SortedHashTree, the ordering of values in the tree is made explicit via the compare() function of objects added to the tree. This works in exactly the same fashion as it does for a SortedSet.

Version:
$Revision: 1.1 $
Author:
mstover1 at apache.org
See Also:
HashTree, HashTreeTraverser, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  Comparator<T> comparator
           
 
Fields inherited from class org.coinjema.collections.HashTree
data
 
Constructor Summary
SortedHashTree()
           
SortedHashTree(Collection<? extends T> keys)
           
SortedHashTree(Collection<? extends T> keys, Comparator<T> comper)
           
SortedHashTree(Comparator<T> comper)
           
SortedHashTree(T key)
           
SortedHashTree(T[] keys)
           
SortedHashTree(T[] keys, Comparator<T> comper)
           
SortedHashTree(T key, Comparator<T> comper)
           
 
Method Summary
 HashTree<T> clone()
          Create a clone of this HashTree.
protected  HashTree<T> createNewTree()
          Creates a new tree.
protected  HashTree<T> createNewTree(Collection<? extends T> values)
          Creates a new tree.
protected  HashTree<T> createNewTree(T key)
          Creates a new tree.
 void setComparator(Comparator<T> comparator)
           
 
Methods inherited from class org.coinjema.collections.HashTree
add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, addTreePath, clear, cloneTree, containsKey, containsValue, entrySet, equals, get, getObject, getObject, getObject, getObject, getTree, getTree, getTree, getTreePath, hashCode, isEmpty, keySet, list, list, list, list, put, putAll, remove, remove, replace, search, set, set, set, set, set, set, set, set, set, set, set, set, size, toString, traverse, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

comparator

protected Comparator<T> comparator
Constructor Detail

SortedHashTree

public SortedHashTree()

SortedHashTree

public SortedHashTree(Comparator<T> comper)

SortedHashTree

public SortedHashTree(T key)

SortedHashTree

public SortedHashTree(T key,
                      Comparator<T> comper)

SortedHashTree

public SortedHashTree(Collection<? extends T> keys)

SortedHashTree

public SortedHashTree(Collection<? extends T> keys,
                      Comparator<T> comper)

SortedHashTree

public SortedHashTree(T[] keys)

SortedHashTree

public SortedHashTree(T[] keys,
                      Comparator<T> comper)
Method Detail

createNewTree

protected HashTree<T> createNewTree()
Description copied from class: HashTree
Creates a new tree. This method exists to allow inheriting classes to generate the appropriate types of nodes. For instance, when a node is added, it's value is a HashTree. Rather than directly calling the HashTree() constructor, the createNewTree() method is called. Inheriting classes should override these methods and create the appropriate subclass of HashTree.

Overrides:
createNewTree in class HashTree<T>
Returns:
HashTree

createNewTree

protected HashTree<T> createNewTree(T key)
Description copied from class: HashTree
Creates a new tree. This method exists to allow inheriting classes to generate the appropriate types of nodes. For instance, when a node is added, it's value is a HashTree. Rather than directly calling the HashTree() constructor, the createNewTree() method is called. Inheriting classes should override these methods and create the appropriate subclass of HashTree.

Overrides:
createNewTree in class HashTree<T>
Returns:
HashTree

createNewTree

protected HashTree<T> createNewTree(Collection<? extends T> values)
Description copied from class: HashTree
Creates a new tree. This method exists to allow inheriting classes to generate the appropriate types of nodes. For instance, when a node is added, it's value is a HashTree. Rather than directly calling the HashTree() constructor, the createNewTree() method is called. Inheriting classes should override these methods and create the appropriate subclass of HashTree.

Overrides:
createNewTree in class HashTree<T>
Returns:
HashTree

clone

public HashTree<T> clone()
Description copied from class: HashTree
Create a clone of this HashTree. This is not a deep clone (ie, the contents of the tree are not cloned).

Overrides:
clone in class HashTree<T>
See Also:
Object.clone()

setComparator

public void setComparator(Comparator<T> comparator)
Parameters:
comparator - The comparator to set.

Coinjema
1.7

Public Domain Software.