ewe.database
Class EntryComparer

java.lang.Object
  extended byewe.database.EntryComparer
All Implemented Interfaces:
Comparer, DatabaseEntryComparer
Direct Known Subclasses:
StandardEntryComparer

public abstract class EntryComparer
extends Object
implements DatabaseEntryComparer


Field Summary
protected  boolean compareAsDatabaseEntries
          If this is set true, then when compareEntries() is called the two objects will be of type DatabaseEntries.
protected  Database db
           
 
Constructor Summary
protected EntryComparer()
           
  EntryComparer(Database db)
           
 
Method Summary
 int compare(Object one, Object two)
          This should compare the two objects and return: 0 = the objects are equal.
protected abstract  int compareEntries(Object one, Object two)
          Override this to compare to entries.
 void setDatabase(Database db)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, toString
 

Field Detail

db

protected Database db

compareAsDatabaseEntries

protected boolean compareAsDatabaseEntries
If this is set true, then when compareEntries() is called the two objects will be of type DatabaseEntries. If it is false then the entries will be converted to the Database's data object. This is false by default.

Constructor Detail

EntryComparer

protected EntryComparer()

EntryComparer

public EntryComparer(Database db)
              throws IllegalArgumentException
Method Detail

compare

public final int compare(Object one,
                         Object two)
Description copied from interface: Comparer
This should compare the two objects and return: 0 = the objects are equal. greater than 0 = one is greater than two. less than 0 = two is greater than one.

Specified by:
compare in interface Comparer

compareEntries

protected abstract int compareEntries(Object one,
                                      Object two)
Override this to compare to entries. If you are doing a findFirst() or findLast() or a search(), then the first argument will always be the searchData that you provided.


setDatabase

public void setDatabase(Database db)
Specified by:
setDatabase in interface DatabaseEntryComparer