amber.type.server
Class FileFilter

java.lang.Object
  |
  +--amber.type.server.FileFilter
All Implemented Interfaces:
java.io.FilenameFilter

public class FileFilter
extends java.lang.Object
implements java.io.FilenameFilter


Field Summary
protected  java.io.File baseDirectory
          This holds the base directory below which the object will fail the accept.
protected  java.util.Vector filters
          This holds the various filters to implement.
protected  int selectedFilter
          The filter which is currently in effect.
 
Constructor Summary
FileFilter()
          Default Constructor.
FileFilter(java.util.Vector filters)
          Initialising Constructor.
 
Method Summary
 boolean accept(java.io.File dir, java.lang.String name)
          Tests if a specified file should be included in a file list.
 void addFilter(FileFilterData filter)
          This function adds a specific FileFilterData to the current pool of filters.
 java.io.File getBaseDirectory()
          This returns the base directory for this filter.
 FileFilterData getFilter(int index)
          This function gets the specific FileFilterData from the current pool of filters.
 java.util.Vector getFilters()
          Gets the data in the following variable: This holds the various filters to implement.
 int getFiltersSize()
          Gets the data in the following variable: The number of filters in the filters vector.
 int getSelectedFilter()
          Gets the data in the following variable: The filter which is currently in effect.
protected  boolean isHigherDirectory(java.io.File dir)
          Checks to see if the directory is higher than the base directory.
 void removeFilter(FileFilterData filter)
          This function removes a specific FileFilterData from the current pool of filters.
 void setBaseDirectory(java.io.File directory)
          This sets the base directory for this filter.
 void setFilters(java.util.Vector data)
          Sets the data in the following variable: This holds the various filters to implement.
 void setSelectedFilter(FileFilterData data)
          Sets the data in the following variable: The filter which is currently in effect.
 void setSelectedFilter(int data)
          Sets the data in the following variable: The filter which is currently in effect.
 java.lang.String toString()
          This function returns the String form of the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

filters

protected java.util.Vector filters
This holds the various filters to implement.

baseDirectory

protected java.io.File baseDirectory
This holds the base directory below which the object will fail the accept.

selectedFilter

protected int selectedFilter
The filter which is currently in effect.
Constructor Detail

FileFilter

public FileFilter()
Default Constructor.

FileFilter

public FileFilter(java.util.Vector filters)
Initialising Constructor.
Parameters:
filters - This holds the various filters to implement.
Method Detail

getFilters

public java.util.Vector getFilters()
Gets the data in the following variable: This holds the various filters to implement.
Returns:
Vector containing the required information.

getFiltersSize

public int getFiltersSize()
Gets the data in the following variable: The number of filters in the filters vector.
Returns:
int containing the required information.

getSelectedFilter

public int getSelectedFilter()
Gets the data in the following variable: The filter which is currently in effect.
Returns:
int containing the required information.

setFilters

public void setFilters(java.util.Vector data)
Sets the data in the following variable: This holds the various filters to implement.
Parameters:
data - Vector containing the data to set the variable to.

setSelectedFilter

public void setSelectedFilter(int data)
Sets the data in the following variable: The filter which is currently in effect.
Parameters:
data - int containing the data to set the variable to.

setSelectedFilter

public void setSelectedFilter(FileFilterData data)
Sets the data in the following variable: The filter which is currently in effect.
Parameters:
data - FileFilterData containing the data to set the variable to.

addFilter

public void addFilter(FileFilterData filter)
This function adds a specific FileFilterData to the current pool of filters.
Parameters:
filter - FileFilterData containing a new filter.

getFilter

public FileFilterData getFilter(int index)
This function gets the specific FileFilterData from the current pool of filters.
Parameters:
index - int index of the filter to get.
Returns:
FileFilterData containing a new filter.

removeFilter

public void removeFilter(FileFilterData filter)
This function removes a specific FileFilterData from the current pool of filters.
Parameters:
filter - FileFilterData containing the filter to remove.

accept

public boolean accept(java.io.File dir,
                      java.lang.String name)
Tests if a specified file should be included in a file list.
Specified by:
accept in interface java.io.FilenameFilter
Parameters:
dir - File directory in which the file was found.
name - String name of the file to test.
Returns:
boolean true if the name should be included in the file list else false.

isHigherDirectory

protected boolean isHigherDirectory(java.io.File dir)
Checks to see if the directory is higher than the base directory.
Parameters:
dir - File containing the directory to check.
Returns:
boolean with the state of the check. true if the input directory is higher than the base directory.

setBaseDirectory

public void setBaseDirectory(java.io.File directory)
This sets the base directory for this filter. ALL files higher than this directory will fail the accept function.
Parameters:
directory - File containing the base directory.

getBaseDirectory

public java.io.File getBaseDirectory()
This returns the base directory for this filter. ALL files higher than this directory will fail the accept function.
Returns:
File containing the base directory.

toString

public java.lang.String toString()
This function returns the String form of the data.
Overrides:
toString in class java.lang.Object
Returns:
String containing the string version of this class.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.