|
|||||||||
| Home >> All >> org >> apache >> jorphan >> [ collections overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.jorphan.collections
Class ListedHashTree

java.lang.Objectorg.apache.jorphan.collections.HashTree
org.apache.jorphan.collections.ListedHashTree
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class ListedHashTree
- extends HashTree
- implements java.io.Serializable, java.lang.Cloneable
- extends HashTree
ListedHashTree is a different implementation of the HashTree collection class. In the ListedHashTree, the order in which values are added is preserved (not to be confused with SortedHashTree, which sorts the order of the values using the compare() function). Any listing of nodes or iteration through the list of nodes of a ListedHashTree will be given in the order in which the nodes were added to the tree.
- Version:
- $Revision: 1.9 $
| Nested Class Summary | |
static class |
ListedHashTree.Test
|
| Nested classes inherited from class org.apache.jorphan.collections.HashTree |
|
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Field Summary | |
private java.util.List |
order
|
| Fields inherited from class org.apache.jorphan.collections.HashTree |
data |
| Constructor Summary | |
ListedHashTree()
|
|
ListedHashTree(java.util.Collection keys)
|
|
ListedHashTree(java.lang.Object key)
|
|
ListedHashTree(java.lang.Object[] keys)
|
|
| Method Summary | |
HashTree |
add(java.lang.Object key)
Adds an key into the HashTree at the current level. |
void |
clear()
Clears the HashTree of all contents. |
java.lang.Object |
clone()
Create a clone of this HashTree. |
HashTree |
createNewTree()
Creates a new tree. |
HashTree |
createNewTree(java.util.Collection values)
Creates a new tree. |
HashTree |
createNewTree(java.lang.Object key)
Creates a new tree. |
boolean |
equals(java.lang.Object o)
Compares all objects in the tree and verifies that the two trees contain the same objects at the same tree levels. |
java.lang.Object[] |
getArray()
Gets an array of all keys in the current HashTree node. |
int |
hashCode()
Returns a hashcode for this HashTree. |
java.util.Set |
keySet()
Returns a Set of all the keys in the top-level of this HashTree. |
java.util.Collection |
list()
Gets a Collection of all keys in the current HashTree node. |
(package private) void |
readObject(java.io.ObjectInputStream ois)
Method readObject. |
java.lang.Object |
remove(java.lang.Object key)
Removes the entire branch specified by the given key. |
void |
replace(java.lang.Object currentKey,
java.lang.Object newKey)
Finds the given current key, and replaces it with the given new key. |
void |
set(java.lang.Object key,
java.util.Collection values)
Sets a key and its values in the HashTree. |
void |
set(java.lang.Object key,
HashTree t)
Sets a key into the current tree and assigns it a HashTree as its subtree. |
void |
set(java.lang.Object key,
java.lang.Object value)
Sets a key and it's value in the HashTree. |
void |
set(java.lang.Object key,
java.lang.Object[] values)
Sets a key and it's values in the HashTree. |
int |
size()
Returns the number of top-level entries in the HashTree. |
(package private) void |
writeObject(java.io.ObjectOutputStream oos)
|
| Methods inherited from class org.apache.jorphan.collections.HashTree |
add, add, add, add, add, add, add, add, add, add, add, add, add, addTreePath, cloneTree, containsKey, containsValue, entrySet, get, getArray, getArray, getArray, getTree, getTree, getTree, getTreePath, isEmpty, list, list, list, put, putAll, search, set, set, set, set, set, toString, traverse, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
order
private java.util.List order
| Constructor Detail |
ListedHashTree
public ListedHashTree()
ListedHashTree
public ListedHashTree(java.lang.Object key)
ListedHashTree
public ListedHashTree(java.util.Collection keys)
ListedHashTree
public ListedHashTree(java.lang.Object[] keys)
| Method Detail |
clone
public java.lang.Object 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).
set
public void set(java.lang.Object key, java.lang.Object value)
- Description copied from class:
HashTree - Sets a key and it's value in the HashTree. It actually sets up a key, and
then creates a node for the key and sets the value to the new node, as a
key. Any previous nodes that existed under the given key are lost.
set
public void set(java.lang.Object key, HashTree t)
- Description copied from class:
HashTree - Sets a key into the current tree and assigns it a HashTree as its
subtree. Any previous entries under the given key are removed.
set
public void set(java.lang.Object key, java.lang.Object[] values)
- Description copied from class:
HashTree - Sets a key and it's values in the HashTree. It sets up a key in the
current node, and then creates a node for that key, and sets all the
values in the array as keys in the new node. Any keys previously held
under the given key are lost.
set
public void set(java.lang.Object key, java.util.Collection values)
- Description copied from class:
HashTree - Sets a key and its values in the HashTree. It sets up a key in the
current node, and then creates a node for that key, and set all the
values in the array as keys in the new node. Any keys previously held
under the given key are removed.
replace
public void replace(java.lang.Object currentKey, java.lang.Object newKey)
- Description copied from class:
HashTree - Finds the given current key, and replaces it with the given new key. Any
tree structure found under the original key is moved to the new key.
createNewTree
public HashTree 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:
createNewTreein classHashTree
createNewTree
public HashTree createNewTree(java.lang.Object 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:
createNewTreein classHashTree
createNewTree
public HashTree createNewTree(java.util.Collection 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:
createNewTreein classHashTree
add
public HashTree add(java.lang.Object key)
- Description copied from class:
HashTree - Adds an key into the HashTree at the current level.
list
public java.util.Collection list()
- Description copied from class:
HashTree - Gets a Collection of all keys in the current HashTree node. If the
HashTree represented a file system, this would be like getting a
collection of all the files in the current folder.
remove
public java.lang.Object remove(java.lang.Object key)
- Description copied from class:
HashTree - Removes the entire branch specified by the given key.
- Specified by:
removein interfacejava.util.Map- Overrides:
removein classHashTree
getArray
public java.lang.Object[] getArray()
- Description copied from class:
HashTree - Gets an array of all keys in the current HashTree node. If the HashTree
represented a file system, this would be like getting an array of all the
files in the current folder.
hashCode
public int hashCode()
- Description copied from class:
HashTree - Returns a hashcode for this HashTree.
- Specified by:
hashCodein interfacejava.util.Map- Overrides:
hashCodein classHashTree
equals
public boolean equals(java.lang.Object o)
- Description copied from class:
HashTree - Compares all objects in the tree and verifies that the two trees contain
the same objects at the same tree levels. Returns true if they do, false
otherwise.
- Specified by:
equalsin interfacejava.util.Map- Overrides:
equalsin classHashTree
keySet
public java.util.Set keySet()
- Description copied from class:
HashTree - Returns a Set of all the keys in the top-level of this HashTree.
- Specified by:
keySetin interfacejava.util.Map- Overrides:
keySetin classHashTree
size
public int size()
- Description copied from class:
HashTree - Returns the number of top-level entries in the HashTree.
- Specified by:
sizein interfacejava.util.Map- Overrides:
sizein classHashTree
readObject
void readObject(java.io.ObjectInputStream ois) throws java.lang.ClassNotFoundException, java.io.IOException
- Description copied from class:
HashTree - Method readObject.
- Overrides:
readObjectin classHashTree
writeObject
void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException
- Overrides:
writeObjectin classHashTree
clear
public void clear()
- Description copied from class:
HashTree - Clears the HashTree of all contents.
- Specified by:
clearin interfacejava.util.Map- Overrides:
clearin classHashTree
|
|||||||||
| Home >> All >> org >> apache >> jorphan >> [ collections overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC