org.clapper.util.io
Class CombinationFileFilter

java.lang.Object
  extended by org.clapper.util.io.CombinationFileFilter
All Implemented Interfaces:
java.io.FileFilter

Deprecated. Use AndFileFilter and OrFileFilter

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

A CombinationFileFilter contains one or more java.io.FileFilter objects. When its accept() method is called, the CombinationFileFilter object passes the file through the contained filters. If the CombinationFileFilter object's mode is set to AND_FILTERS, then a file must be accepted by all contained filters to be accepted. If the CombinationFileFilter object's mode is set to OR_FILTERS, then a file name is accepted if any one of the contained filters accepts it. The default mode is AND_FILTERS.

The contained filters are applied in the order they were added to the CombinationFileFilter object.

Version:
$Revision: 6735 $
Author:
Copyright © 2004-2007 Brian M. Clapper
See Also:
FileFilter, CombinationFilenameFilter, MultipleRegexFilenameFilter

Field Summary
static CombinationFilterMode AND_FILTERS
          Deprecated. Convenience constant for backward compatibility: Mode setting that instructs the filter to AND all the contained filters.
static CombinationFilterMode OR_FILTERS
          Deprecated. Convenience constant for backward compatibility: Mode setting that instructs the filter to OR all the contained filters.
 
Constructor Summary
CombinationFileFilter()
          Deprecated. Construct a new CombinationFileFilter with a mode of AND_FILTERS.
CombinationFileFilter(CombinationFilterMode mode)
          Deprecated. Construct a new CombinationFileFilter with the specified mode.
 
Method Summary
 boolean accept(java.io.File file)
          Deprecated. Determine whether a file is to be accepted or not, based on the contained filters and the mode.
 void addFilter(java.io.FileFilter filter)
          Deprecated. Add a filter to the set of contained filters.
 CombinationFilterMode getMode()
          Deprecated. Get the combination mode of this CombinationFileFilter object.
 void removeFilter(java.io.FileFilter filter)
          Deprecated. Remove a filter from the set of contained filters.
 void setMode(CombinationFilterMode mode)
          Deprecated. Change the combination mode of this CombinationFileFilter object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AND_FILTERS

public static final CombinationFilterMode AND_FILTERS
Deprecated. 
Convenience constant for backward compatibility: Mode setting that instructs the filter to AND all the contained filters.

See Also:
CombinationFilterMode.AND_FILTERS

OR_FILTERS

public static final CombinationFilterMode OR_FILTERS
Deprecated. 
Convenience constant for backward compatibility: Mode setting that instructs the filter to OR all the contained filters.

See Also:
CombinationFilterMode.OR_FILTERS
Constructor Detail

CombinationFileFilter

public CombinationFileFilter()
Deprecated. 
Construct a new CombinationFileFilter with a mode of AND_FILTERS. The mode can be changed later by calling setMode().

See Also:
CombinationFileFilter(CombinationFilterMode), setMode(org.clapper.util.io.CombinationFilterMode)

CombinationFileFilter

public CombinationFileFilter(CombinationFilterMode mode)
Deprecated. 
Construct a new CombinationFileFilter with the specified mode.

Parameters:
mode - AND_FILTERS if a filename must be accepted by all contained filters. OR_FILTERS if a filename only needs to be accepted by one of the contained filters.
See Also:
setMode(org.clapper.util.io.CombinationFilterMode)
Method Detail

getMode

public CombinationFilterMode getMode()
Deprecated. 
Get the combination mode of this CombinationFileFilter object.

Returns:
AND_FILTERS if a filename must be accepted by all contained filters. OR_FILTERS if a filename only needs to be accepted by one of the contained filters.
See Also:
setMode(org.clapper.util.io.CombinationFilterMode)

setMode

public void setMode(CombinationFilterMode mode)
Deprecated. 
Change the combination mode of this CombinationFileFilter object.

Parameters:
mode - AND_FILTERS if a filename must be accepted by all contained filters. OR_FILTERS if a filename only needs to be accepted by one of the contained filters.
See Also:
getMode()

addFilter

public void addFilter(java.io.FileFilter filter)
Deprecated. 
Add a filter to the set of contained filters.

Parameters:
filter - the FileFilter to add.
See Also:
removeFilter(java.io.FileFilter)

removeFilter

public void removeFilter(java.io.FileFilter filter)
Deprecated. 
Remove a filter from the set of contained filters.

Parameters:
filter - the FileFilter to remove.
See Also:
addFilter(java.io.FileFilter)

accept

public boolean accept(java.io.File file)
Deprecated. 
Determine whether a file is to be accepted or not, based on the contained filters and the mode. If this object's mode mode is set to AND_FILTERS, then a file must be accepted by all contained filters to be accepted. If this object's mode is set to OR_FILTERS, then a file name is accepted if any one of the contained filters accepts it. If the set of contained filters is empty, then this method returns false.

Specified by:
accept in interface java.io.FileFilter
Parameters:
file - The file to check for acceptance
Returns:
true if the file matches, false if it doesn't


Copyright © 2004-2007 Brian M. Clapper. All Rights Reserved.