|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.filespace.Tree
javafe.filespace.HashTree
javafe.filespace.PreloadedTree
javafe.filespace.UnionTree
A UnionTree is a Tree which represents the union of a series of Tree's.
A node exists in a UnionTree iff a corresponding node (i.e., same fully qualified name) exists in any of the underlying Trees. Its data field is copied at creation time from the first such corresponding node (i.e., the one whose Tree is first in the list of underlying Trees).
Exception: if the underlying list contains 0 Trees, then the UnionTree contains exactly 1 node, the root node, which will have data equal to null.
The other corresponding nodes of a node X can be accessed by calling X.duplicates(), which returns a list of all the corresponding nodes (including the first one) in the same order as the original input list of Trees.
The behavior of a UnionTree is undefined if the underlying Trees it depends on are altered after it has been created.
Field Summary | |
protected java.util.Hashtable |
edges
The mapping between our outgoing edge's labels and the subTrees they point to. |
protected Tree[] |
roots
The list of Trees we represent the union of: Invariant: contains no nulls and is non-null. |
Fields inherited from class javafe.filespace.Tree |
data |
Constructor Summary | |
|
UnionTree(Tree[] roots)
Create a new Tree that represents the union of the Trees in roots. |
protected |
UnionTree(Tree parent,
java.lang.String label,
Tree[] roots)
Create a non-root node: roots must be non-null and contain no nulls. |
Method Summary | |
java.util.Enumeration |
children()
* Fetching and counting children: * * |
int |
countDuplicates()
Return the number of nodes corresponding to this one there are in the underlying Trees. |
Tree[] |
duplicates()
Return a list of all the nodes that correspond to this one in the underlying Trees in the same order as the original list of Trees. |
void |
ensureEdgesLoaded()
Ensure that the edges map is ready for use |
Tree |
getChild(java.lang.String label)
Fetch our direct child along the edge labelled label. |
protected void |
loadEdge(java.lang.String label)
|
protected void |
loadEdges()
Load the edges map for use. |
static void |
main(java.lang.String[] args)
A simple test driver |
void |
printDetails(java.lang.String prefix)
* Debugging functions: * * |
Methods inherited from class javafe.filespace.Tree |
getChildrenCount, getLabel, getParent, getQualifiedChild, getQualifiedName, getRootNode, getSimpleName, isLeaf, print |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Tree[] roots
Invariant: contains no nulls and is non-null.
protected java.util.Hashtable edges
Invariant: all elements of edges are Trees and all keys are Strings.
Constructor Detail |
public UnionTree(Tree[] roots)
roots must be non-null and contain no nulls.
protected UnionTree(Tree parent, java.lang.String label, Tree[] roots)
roots must be non-null and contain no nulls.
Method Detail |
public Tree[] duplicates()
public int countDuplicates()
protected void loadEdges()
loadEdges
in class PreloadedTree
protected void loadEdge(java.lang.String label)
public void printDetails(java.lang.String prefix)
printDetails
in class Tree
public static void main(java.lang.String[] args)
public final void ensureEdgesLoaded()
public final java.util.Enumeration children()
children
in class HashTree
public final Tree getChild(java.lang.String label)
HashTree
getChild
in class HashTree
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |