T
- Type of objects to keep in the directory.public class Directory<T> extends Object
Constructor and Description |
---|
Directory()
Default constructor creates a ROOT directory.
|
Directory(Directory parent,
String name)
constructor for subdirectory
|
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
T object)
Add an object to current directory.
|
void |
cd()
sets current directory to ROOT.
|
boolean |
cd(String name)
Changes current working directory to given directory
|
void |
clear() |
boolean |
exists(String name) |
Set<String> |
getChildrenList(String parent,
List<String> list,
int depth) |
List<String> |
getCompositeObjectList(Directory dir) |
Directory |
getDir() |
Directory |
getDir(String dirName) |
Directory |
getDirectoryByPath(String path) |
List<String> |
getDirectoryList() |
Map<String,Directory> |
getDirectoryMap()
returns map of subdirectories.
|
String |
getDirectoryPath()
return a String representing full path to current directory.
|
List<String> |
getDirectoryPath(Directory dir)
returns list of
|
String |
getName()
returns Directory name
|
DefaultMutableTreeNode |
getNodes(DefaultMutableTreeNode node,
List<String> objects,
int depth) |
T |
getObject(String fullPath) |
T |
getObject(String directory,
String name)
returns object
|
List<T> |
getObjectList() |
Map<String,T> |
getObjectMap()
returns map of the objects in the directory
|
Directory |
getParent()
Returns pointer to parent directory.
|
Directory |
getRoot() |
DefaultMutableTreeNode |
getTreeNode() |
void |
ls()
list the content of current directory
|
static void |
main(String[] args) |
void |
mkdir(String name)
create a directory in current directory.
|
void |
pwd() |
String |
stringDirectoryFromPath(String path) |
String |
stringObjectFromPath(String path) |
void |
tree()
list the tree structure starting with current directory.
|
public Directory()
public void mkdir(String name)
name
- directory name to createpublic Map<String,Directory> getDirectoryMap()
public Map<String,T> getObjectMap()
public void cd()
public Directory getRoot()
public boolean cd(String name)
name
- directory name to change current one.public Directory getParent()
public String getName()
public List<String> getDirectoryPath(Directory dir)
dir
- public String getDirectoryPath()
public void add(String name, T object)
name
- object
- public void pwd()
public void ls()
public void tree()
public T getObject(String directory, String name)
directory
- name
- public void clear()
public Directory getDir()
public boolean exists(String name)
public DefaultMutableTreeNode getTreeNode()
public DefaultMutableTreeNode getNodes(DefaultMutableTreeNode node, List<String> objects, int depth)
public static void main(String[] args)
Jas4pp 1.5 © Java Analysis Studio for Particle Physics