Documentation of 'org.clapper.util.io.AndFileFilter' Java class
AndFileFilter
org.clapper.util.io

Class AndFileFilter

  • All Implemented Interfaces:
    java.io.FileFilter


    public final class AndFileFilter
    extends java.lang.Object
    implements java.io.FileFilter

    An AndFileFilter contains logically ANDs other java.io.FileFilter objects. When its accept() method is called, the AndFileFilter object passes the file through the contained filters. The file is only accepted if it is accepted by all contained filters. This class conceptually provides a logical "AND" operator for file filters.

    The contained filters are applied in the order they were added to the AndFileFilter object. This class's accept() method stops looping over the contained filters as soon as it encounters one whose accept() method returns false (implementing a "short-circuited AND" operation.)

    See Also:
    FileFilter, OrFileFilter, NotFileFilter, AndFilenameFilter, RegexFileFilter
    • Constructor Summary

      Constructors 
      Constructor and Description
      AndFileFilter()
      Construct a new AndFileFilter with no contained filters.
      AndFileFilter(java.io.FileFilter... filters)
      Construct a new AndFileFilter with a set of contained filters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean accept(java.io.File file)
      Determine whether a file is to be accepted or not, based on the contained filters.
      AndFileFilter addFilter(java.io.FileFilter filter)
      Add a filter to the set of contained filters.
      void removeFilter(java.io.FileFilter filter)
      Remove a filter from the set of contained filters.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AndFileFilter

        public AndFileFilter()
        Construct a new AndFileFilter with no contained filters.
      • AndFileFilter

        public AndFileFilter(java.io.FileFilter... filters)
        Construct a new AndFileFilter with a set of contained filters. Additional filters may be added later, via calls to the addFilter() method.
        Parameters:
        filters - filters to add
    • Method Detail

      • addFilter

        public AndFileFilter addFilter(java.io.FileFilter filter)
        Add a filter to the set of contained filters.
        Parameters:
        filter - the FileFilter to add.
        Returns:
        this object, to permit chained calls.
        See Also:
        removeFilter(java.io.FileFilter)
      • removeFilter

        public void removeFilter(java.io.FileFilter filter)
        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)
        Determine whether a file is to be accepted or not, based on the contained filters. The file is accepted if any one of the contained filters accepts it. This method stops looping over the contained filters as soon as it encounters one whose accept() method returns false (implementing a "short-circuited AND" operation.)

        If the set of contained filters is empty, then this method returns true.

        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

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.