com.planet_ink.coffee_mud.core
Class CMFile.CMVFSDir

java.lang.Object
  extended by com.planet_ink.coffee_mud.core.CMFile.CMVFSFile
      extended by com.planet_ink.coffee_mud.core.CMFile.CMVFSDir
Enclosing class:
CMFile

public static class CMFile.CMVFSDir
extends CMFile.CMVFSFile

A class to represent a VFS/database directory. An extension of CMVFSFile


Field Summary
static java.util.Comparator<CMFile.CMVFSFile> fcomparator
           
protected  CMFile.CMVFSFile[] files
           
protected  CMFile.CMVFSDir parent
           
 
Fields inherited from class com.planet_ink.coffee_mud.core.CMFile.CMVFSFile
mask, path
 
Constructor Summary
CMFile.CMVFSDir(CMFile.CMVFSDir parent, int mask, java.lang.String path)
          Creates a new directory CMFile.VFS_MASK_DIRECTORY, CMFile.VFS_MASK_HIDDEN etc.
CMFile.CMVFSDir(CMFile.CMVFSDir parent, java.lang.String path)
          Creates a new directory
 
Method Summary
 boolean add(CMFile.CMVFSFile f)
          Adds the given vfs file to this directory
 boolean delete(CMFile.CMVFSFile file)
          Deletes the given VFS file from this directory.
 CMFile.CMVFSFile fetch(java.lang.String filePath)
          Returns the vfs file at the given path starting here.
 CMFile.CMVFSDir fetchSubDir(java.lang.String path, boolean create)
          Returns a subdirectory of this directory at the given path, and possibly creates it if not found.
protected  CMFile.CMVFSFile[] getFiles()
           
 
Methods inherited from class com.planet_ink.coffee_mud.core.CMFile.CMVFSFile
copyInto, getMaskBits, getPath, readData, saveData, setData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

files

protected CMFile.CMVFSFile[] files

parent

protected CMFile.CMVFSDir parent

fcomparator

public static java.util.Comparator<CMFile.CMVFSFile> fcomparator
Constructor Detail

CMFile.CMVFSDir

public CMFile.CMVFSDir(CMFile.CMVFSDir parent,
                       java.lang.String path)
Creates a new directory

Parameters:
parent - the directory containing this one
path - the full path and name of this vfs file

CMFile.CMVFSDir

public CMFile.CMVFSDir(CMFile.CMVFSDir parent,
                       int mask,
                       java.lang.String path)
Creates a new directory CMFile.VFS_MASK_DIRECTORY, CMFile.VFS_MASK_HIDDEN etc.

Parameters:
parent - the directory containing this one
mask - bitmap of info about this directory
path - the full path and name of this vfs file
Method Detail

getFiles

protected CMFile.CMVFSFile[] getFiles()

fetchSubDir

public CMFile.CMVFSDir fetchSubDir(java.lang.String path,
                                   boolean create)
Returns a subdirectory of this directory at the given path, and possibly creates it if not found.

Parameters:
path - the path to look down
create - true to create if not found, false just to search
Returns:
the found subdir, or null

add

public final boolean add(CMFile.CMVFSFile f)
Adds the given vfs file to this directory

Parameters:
f - the file to add
Returns:
true if successful, false otherwise

delete

public final boolean delete(CMFile.CMVFSFile file)
Deletes the given VFS file from this directory.

Parameters:
file - the file to delete
Returns:
true if deleted, false otherwise

fetch

public final CMFile.CMVFSFile fetch(java.lang.String filePath)
Returns the vfs file at the given path starting here.

Parameters:
filePath - the path to get the file from
Returns:
the file at that path, or null if nonexistant.