com.mucommander.file.filter
Class AttributeFileFilter

java.lang.Object
  extended by com.mucommander.file.filter.FileFilter
      extended by com.mucommander.file.filter.AttributeFileFilter

public class AttributeFileFilter
extends FileFilter

AttributeFileFilter matches files which have a specific attribute set. Here's a list of supported file attributes:

Only one attribute can be matched at a time. To match several attributes, combine them using a ChainedFileFilter.

Author:
Maxence Bernard

Field Summary
static int ARCHIVE
          Tests if the file is an archive.
static int BROWSABLE
          Tests if the file is browsable, cf AbstractFile.isBrowsable().
static int DIRECTORY
          Tests if the file is a directory, cf AbstractFile.isDirectory().
static int FILE
          Tests if the file is a regular file, i.e.
static int HIDDEN
          Tests if the file is hidden, cf AbstractFile.isHidden().
static int ROOT
          Tests if the file is a root folder, cf AbstractFile.isRoot().
static int SYMLINK
          Tests if the file is a symlink, cf AbstractFile.isSymlink().
 
Fields inherited from class com.mucommander.file.filter.FileFilter
inverted
 
Constructor Summary
AttributeFileFilter(int attribute)
          Creates a new AttributeFileFilter that matches files which have the specified attribute set.
AttributeFileFilter(int attribute, boolean inverted)
          Creates a new AttributeFileFilter that matches files which have the specified attribute set.
 
Method Summary
 boolean accept(AbstractFile file)
          Returns true if the given file was accepted by this filter, false if it was rejected.
 int getAttribute()
          Returns the attribute which files are tested against.
 void setAttribute(int attribute)
          Sets the attribute which files are tested against.
 
Methods inherited from class com.mucommander.file.filter.FileFilter
accept, filter, isInverted, match, match, reject, reject, setInverted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTORY

public static final int DIRECTORY
Tests if the file is a directory, cf AbstractFile.isDirectory().

See Also:
Constant Field Values

FILE

public static final int FILE
Tests if the file is a regular file, i.e. not a directory. Note that this is equivalent to inverting DIRECTORY.

See Also:
Constant Field Values

BROWSABLE

public static final int BROWSABLE
Tests if the file is browsable, cf AbstractFile.isBrowsable().

See Also:
Constant Field Values

ARCHIVE

public static final int ARCHIVE
Tests if the file is an archive.

See Also:
Constant Field Values

SYMLINK

public static final int SYMLINK
Tests if the file is a symlink, cf AbstractFile.isSymlink().

See Also:
Constant Field Values

HIDDEN

public static final int HIDDEN
Tests if the file is hidden, cf AbstractFile.isHidden().

See Also:
Constant Field Values

ROOT

public static final int ROOT
Tests if the file is a root folder, cf AbstractFile.isRoot().

See Also:
Constant Field Values
Constructor Detail

AttributeFileFilter

public AttributeFileFilter(int attribute)
Creates a new AttributeFileFilter that matches files which have the specified attribute set. This filter will operate in normal, non-inverted mode.

Parameters:
attribute - the attribute to test files against

AttributeFileFilter

public AttributeFileFilter(int attribute,
                           boolean inverted)
Creates a new AttributeFileFilter that matches files which have the specified attribute set. This filter operates in the specified mode.

Parameters:
attribute - the attribute to test files against
inverted - if true, this filter will operate in inverted mode.
Method Detail

getAttribute

public int getAttribute()
Returns the attribute which files are tested against.

Returns:
the attribute which files are tested against.

setAttribute

public void setAttribute(int attribute)
Sets the attribute which files are tested against.

Parameters:
attribute - the attribute which files are tested against.

accept

public boolean accept(AbstractFile file)
Description copied from class: FileFilter
Returns true if the given file was accepted by this filter, false if it was rejected.

The inverted mode has no effect on the values returned by this method.

Specified by:
accept in class FileFilter
Parameters:
file - the file to test
Returns:
true if the given file was accepted by this FileFilter


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard