org.omegahat.Environment.IO
Class DirectoryFilter

java.lang.Object
  |
  +--org.omegahat.Environment.IO.DirectoryFilter
All Implemented Interfaces:
java.io.FilenameFilter, java.io.Serializable
Direct Known Subclasses:
DirectoryNameFilter

public class DirectoryFilter
extends java.lang.Object
implements java.io.FilenameFilter, java.io.Serializable

A class to be used in the File.list() method as a filter for either excluding or including directories only. Which action is taken - exclusion or inclusion - is determined by the accept() method and this can be specified as a boolean either an construction or at any time via the accept() method.

See Also:
Serialized Form

Field Summary
protected  boolean accept
          Flag indicating whether a directory that is considered to match the criteria is included or excluded from the list.
 
Constructor Summary
DirectoryFilter()
           
DirectoryFilter(boolean val)
          Constructor that controls whether the list is inclusory or exclusor.
 
Method Summary
 boolean accept()
           
 boolean accept(boolean value)
           
 boolean accept(java.io.File dir, java.lang.String name)
          This is the method that determines if the specified entry within the given directory is considered a match, by which we mean it is a directory (and not the parent directory ..).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accept

protected boolean accept
Flag indicating whether a directory that is considered to match the criteria is included or excluded from the list. This indicates whether it is an inclusory or exclusory filter.
Constructor Detail

DirectoryFilter

public DirectoryFilter()

DirectoryFilter

public DirectoryFilter(boolean val)
Constructor that controls whether the list is inclusory or exclusor.
Parameters:
val - this is the value stored in the accept field used when indicating the appropriate action when a "match" occurs for a particular directory.
Method Detail

accept

public boolean accept(java.io.File dir,
                      java.lang.String name)
This is the method that determines if the specified entry within the given directory is considered a match, by which we mean it is a directory (and not the parent directory ..).
Specified by:
accept in interface java.io.FilenameFilter
Returns:
the value of the accept field indicating whether the entry should be included or excluded.

accept

public boolean accept()

accept

public boolean accept(boolean value)