public class RouletteWheelSelection<E> extends Object implements Enumeration<E>
Enumeration
interface).
Constructor and Description |
---|
RouletteWheelSelection() |
Modifier and Type | Method and Description |
---|---|
void |
add(E adept,
double points)
Add an adept to the selection
|
double |
getRemainingPoints()
Total value of objects that are still in the selection.
|
double |
getTotalPoints()
Total value of objects that were added into the selection.
|
double |
getUsedPoints()
Total value of objects that were already returned by the selection.
|
boolean |
hasMoreElements()
Are there still some adepts that have not been yet selected
|
E |
nextElement()
Perform selection.
|
int |
size()
Number of objects in the set
|
public RouletteWheelSelection()
public void add(E adept, double points)
adept
- an objectpoints
- object weight (more points, better chance to be selected)public boolean hasMoreElements()
hasMoreElements
in interface Enumeration<E>
public E nextElement()
nextElement
in interface Enumeration<E>
public int size()
public double getUsedPoints()
public double getRemainingPoints()
public double getTotalPoints()