Class Directory

java.lang.Object
  |
  +--JFile
        |
        +--Directory

public class Directory
extends JFile

Directory of JFiles. A Directory is a JFile that maintains a table of the JFiles it contains

Version:
6

Field Summary
 
Fields inherited from class JFile
separator
 
Constructor Summary
Directory(String name, User creator, Directory parent)
          Construct a Directory.
 
Method Summary
 void addJFile(String name, JFile afile)
          Add a JFile to this Directory.
 String[] getFileNames()
          Get the contents of this Directory as an array of the file names, each of which is a String.
 int getSize()
          The size of a directory is the number of TextFiles it contains.
 String getSuffix()
          Suffix used for printing Directory names; we define it as the (system dependent) name separator used in path names.
 JFile retrieveJFile(String filename)
          Get a JFile in this Directory, by name .
 
Methods inherited from class JFile
getCreateDate, getModDate, getName, getOwner, getParent, getPathName, isRoot, setModDate, setOwner, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Directory

public Directory(String name,
                 User creator,
                 Directory parent)
Construct a Directory.

Parameters:
name - the name for this Directory (in its parent Directory)
creator - the owner of this new Directory
parent - the Directory in which this Directory lives.
Method Detail

addJFile

public void addJFile(String name,
                     JFile afile)
Add a JFile to this Directory. Overwrite if a JFile of that name already exists.

Parameters:
name - the name under which this JFile is added.
afile - the JFile to add.

getFileNames

public String[] getFileNames()
Get the contents of this Directory as an array of the file names, each of which is a String.

Returns:
the array of names.

getSize

public int getSize()
The size of a directory is the number of TextFiles it contains.

Specified by:
getSize in class JFile
Returns:
the number of TextFiles.

getSuffix

public String getSuffix()
Suffix used for printing Directory names; we define it as the (system dependent) name separator used in path names.

Specified by:
getSuffix in class JFile
Returns:
the suffix for Directory names.

retrieveJFile

public JFile retrieveJFile(String filename)
Get a JFile in this Directory, by name .

Parameters:
filename - the name of the JFile to find.
Returns:
the JFile found.