E - Class of objects that are to be selected from.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
|
void |
addExisting(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 void addExisting(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()