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>
Contains a weighted sampler.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) SGets the sampler.(package private) doubleGets the weight.private static doublerequirePositiveFinite(double value, String message) Checks that the specified value is positive finite and throws a customizedIllegalArgumentExceptionif it is not.
-
Field Details
-
weight
private final double weightThe weight. -
sampler
The sampler.
-
-
Constructor Details
-
WeightedSampler
WeightedSampler(double weight, S sampler) - Parameters:
weight- the weightsampler- the sampler- Throws:
IllegalArgumentException- ifweightis negative, infinite orNaN.NullPointerException- ifsampleris null.
-
-
Method Details
-
getWeight
double getWeight()Gets the weight.- Returns:
- the weight
-
getSampler
S getSampler()Gets the sampler.- Returns:
- the sampler
-
requirePositiveFinite
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:
IllegalArgumentException- ifweightis negative, infinite orNaN.
-