net.sf.jga.util
Class GenericComparator<T,R extends java.lang.Comparable<R>>

java.lang.Object
  extended by net.sf.jga.util.GenericComparator<T,R>
All Implemented Interfaces:
java.util.Comparator<T>

public class GenericComparator<T,R extends java.lang.Comparable<R>>
extends java.lang.Object
implements java.util.Comparator<T>

Comparator that applies a functor to each argument, then compares the results. The functor must return Comparable values.

Copyright © 2003 David A. Hall

Author:
David A. Hall

Constructor Summary
GenericComparator(UnaryFunctor<T,R> fn)
           
 
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

GenericComparator

public GenericComparator(UnaryFunctor<T,R> fn)
Method Detail

compare

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


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