Package org.apache.commons.rng.sampling
Class CompositeSamplers.SamplerBuilder.WeightedSampler<S>
- java.lang.Object
-
- org.apache.commons.rng.sampling.CompositeSamplers.SamplerBuilder.WeightedSampler<S>
-
- Type Parameters:
S
- Sampler type
- Enclosing class:
- CompositeSamplers.SamplerBuilder<S>
private static class CompositeSamplers.SamplerBuilder.WeightedSampler<S> extends java.lang.Object
Contains a weighted sampler.
-
-
Constructor Summary
Constructors Constructor Description WeightedSampler(double weight, S sampler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) S
getSampler()
Gets the sampler.(package private) double
getWeight()
Gets the weight.private static double
requirePositiveFinite(double value, java.lang.String message)
Checks that the specified value is positive finite and throws a customizedIllegalArgumentException
if it is not.
-
-
-
Field Detail
-
weight
private final double weight
The weight.
-
sampler
private final S sampler
The sampler.
-
-
Constructor Detail
-
WeightedSampler
WeightedSampler(double weight, S sampler)
- Parameters:
weight
- the weightsampler
- the sampler- Throws:
java.lang.IllegalArgumentException
- ifweight
is negative, infinite orNaN
.java.lang.NullPointerException
- ifsampler
is null.
-
-
Method Detail
-
getWeight
double getWeight()
Gets the weight.- Returns:
- the weight
-
getSampler
S getSampler()
Gets the sampler.- Returns:
- the sampler
-
requirePositiveFinite
private static double requirePositiveFinite(double value, java.lang.String message)
Checks that the specified value is positive finite and throws a customizedIllegalArgumentException
if it is not.- Parameters:
value
- the valuemessage
- detail message to be used in the event that aIllegalArgumentException
is thrown- Returns:
value
if positive finite- Throws:
java.lang.IllegalArgumentException
- ifweight
is negative, infinite orNaN
.
-
-