|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.flexgen.util.Chooser<T>
T - The type of the options managed by this class.public class Chooser<T>
Class implementing logic for chosing a single option from among a number of options with different probabilities.
| Constructor Summary | |
|---|---|
Chooser(ImprovedRandom improvedRandom)
Construct this class with the specified random number generator. |
|
| Method Summary | |
|---|---|
void |
addOption(T option,
int weight)
Add an option that can be randomly chosesn. |
T |
choose()
Randomly choose one option from the set of available options. |
boolean |
optionsAvailable()
Determine if any options with any weight have been added. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Chooser(ImprovedRandom improvedRandom)
improvedRandom - The random number generator to use.| Method Detail |
|---|
public void addOption(T option,
int weight)
option - The option that can be randomly chosen.weight - The probability of choosing the option.public T choose()
public boolean optionsAvailable()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright © 2009 - Jeffrey J. Weston <jjweston@gmail.com>
All rights reserved. Use is subject to license terms.