org.apache.jorphan.collections

Class SortedHashTree

Implemented Interfaces:
Cloneable, Map, Serializable

public class SortedHashTree
extends HashTree
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.
See Also:
HashTree, HashTreeTraverser

Field Summary

Fields inherited from class org.apache.jorphan.collections.HashTree

data

Constructor Summary

SortedHashTree()
Creates an empty new HashTree.
SortedHashTree(Collection keys)
Creates a new HashTree and adds all the objects in the given collection as top-level nodes in the tree.
SortedHashTree(Collection keys, Comparator comper)
SortedHashTree(Comparator comper)
SortedHashTree(Object key)
Creates a new HashTree and adds the given object as a top-level node.
SortedHashTree(Object key, Comparator comper)
SortedHashTree(Object[] keys)
Creates a new HashTree and adds all the objects in the given array as top-level nodes in the tree.
SortedHashTree(Object[] keys, Comparator comper)

Method Summary

protected HashTree
createNewTree()
Creates a new tree.
protected HashTree
createNewTree(Collection values)
Creates a new tree.
protected HashTree
createNewTree(Object key)
Creates a new tree.

Methods inherited from class org.apache.jorphan.collections.HashTree

add, add, add, add, add, add, add, add, add, add, add, add, add, add, addTreePath, clear, clone, cloneTree, containsKey, containsValue, createNewTree, createNewTree, createNewTree, entrySet, equals, get, getArray, getArray, getArray, getArray, getTree, getTree, getTree, getTreePath, hashCode, isEmpty, keySet, list, list, list, list, put, putAll, remove, replace, search, set, set, set, set, set, set, set, set, set, size, toString, traverse, values

Constructor Details

SortedHashTree

public SortedHashTree()
Creates an empty new HashTree.

SortedHashTree

public SortedHashTree(Collection keys)
Creates a new HashTree and adds all the objects in the given collection as top-level nodes in the tree.
Parameters:
keys - a collection of objects to be added to the created HashTree.

SortedHashTree

public SortedHashTree(Collection keys,
                      Comparator comper)

SortedHashTree

public SortedHashTree(Comparator comper)

SortedHashTree

public SortedHashTree(Object key)
Creates a new HashTree and adds the given object as a top-level node.
Parameters:
key -

SortedHashTree

public SortedHashTree(Object key,
                      Comparator comper)

SortedHashTree

public SortedHashTree(Object[] keys)
Creates a new HashTree and adds all the objects in the given array as top-level nodes in the tree.

SortedHashTree

public SortedHashTree(Object[] keys,
                      Comparator comper)

Method Details

createNewTree

protected HashTree createNewTree()
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 interface HashTree
Returns:
HashTree

createNewTree

protected HashTree createNewTree(Collection values)
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 interface HashTree
Returns:
HashTree

createNewTree

protected HashTree createNewTree(Object key)
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 interface HashTree
Returns:
HashTree

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.