Class VariateBuilder<T>

  • Type Parameters:
    T - the type of the random variate values.

    public final class VariateBuilder<T>
    extends java.lang.Object
    This class implements a probability distribution builder for a T-type random variate.
    • Constructor Summary

      Constructors 
      Constructor Description
      VariateBuilder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addArray​(T[] values)
      Adds the array of values with the default bias.
      void addArray​(T[] values, int bias)
      Adds the array of values with the given bias.
      void addCollection​(java.util.Collection<T> values)
      Adds the collection of values with the default bias.
      void addCollection​(java.util.Collection<T> values, int bias)
      Adds the collection of values with the given bias.
      void addInterval​(T min, T max)
      Adds an interval with the default bias.
      void addInterval​(T min, T max, int bias)
      Adds an interval with the given bias.
      void addValue​(T value)
      Adds the value with the default bias.
      void addValue​(T value, int bias)
      Adds the value with the given bias.
      void addVariate​(Variate<T> variate)
      Adds the random variate with the default bias.
      void addVariate​(Variate<T> variate, int bias)
      Adds the random variate with the given bias.
      Variate<T> build()
      Constructs a random variate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VariateBuilder

        public VariateBuilder()
    • Method Detail

      • addVariate

        public void addVariate​(Variate<T> variate,
                               int bias)
        Adds the random variate with the given bias.
        Parameters:
        variate - the random variate to be added.
        bias - the bias of the random variate.
        Throws:
        java.lang.IllegalArgumentException - if variate == null; if bias <= 0.
      • addVariate

        public void addVariate​(Variate<T> variate)
        Adds the random variate with the default bias.
        Parameters:
        variate - the random variate to be added.
        Throws:
        java.lang.IllegalArgumentException - if variate == null.
      • addValue

        public void addValue​(T value,
                             int bias)
        Adds the value with the given bias.
        Parameters:
        value - the value to be added.
        bias - the bias of the value.
        Throws:
        java.lang.IllegalArgumentException - if bias <= 0.
      • addValue

        public void addValue​(T value)
        Adds the value with the default bias.
        Parameters:
        value - the value to be added.
      • addInterval

        public void addInterval​(T min,
                                T max,
                                int bias)
        Adds an interval with the given bias.
        Parameters:
        min - the lower bound of the interval.
        max - the upper bound of the interval.
        bias - the bias of the interval.
        Throws:
        java.lang.IllegalArgumentException - if min or max is null; if bias <= 0.
      • addInterval

        public void addInterval​(T min,
                                T max)
        Adds an interval with the default bias.
        Parameters:
        min - the lower bound of the interval.
        max - the upper bound of the interval.
      • addArray

        public void addArray​(T[] values,
                             int bias)
        Adds the array of values with the given bias.
        Parameters:
        values - the values to be added.
        bias - the bias of the values.
        Throws:
        java.lang.IllegalArgumentException - if values == null; if bias <= 0.
      • addArray

        public void addArray​(T[] values)
        Adds the array of values with the default bias.
        Parameters:
        values - the values to be added.
        Throws:
        java.lang.IllegalArgumentException - if values == null.
      • addCollection

        public void addCollection​(java.util.Collection<T> values,
                                  int bias)
        Adds the collection of values with the given bias.
        Parameters:
        values - the values to be added.
        bias - the bias of the values.
        Throws:
        java.lang.IllegalArgumentException - if values == null; if bias <= 0.
      • addCollection

        public void addCollection​(java.util.Collection<T> values)
        Adds the collection of values with the default bias.
        Parameters:
        values - the values to be added.
        Throws:
        java.lang.IllegalArgumentException - if values == null.
      • build

        public Variate<T> build()
        Constructs a random variate.
        Returns:
        the constructed random variate.
        Throws:
        java.lang.IllegalArgumentException - if no values have been added.