|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectp3j.misc.math.RandomNumberChecks
public final class RandomNumberChecks
Class to hold static functions for checking random numbers regarding their mathematical validity, and some non-static functions for selecting an object randomly. Singleton pattern. Created on January 21, 2007
Method Summary | ||
---|---|---|
|
checkProbabilitySetting(String name,
Collection<V> objects,
List<GeneratorError> errors)
Tries to repeat values before throwing an exceptions. |
|
|
chooseNormalizedRandomObject(Collection<V> objects,
james.core.math.random.generators.IRandom rand)
Choose random object if the sum of all probabilities is 100. |
|
|
chooseRandomObject(Collection<V> objects,
james.core.math.random.generators.IRandom rand)
Choose random object if the sum of all probabilities is 100. |
|
protected
|
chooseRandomObject(Collection<V> objects,
james.core.math.random.generators.IRandom rand,
double overallProbSum)
Choose random entity based on a certain probability sum. |
|
static RandomNumberChecks |
getInstance()
Gets the single instance of RandomNumberChecks. |
|
double |
getProbSum(Collection<? extends IStochasticOccurrence> objects)
Get the probability sum from a list of of IStochasticOccurrence
instances. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static RandomNumberChecks getInstance()
public <V extends IStochasticOccurrence> void checkProbabilitySetting(String name, Collection<V> objects, List<GeneratorError> errors)
V
- type of entity that shall be chosen by chancename
- name of the objects to be checked (for generation of a suitable
error messages)objects
- the collection of objects to be checkederrors
- list of error messages (to be filled if something goes wrong)public <V extends IStochasticOccurrence> V chooseNormalizedRandomObject(Collection<V> objects, james.core.math.random.generators.IRandom rand)
V
- type of randomly chosen entityobjects
- collection of objects from which to chooserand
- randomiser to be used
public <V extends IStochasticOccurrence> V chooseRandomObject(Collection<V> objects, james.core.math.random.generators.IRandom rand)
V
- type of randomly chosen entityobjects
- collection of objects from which to chooserand
- the randomiser to be used
protected <V extends IStochasticOccurrence> V chooseRandomObject(Collection<V> objects, james.core.math.random.generators.IRandom rand, double overallProbSum)
V
- type of randomly chosen entityobjects
- collection of objects from which to chooserand
- the randomiser to be usedoverallProbSum
- overall probability sum
public double getProbSum(Collection<? extends IStochasticOccurrence> objects)
IStochasticOccurrence
instances.
objects
- collection of objects from which to choose
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |