net.sourceforge.cilib.util.selection.ordering
Class SortedOrdering<E extends Comparable>

java.lang.Object
  extended by net.sourceforge.cilib.util.selection.ordering.SortedOrdering<E>
Type Parameters:
E - The comparable type.
All Implemented Interfaces:
Ordering<E>

public class SortedOrdering<E extends Comparable>
extends Object
implements Ordering<E>

Apply a sorting operation to the provided list, ordering the list naturally from smallest to largest.

Author:
gpampara

Constructor Summary
SortedOrdering()
          Create an new instance with the default ordering defined to be an ordering that enforces "natural ordering".
SortedOrdering(Comparator<Selection.Entry<E>> comparator)
          Create a new instance with the provided comparator as the comparator to use.
 
Method Summary
 boolean order(List<Selection.Entry<E>> elements)
          Apply the ordering on the provided list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedOrdering

public SortedOrdering()
Create an new instance with the default ordering defined to be an ordering that enforces "natural ordering".


SortedOrdering

public SortedOrdering(Comparator<Selection.Entry<E>> comparator)
Create a new instance with the provided comparator as the comparator to use.

Parameters:
comparator - The comparator to use.
Method Detail

order

public boolean order(List<Selection.Entry<E>> elements)
Apply the ordering on the provided list. Sort the provided list in a natural order, based on the defined Comparator.

Specified by:
order in interface Ordering<E extends Comparable>
Parameters:
elements - The list to be ordered.
Returns:
true if successful, false otherwise.


Copyright © 2009 CIRG. All Rights Reserved.