org.entityfs.util.filter.regexp
Class EntityLocationRegexpFilter

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

public class EntityLocationRegexpFilter
extends AbstractConvenientFilter<EntityView>
implements EntityFilter

This is a filter that matches an entity's location relative to a base directory against regular expression Pattern:s.

Since:
1.0
Author:
Karl Gustafsson

Constructor Summary
EntityLocationRegexpFilter(DirectoryView baseDir, String pattern)
          Create a location regular expression filter that will compare locations relative to the given base directory.
EntityLocationRegexpFilter(DirectoryView baseDir, String pattern, boolean caseSensitive)
          Create a location regular expression filter that will compare locations relative to the given base directory.
EntityLocationRegexpFilter(DirectoryView baseDir, String pattern, int flags)
          Create a location regular expression filter that will compare locations relative to the given base directory.
 
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

EntityLocationRegexpFilter

public EntityLocationRegexpFilter(DirectoryView baseDir,
                                  String pattern)
                           throws PatternSyntaxException
Create a location regular expression filter that will compare locations relative to the given base directory. The filter is case sensitive.

Parameters:
baseDir - The base directory
pattern - The regular expression pattern. Patterns for the different path segments are separated with slashes.
Throws:
PatternSyntaxException - On syntax errors in the regular expression patterns.

EntityLocationRegexpFilter

public EntityLocationRegexpFilter(DirectoryView baseDir,
                                  String pattern,
                                  boolean caseSensitive)
                           throws PatternSyntaxException
Create a location regular expression filter that will compare locations relative to the given base directory.

Parameters:
baseDir - The base directory
pattern - The regular expression pattern. Patterns for the different path segments are separated with slashes.
caseSensitive - Should the filter be case sensitive?
Throws:
PatternSyntaxException - On syntax errors in the regular expression patterns.

EntityLocationRegexpFilter

public EntityLocationRegexpFilter(DirectoryView baseDir,
                                  String pattern,
                                  int flags)
                           throws PatternSyntaxException
Create a location regular expression filter that will compare locations relative to the given base directory.

Parameters:
baseDir - The base directory
pattern - The regular expression pattern. Patterns for the different path segments are separated with slashes.
flags - Flags to Pattern.compile.
Throws:
PatternSyntaxException - On syntax errors in the regular expression patterns.
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