Package ru.ispras.fortress.randomizer
Class VariateBuilder<T>
- java.lang.Object
-
- ru.ispras.fortress.randomizer.VariateBuilder<T>
-
- Type Parameters:
T
- the type of the random variate values.
public final class VariateBuilder<T> extends java.lang.Object
This class implements a probability distribution builder for aT
-type random variate.
-
-
Constructor Summary
Constructors Constructor Description VariateBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArray(T[] values)
Adds the array of values with the default bias.void
addArray(T[] values, int bias)
Adds the array of values with the given bias.void
addCollection(java.util.Collection<T> values)
Adds the collection of values with the default bias.void
addCollection(java.util.Collection<T> values, int bias)
Adds the collection of values with the given bias.void
addInterval(T min, T max)
Adds an interval with the default bias.void
addInterval(T min, T max, int bias)
Adds an interval with the given bias.void
addValue(T value)
Adds the value with the default bias.void
addValue(T value, int bias)
Adds the value with the given bias.void
addVariate(Variate<T> variate)
Adds the random variate with the default bias.void
addVariate(Variate<T> variate, int bias)
Adds the random variate with the given bias.Variate<T>
build()
Constructs a random variate.
-
-
-
Method Detail
-
addVariate
public void addVariate(Variate<T> variate, int bias)
Adds the random variate with the given bias.- Parameters:
variate
- the random variate to be added.bias
- the bias of the random variate.- Throws:
java.lang.IllegalArgumentException
- ifvariate == null
; ifbias <= 0
.
-
addVariate
public void addVariate(Variate<T> variate)
Adds the random variate with the default bias.- Parameters:
variate
- the random variate to be added.- Throws:
java.lang.IllegalArgumentException
- ifvariate == null
.
-
addValue
public void addValue(T value, int bias)
Adds the value with the given bias.- Parameters:
value
- the value to be added.bias
- the bias of the value.- Throws:
java.lang.IllegalArgumentException
- ifbias <= 0
.
-
addValue
public void addValue(T value)
Adds the value with the default bias.- Parameters:
value
- the value to be added.
-
addInterval
public void addInterval(T min, T max, int bias)
Adds an interval with the given bias.- Parameters:
min
- the lower bound of the interval.max
- the upper bound of the interval.bias
- the bias of the interval.- Throws:
java.lang.IllegalArgumentException
- ifmin
ormax
isnull
; ifbias <= 0
.
-
addInterval
public void addInterval(T min, T max)
Adds an interval with the default bias.- Parameters:
min
- the lower bound of the interval.max
- the upper bound of the interval.
-
addArray
public void addArray(T[] values, int bias)
Adds the array of values with the given bias.- Parameters:
values
- the values to be added.bias
- the bias of the values.- Throws:
java.lang.IllegalArgumentException
- ifvalues == null
; ifbias <= 0
.
-
addArray
public void addArray(T[] values)
Adds the array of values with the default bias.- Parameters:
values
- the values to be added.- Throws:
java.lang.IllegalArgumentException
- ifvalues == null
.
-
addCollection
public void addCollection(java.util.Collection<T> values, int bias)
Adds the collection of values with the given bias.- Parameters:
values
- the values to be added.bias
- the bias of the values.- Throws:
java.lang.IllegalArgumentException
- ifvalues == null
; ifbias <= 0
.
-
addCollection
public void addCollection(java.util.Collection<T> values)
Adds the collection of values with the default bias.- Parameters:
values
- the values to be added.- Throws:
java.lang.IllegalArgumentException
- ifvalues == null
.
-
-