dutils.digger.comparators
Class Comparator

java.lang.Object
  |
  +--dutils.digger.comparators.Comparator
Direct Known Subclasses:
DefaultComparator, EntriesDefaultComparator, FieldComparator, MethodComparator

public abstract class Comparator
extends java.lang.Object

Comparators hold search data and know to tell if a given File or ZipEntry match the search criteria.

Version:
1.0
Author:
Daniel Or

Field Summary
protected  java.lang.String[] exclude
           
protected  java.lang.String[] toFind
           
protected  StringTransformation[] transformsOnSearchedEntry
           
 
Constructor Summary
Comparator(java.lang.String[] toFind, java.lang.String[] exclude)
          Creates a new Comparator object.
Comparator(java.lang.String[] toFind, java.lang.String[] exclude, StringTransformation[] transOnSearchedEntry)
          Creates a new Comparator object.
 
Method Summary
abstract  boolean compare(java.io.File f)
          Checks if a given file matches search criteria.
abstract  boolean compare(java.io.File f, java.util.zip.ZipFile zFile, java.util.zip.ZipEntry zEntry)
          Checks if a given ZipEntry matches search criteria.
protected  boolean compare(java.lang.String str)
          This method is called by the other compare() methods for String comparisons.
protected  boolean compareStrImpl(java.lang.String s)
          Compares a given String to check if it matches the search criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toFind

protected java.lang.String[] toFind

exclude

protected java.lang.String[] exclude

transformsOnSearchedEntry

protected StringTransformation[] transformsOnSearchedEntry
Constructor Detail

Comparator

public Comparator(java.lang.String[] toFind,
                  java.lang.String[] exclude)
Creates a new Comparator object.

Parameters:
toFind - a String[] with all the strings that must be in a matching entry.
exclude - a String[] with all the strings that must NOT be in a matching entry.

Comparator

public Comparator(java.lang.String[] toFind,
                  java.lang.String[] exclude,
                  StringTransformation[] transOnSearchedEntry)
Creates a new Comparator object.

Parameters:
toFind - a String[] with all the strings that must be in a matching entry.
exclude - a String[] with all the strings that must NOT be in a matching entry.
transOnSearchedEntry - a StringTransformation[] containing all transformations that are to be applied on searched entries.
Method Detail

compare

protected boolean compare(java.lang.String str)
This method is called by the other compare() methods for String comparisons. The method applies the StringTransformation[] on searched entries and then calls compareStrImpl().

Returns:
true if s metches the search criteria.

compareStrImpl

protected boolean compareStrImpl(java.lang.String s)
Compares a given String to check if it matches the search criteria.

Parameters:
s - a String to check.
Returns:
true if s metches the search criteria.

compare

public abstract boolean compare(java.io.File f)
Checks if a given file matches search criteria.

Parameters:
f - a File tom check.
Returns:
true if f metches the search criteria.

compare

public abstract boolean compare(java.io.File f,
                                java.util.zip.ZipFile zFile,
                                java.util.zip.ZipEntry zEntry)
Checks if a given ZipEntry matches search criteria. All parameters are required in order to look into the given ZipEntry.

Parameters:
f - the actual zip File.
zFile - a ZipFile object.
zEntry - a ZipEntry object.
Returns:
true if zEntry metches the search criteria.