net.sourceforge.cilib.entity.comparator
Class DescendingFitnessComparator<E extends Entity>

java.lang.Object
  extended by net.sourceforge.cilib.entity.comparator.DescendingFitnessComparator<E>
Type Parameters:
E - The Entity type.
All Implemented Interfaces:
Comparator<E>

public class DescendingFitnessComparator<E extends Entity>
extends Object
implements Comparator<E>

Comparator to order Entity instances based on fitness values. This comparator results in a descending order. This ordering is effectively an ordering from the "most fit" entity to the "least fit" entity.

Author:
Gary Pampara

Constructor Summary
DescendingFitnessComparator()
           
 
Method Summary
 int compare(E e1, E e2)
          Compare the Entity objects returning the desired ordering.
 
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

DescendingFitnessComparator

public DescendingFitnessComparator()
Method Detail

compare

public int compare(E e1,
                   E e2)
Compare the Entity objects returning the desired ordering.

Specified by:
compare in interface Comparator<E extends Entity>
Parameters:
e1 - The first Entity to be used in the comparison.
e2 - The second Entity to be used in the comparison.
Returns:
-1 if e1 is less than e2; 0 if e1 and e2 are equal 1 if e2 is greater than e2


Copyright © 2009 CIRG. All Rights Reserved.