|
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.FileTree
A FileTree is a Tree that mirrors the contents of a disk filesystem; the constructor takes in a directory and returns a tree representing the filesystem rooted at that directory.
FileTree works by scanning directories the first time clients ask for information about that part of the tree. If the filesystem is changed afterwards, the changes will not be visible in the FileTree.
The data field of every (sub)node in a FileTree contains a non-null NormalGenericFile representing the file it mirrors on disk.
Field Summary | |
protected java.io.File |
dir
The directory we are a snapshot of |
protected java.util.Hashtable |
edges
The mapping between our outgoing edge's labels and the subTrees they point to. |
Fields inherited from class javafe.filespace.Tree |
data |
Constructor Summary | |
|
FileTree(java.io.File dir)
Create a root node: |
protected |
FileTree(Tree parent,
java.lang.String label,
java.io.File dir)
Create a non-root node: |
Method Summary | |
java.util.Enumeration |
children()
* Fetching and counting children: * * |
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 |
loadEdges()
Load the edges map for use. |
static void |
main(java.lang.String[] args)
A simple test driver |
Methods inherited from class javafe.filespace.Tree |
getChildrenCount, getLabel, getParent, getQualifiedChild, getQualifiedName, getRootNode, getSimpleName, isLeaf, print, printDetails |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.File dir
protected java.util.Hashtable edges
Invariant: all elements of edges are Trees and all keys are Strings.
Constructor Detail |
public FileTree(java.io.File dir)
protected FileTree(Tree parent, java.lang.String label, java.io.File dir)
Method Detail |
protected void loadEdges()
loadEdges
in class PreloadedTree
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 |