net.sourceforge.cilib.util.selection.ordering
Class RandomOrdering<E>

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

public class RandomOrdering<E>
extends Object
implements Ordering<E>

Apply a random ordering to the provided list. This class defines that the list instance will have it's internal order randomly shuffled.

Author:
gpampara

Constructor Summary
RandomOrdering()
          Create a new instance.
RandomOrdering(Random generator)
          Create an instance with the provided Random as the generator class 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

RandomOrdering

public RandomOrdering()
Create a new instance. A MersenneTwister will be set as the predefined generator instance.


RandomOrdering

public RandomOrdering(Random generator)
Create an instance with the provided Random as the generator class to use.

Parameters:
generator - The random to use.
Method Detail

order

public boolean order(List<Selection.Entry<E>> elements)
Apply the ordering on the provided list. This ordering will be a random shuffle.

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


Copyright © 2009 CIRG. All Rights Reserved.