net.sourceforge.cilib.util.selection.recipes
Class RandomSelection<E>

java.lang.Object
  extended by net.sourceforge.cilib.util.selection.recipes.RandomSelection<E>
Type Parameters:
E -
All Implemented Interfaces:
Serializable, Cloneable, SelectionRecipe<E>

public class RandomSelection<E>
extends Object
implements SelectionRecipe<E>

Perform a random selection from the provided list of elements.

Random selection is performed by:

  1. A random element is selected from the provided list.
  2. Return the result.

Author:
Wiehann Matthysen
See Also:
Serialized Form

Constructor Summary
RandomSelection()
          Create a new instance.
RandomSelection(Random random)
          Create a new instance with the provided Random.
RandomSelection(RandomSelection copy)
          Create a copy of the provided instance.
 
Method Summary
 RandomSelection getClone()
          Create a cloned copy of the current object and return it.
 E select(List<? extends E> elements)
          Perform the selection process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomSelection

public RandomSelection()
Create a new instance.


RandomSelection

public RandomSelection(Random random)
Create a new instance with the provided Random.

Parameters:
random - The random to use.

RandomSelection

public RandomSelection(RandomSelection copy)
Create a copy of the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

getClone

public RandomSelection getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Cloneable
Specified by:
getClone in interface SelectionRecipe<E>
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

select

public E select(List<? extends E> elements)
Perform the selection process.

Specified by:
select in interface SelectionRecipe<E>
Parameters:
elements - The elements to perfrom the selection on.
Returns:
The selected element.


Copyright © 2009 CIRG. All Rights Reserved.