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 Object
Contains a weighted sampler.
  • Field Details

    • weight

      private final double weight
      The weight.
    • sampler

      private final S sampler
      The sampler.
  • Constructor Details

    • WeightedSampler

      WeightedSampler(double weight, S sampler)
      Parameters:
      weight - the weight
      sampler - the sampler
      Throws:
      IllegalArgumentException - if weight is negative, infinite or NaN.
      NullPointerException - if sampler is null.
  • Method Details

    • 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, String message)
      Checks that the specified value is positive finite and throws a customized IllegalArgumentException if it is not.
      Parameters:
      value - the value
      message - detail message to be used in the event that a IllegalArgumentException is thrown
      Returns:
      value if positive finite
      Throws:
      IllegalArgumentException - if weight is negative, infinite or NaN.