org.entityfs.util.filter.entity
Class DirectoryContainsFilter

java.lang.Object
  extended by org.entityfs.support.filter.AbstractConvenientFilter<EntityView>
      extended by org.entityfs.util.filter.entity.DirectoryContainsFilter
All Implemented Interfaces:
Cloneable, EntityFilter, ConvenientFilter<EntityView>, Filter<EntityView>

public class DirectoryContainsFilter
extends AbstractConvenientFilter<EntityView>
implements EntityFilter

This filter matches directories that contain at least x entities that match a supplied EntityFilter, where x is a configurable number.

Since:
1.1.3
Author:
Karl Gustafsson
In_jar:
entityfs-util

Constructor Summary
DirectoryContainsFilter(Filter<? super EntityView> f)
          Create a directory contains filter that matches directories that contain at least one entity that match the supplied filter.
DirectoryContainsFilter(Filter<? super EntityView> f, int noOfMatchesThreshold)
          Create a directory contains filter that matches directories that contain at least noOfMatchesThreshold entities that match the supplied filter f.
 
Method Summary
 boolean equals(Object o)
           
 int hashCode()
           
 boolean matches(EntityView ev)
          Does the filter match the object?
 String toString()
           
 
Methods inherited from class org.entityfs.support.filter.AbstractConvenientFilter
and, bitwiseNegate, isCase, not, or, xor
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectoryContainsFilter

public DirectoryContainsFilter(Filter<? super EntityView> f,
                               int noOfMatchesThreshold)
                        throws IllegalArgumentException
Create a directory contains filter that matches directories that contain at least noOfMatchesThreshold entities that match the supplied filter f.

Parameters:
f - The filter that the entities in the tested directory should match.
noOfMatchesThreshold - The lowest number of matches required for the tested directory to pass this filter.
Throws:
IllegalArgumentException - If noOfMatchesThreshold < 1.

DirectoryContainsFilter

public DirectoryContainsFilter(Filter<? super EntityView> f)
Create a directory contains filter that matches directories that contain at least one entity that match the supplied filter.

Parameters:
f - The filter that an entity in the tested directory should match.
Method Detail

matches

public boolean matches(EntityView ev)
Description copied from interface: Filter
Does the filter match the object?

Specified by:
matches in interface Filter<EntityView>
Parameters:
ev - The object to match.
Returns:
true if the filter matches the object.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object