net.sf.jga.util
Class ComparableComparator<T extends java.lang.Comparable<? super T>>

java.lang.Object
  extended by net.sf.jga.util.ComparableComparator<T>
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<T>

public class ComparableComparator<T extends java.lang.Comparable<? super T>>
extends java.lang.Object
implements java.util.Comparator<T>, java.io.Serializable

Comparator used for objects that extend Comparable. It delegates to the object's Comparable interface of the object whose class is "least" derived; ie, if the first object's class is a subclass of the second object's class, then the second object's comparable interface is used; otherwise the first object's comparable interface is used.

Author:
David A. Hall
See Also:
Serialized Form

Constructor Summary
ComparableComparator()
           
 
Method Summary
 int compare(T x, T y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ComparableComparator

public ComparableComparator()
Method Detail

compare

public int compare(T x,
                   T y)
Specified by:
compare in interface java.util.Comparator<T extends java.lang.Comparable<? super T>>


Copyright © 2002-2006 David A. Hall. All Rights Reserved.