com.martiansoftware.trivialpersist
Class SeriesComparator

java.lang.Object
  extended bycom.martiansoftware.trivialpersist.SeriesComparator
All Implemented Interfaces:
Comparator

public class SeriesComparator
extends Object
implements Comparator

Provides a means to wrap multiple Comparators into a single Comparator. When comparing, each wrapped Comparator is used to perform a comparison in the order in which it was added to the SeriesComparator, until one of the wrapped Comparators returns a nonzero value. If all comparators return zero, the Objects' hashcodes are compared.

Author:
Marty Lamb

Constructor Summary
SeriesComparator()
          Creates a new, empty SeriesComparator that compares hashcodes by default.
 
Method Summary
 SeriesComparator add(Comparator comparator)
          Adds a Comparator to this SeriesComparator.
 int compare(Object o1, Object o2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

SeriesComparator

public SeriesComparator()
Creates a new, empty SeriesComparator that compares hashcodes by default.

Method Detail

add

public SeriesComparator add(Comparator comparator)
Adds a Comparator to this SeriesComparator.

Parameters:
comparator - the Comparator to add
Returns:
a reference to this SeriesComparator

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator
See Also:
RecordFilter.include(Record)


Copyright © 2004, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/trivialpersist