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 final class CompositeSamplers.SamplerBuilder.WeightedSampler<S> extends java.lang.ObjectContains 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) SgetSampler()Gets the sampler.(package private) doublegetWeight()Gets the weight.private static doublerequirePositiveFinite(double value, java.lang.String message)Checks that the specified value is positive finite and throws a customizedIllegalArgumentExceptionif 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- ifweightis negative, infinite orNaN.java.lang.NullPointerException- ifsampleris 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 customizedIllegalArgumentExceptionif it is not.- Parameters:
value- the valuemessage- detail message to be used in the event that aIllegalArgumentExceptionis thrown- Returns:
valueif positive finite- Throws:
java.lang.IllegalArgumentException- ifweightis negative, infinite orNaN.
-
-