public class Roulettewheel
extends java.lang.Object
Libaray simAuxLibrary, Class Roulettewheel
Copyright by Klaus Hufschlag 2004, 2005, 2006
This file is part of the Generic Classifier Library. The Generic Classifier Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Generic Classifier Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the Generic Classifier Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Constructor and Description |
---|
Roulettewheel()
Standardconstructor, creates an empty Instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double value,
java.lang.Object anObject)
add is for adding an Object to the instances List of Objects for choice.
|
java.lang.Object |
choice()
choice performs an roulettewheel-choice with the elements of the
instances list.
|
void |
debug_out()
debug_out Output for debugging purposes.
|
void |
empty_wheel()
removes all entries from Roulettewheel.
|
double |
getWeight(java.lang.Object anObject)
getWeight returns the relative weight / the probability of the object in
the Roulettewheel.
|
java.util.Iterator |
pointers_iterator()
pointers_iterator returns an Iterator of all objects contained in
Roulettewheel
|
void |
remove(java.lang.Object AnObject)
remove removes an object from the instances internal list of objects.
|
double |
sum_values()
sum_values calculates the sum of absolute wheigths of elements contained
in the instances list.
|
public Roulettewheel()
public void add(double value, java.lang.Object anObject)
value
- absolute Weight of the ObjectanObject
- Object to addpublic void remove(java.lang.Object AnObject)
AnObject
- the object to removepublic double sum_values()
public java.lang.Object choice()
public java.util.Iterator pointers_iterator()
public double getWeight(java.lang.Object anObject)
anObject
- Object to get weight forpublic void empty_wheel()
public void debug_out()