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

      Fields 
      Modifier and Type Field Description
      private S sampler
      The sampler.
      private double weight
      The weight.
    • 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 customized IllegalArgumentException if it is not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 weight
        sampler - the sampler
        Throws:
        java.lang.IllegalArgumentException - if weight is negative, infinite or NaN.
        java.lang.NullPointerException - if sampler 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 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:
        java.lang.IllegalArgumentException - if weight is negative, infinite or NaN.