Class Generators


  • public final class Generators
    extends java.lang.Object
    A collection of built-in generators
    • Method Detail

      • constant

        public static <A> Generator<A> constant​(A a)
        Creates a Generator that yields the same value whenever invoked.
        Type Parameters:
        A - the type of the value
        Parameters:
        a - the value to return when the Generator is invoked
        Returns:
        a Generator<A>
      • generateBoolean

        public static Generator<java.lang.Boolean> generateBoolean()
        Creates a Generator that yields Boolean values.
        Returns:
        a Generator<Boolean>
      • generateBoolean

        public static Generator<java.lang.Boolean> generateBoolean​(BooleanWeights weights)
        Creates a Generator that yields Boolean values, with custom probabilities for true and false values.
        Parameters:
        weights - the probabilities for returning true vs. false values
        Returns:
        a Generator<Boolean>
      • generateInt

        public static Generator<java.lang.Integer> generateInt()
        Creates a Generator that yields Integers within the full range of Integers (between Integer.MIN_VALUE and Integer.MAX_VALUE, inclusive).
        Returns:
        a Generator<Integer>
      • generateInt

        public static Generator<java.lang.Integer> generateInt​(IntRange range)
        Creates a Generator that yields Integers within a specific range.
        Parameters:
        range - the IntRange of values to generate
        Returns:
        a Generator<Integer>
      • generateIntIndex

        public static Generator<java.lang.Integer> generateIntIndex​(int bound)
        Creates a Generator that yields Integers that are intended to be used as indices (e.g. into arrays or collections). Values returned range from 0..bound (exclusive). Ignores any bias settings.
        Parameters:
        bound - the maximum value (exclusive)
        Returns:
        a Generator<Integer>
      • generateLong

        public static Generator<java.lang.Long> generateLong()
        Creates a Generator that yields Longs within the full range of Longs (between Long.MIN_VALUE and Long.MAX_VALUE, inclusive).
        Returns:
        a Generator<Long>
      • generateLong

        public static Generator<java.lang.Long> generateLong​(LongRange range)
        Creates a Generator that yields Longs within a specific range.
        Parameters:
        range - the LongRange of values to generate
        Returns:
        a Generator<Long>
      • generateLongIndex

        public static Generator<java.lang.Long> generateLongIndex​(long bound)
        Creates a Generator that yields Longs that are intended to be used as indices (e.g. into arrays or collections). Values returned range from 0..bound (exclusive). Ignores any bias settings.
        Parameters:
        bound - the maximum value (exclusive)
        Returns:
        a Generator<Long>
      • generateByte

        public static Generator<java.lang.Byte> generateByte()
        Creates a Generator that yields Bytes within the full range of Bytes (between -128 and 127, inclusive).
        Returns:
        a Generator<Byte>
      • generateByte

        public static Generator<java.lang.Byte> generateByte​(ByteRange range)
        Creates a Generator that yields Bytes within a specific range.
        Parameters:
        range - the ByteRange of values to generate
        Returns:
        a Generator<Byte>
      • generateShort

        public static Generator<java.lang.Short> generateShort()
        Creates a Generator that yields Shorts within the full range of Shorts (between -32768 and 32767, inclusive).
        Returns:
        a Generator<Short>
      • generateShort

        public static Generator<java.lang.Short> generateShort​(ShortRange range)
        Creates a Generator that yields Shorts within a specific range.
        Parameters:
        range - the ShortRange of values to generate
        Returns:
        a Generator<Short>
      • generateChar

        public static Generator<java.lang.Character> generateChar()
        Creates a Generator that yields Characters within the full range of Characters (between Character.MIN_VALUE and Character.MAX_VALUE, inclusive).
        Returns:
        a Generator<Character>
      • generateChar

        public static Generator<java.lang.Character> generateChar​(CharRange range)
        Creates a Generator that yields Characters within a specific range.
        Parameters:
        range - the CharRange of values to generate
        Returns:
        a Generator<Character>
      • generateAlphaChar

        public static Generator<java.lang.Character> generateAlphaChar()
        Creates a Generator that yields ASCII alphabetic Characters (A-Z, a-z).
        Returns:
        a Generator<Character>
      • generateAlphaUpperChar

        public static Generator<java.lang.Character> generateAlphaUpperChar()
        Creates a Generator that yields ASCII uppercase alphabetic Characters (A-Z).
        Returns:
        a Generator<Character>
      • generateAlphaLowerChar

        public static Generator<java.lang.Character> generateAlphaLowerChar()
        Creates a Generator that yields ASCII lowercase alphabetic Characters (a-z).
        Returns:
        a Generator<Character>
      • generateAlphanumericChar

        public static Generator<java.lang.Character> generateAlphanumericChar()
        Creates a Generator that yields ASCII alphanumeric Characters (A-Z, a-z, 0-9).
        Returns:
        a Generator<Character>
      • generateNumericChar

        public static Generator<java.lang.Character> generateNumericChar()
        Creates a Generator that yields ASCII numeric Characters (0-9).
        Returns:
        a Generator<Character>
      • generatePunctuationChar

        public static Generator<java.lang.Character> generatePunctuationChar()
        Creates a Generator that yields ASCII punctuation Characters. This include any ASCII character that is not a letter, digit, space, or control character.
        Returns:
        a Generator<Character>
      • generateAsciiPrintableChar

        public static Generator<java.lang.Character> generateAsciiPrintableChar()
        Creates a Generator that yields ASCII printable Characters. This include any ASCII character that is not a control character.
        Returns:
        a Generator<Character>
      • generateControlChar

        public static Generator<java.lang.Character> generateControlChar()
        Creates a Generator that yields ASCII control Characters. A control character is any character from ASCII code 0-31.
        Returns:
        a Generator<Character>
      • generateGaussian

        public static Generator<java.lang.Double> generateGaussian()
        Creates a Generator that yields Doubles, which, when accumulated, will result in normal distribution.
        Returns:
        a Generator<Double>
      • generateByteArray

        public static Generator<java.lang.Byte[]> generateByteArray()
        Creates a Generator that yields Byte arrays of varying sizes.
        Returns:
        a Generator<Byte[]>
      • generateByteArray

        public static Generator<java.lang.Byte[]> generateByteArray​(int size)
        Creates a Generator that yields Byte arrays of varying sizes.
        Parameters:
        size - the size of the arrays returned; must be >= 0
        Returns:
        a Generator<Byte[]>
      • generateBoxedPrimitive

        public static Generator<java.lang.Object> generateBoxedPrimitive()
        Creates a Generator that yields boxed primitives. When invoked, will return one of the following types: Integer, Long, Short, Byte, Double, Float, Boolean, or Character.
        Returns:
        a Generator<Object>
      • generateSize

        public static Generator<java.lang.Integer> generateSize()
        Creates a Generator that yields sizes, generally used to determine sizes of collections. Respects the size settings in the GeneratorParameters used to configure the generator.
        Returns:
        a Generator<Integer>
      • generateSize

        public static Generator<java.lang.Integer> generateSize​(IntRange sizeRange)
        Creates a Generator that yields sizes within a specific range, generally used to determine sizes of collections. Overrides the GeneratorParameters's size parameters used to configure the generator, but will respect a preferred size if it can.
        Returns:
        a Generator<Integer>
      • sized

        public static <A> Generator<A> sized​(com.jnape.palatable.lambda.functions.Fn1<java.lang.Integer,​Generator<A>> fn)
        Creates a Generator that dynamically creates another Generator depending on a randomly generated size value. Respects the size settings in the GeneratorParameters used to configure the generator.
        Type Parameters:
        A - the type of value to generate
        Parameters:
        fn - a function that takes a size (an Integer >= 0) and returns a Generator
        Returns:
        a Generator<A>
      • sizedMinimum

        public static <A> Generator<A> sizedMinimum​(int minimum,
                                                    com.jnape.palatable.lambda.functions.Fn1<java.lang.Integer,​Generator<A>> fn)
        Creates a Generator that dynamically creates another Generator depending on a randomly generated size value. Respects the size settings in the GeneratorParameters used to configure the generator, but the size will always be minimum or greater.
        Type Parameters:
        A - the type of value to generate
        Parameters:
        minimum - the minimum size to generate
        fn - a function that takes a size (an Integer >= minimum) and returns a Generator
        Returns:
        a Generator<A>
      • aggregate

        public static <A,​Builder,​Out> Generator<Out> aggregate​(Aggregator<A,​Builder,​Out> aggregator,
                                                                           java.lang.Iterable<Generator<A>> elements)
        Creates a Generator that aggregates elements generated from a collection of Generators.
        Type Parameters:
        A - the input type of aggregator
        Builder - the builder type of aggregator
        Out - the output type of aggregator
        Parameters:
        aggregator - an Aggregator used to aggregate a group of generated elements
        elements - an Iterable contain zero of more Generator<A>s
        Returns:
        a Generator<Out>
      • aggregate

        public static <A,​Builder,​Out> Generator<Out> aggregate​(Aggregator<A,​Builder,​Out> aggregator,
                                                                           int size,
                                                                           Generator<A> gen)
        Creates a Generator that, on each invocation, yields a value that is derived by invoking an element Generator a specific number of times, and feeding these elements to an Aggregator.
        Type Parameters:
        A - the input type of aggregator
        Builder - the builder type of aggregator
        Out - the output type of aggregator
        Parameters:
        aggregator - an Aggregator used to aggregate a group of generated elements
        size - the number of input elements that aggregator will be supplied to create one output. Must be >= 0.
        gen - the Generator that generates elements
        Returns:
        a Generator<Out>
      • aggregate

        public static <A,​Builder,​Out> Generator<Out> aggregate​(Aggregator<A,​Builder,​Out> aggregator,
                                                                           IntRange sizeRange,
                                                                           Generator<A> gen)
        Creates a Generator that, on each invocation, yields a value that is derived by invoking an element Generator a random number of times (within a specific range), and feeding these elements to an Aggregator.
        Type Parameters:
        A - the input type of aggregator
        Builder - the builder type of aggregator
        Out - the output type of aggregator
        Parameters:
        aggregator - an Aggregator used to aggregate a group of generated elements
        sizeRange - a range of the number of input elements that aggregator will be supplied to create one output. Lower end of range must be >= 0.
        gen - the Generator that yields elements
        Returns:
        a Generator<Out>
      • generateCollection

        public static <A,​C extends java.util.Collection<A>> Generator<C> generateCollection​(com.jnape.palatable.lambda.functions.Fn0<C> constructCollection,
                                                                                                  java.lang.Iterable<Generator<A>> elements)
        Creates a Generator that yields Collections of type C by invoking a collection of element Generators in sequence, and then aggregating the results.

        The size of the generated Collections will always equal the size of elements.

        Type Parameters:
        A - the element type of the desired collection
        C - the collection type. Instances of C must support Collection.add(E) (which is to say, must not throw on invocation).
        Parameters:
        constructCollection - the constructor for the desired type of collection (e.g. ArrayList::new)
        elements - an Iterable containing Generator<A>s. Each Generator will correspond with a single output in the final result.
        Returns:
        a Generator<C>
      • generateCollection

        public static <A,​C extends java.util.Collection<A>> Generator<C> generateCollection​(com.jnape.palatable.lambda.functions.Fn0<C> constructCollection,
                                                                                                  int size,
                                                                                                  Generator<A> elements)
        Creates a Generator that yields Collections of type C by invoking an element Generators a specific number of times, and then aggregating the results.

        The size of the generated Collections will always equal size.

        Type Parameters:
        A - the element type of the desired collection
        C - the collection type. Instances of C must support Collection.add(E) (which is to say, must not throw on invocation).
        Parameters:
        constructCollection - the constructor for the desired type of collection (e.g. ArrayList::new)
        size - the size of the output collection. Must be >= 0.
        elements - the element Generator
        Returns:
        a Generator<C>
      • generateCollection

        public static <A,​C extends java.util.Collection<A>> Generator<C> generateCollection​(com.jnape.palatable.lambda.functions.Fn0<C> constructCollection,
                                                                                                  IntRange sizeRange,
                                                                                                  Generator<A> elements)
        Creates a Generator that yields Collections of type C by invoking an element Generators a random number of times (within a specific range), and then aggregating the results.

        The size of the generated Collections will always fall within sizeRange.

        Type Parameters:
        A - the element type of the desired collection
        C - the collection type. Instances of C must support Collection.add(E) (which is to say, must not throw on invocation).
        Parameters:
        constructCollection - the constructor for the desired type of collection (e.g. ArrayList::new)
        sizeRange - the IntRange of sizes for the generated collections. Lower end of range must be >= 0.
        elements - the element Generator
        Returns:
        a Generator<C>
      • generateProduct

        public static <A,​B,​Out> Generator<Out> generateProduct​(Generator<A> a,
                                                                           Generator<B> b,
                                                                           com.jnape.palatable.lambda.functions.Fn2<A,​B,​Out> combine)
        Creates a Generator that is a product of two other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        Out - the type of the values to be ultimately yielded by the result Generator (i.e, the return type of the combine function)
        Parameters:
        a - the first component generator
        b - the second component generator
        combine - a function to combine the results from the component generators
        Returns:
        a Generator<Out>
        See Also:
        generateTuple(Generator, Generator)
      • generateProduct

        public static <A,​B,​C,​Out> Generator<Out> generateProduct​(Generator<A> a,
                                                                                   Generator<B> b,
                                                                                   Generator<C> c,
                                                                                   com.jnape.palatable.lambda.functions.Fn3<A,​B,​C,​Out> combine)
        Creates a Generator that is a product of three other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        Out - the type of the values to be ultimately yielded by the result Generator (i.e, the return type of the combine function)
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        combine - a function to combine the results from the component generators
        Returns:
        a Generator<Out>
        See Also:
        generateTuple(Generator, Generator, Generator)
      • generateProduct

        public static <A,​B,​C,​D,​Out> Generator<Out> generateProduct​(Generator<A> a,
                                                                                           Generator<B> b,
                                                                                           Generator<C> c,
                                                                                           Generator<D> d,
                                                                                           com.jnape.palatable.lambda.functions.Fn4<A,​B,​C,​D,​Out> combine)
        Creates a Generator that is a product of four other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        Out - the type of the values to be ultimately yielded by the result Generator (i.e, the return type of the combine function)
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        combine - a function to combine the results from the component generators
        Returns:
        a Generator<Out>
        See Also:
        generateTuple(Generator, Generator, Generator, Generator)
      • generateProduct

        public static <A,​B,​C,​D,​E,​Out> Generator<Out> generateProduct​(Generator<A> a,
                                                                                                   Generator<B> b,
                                                                                                   Generator<C> c,
                                                                                                   Generator<D> d,
                                                                                                   Generator<E> e,
                                                                                                   com.jnape.palatable.lambda.functions.Fn5<A,​B,​C,​D,​E,​Out> combine)
        Creates a Generator that is a product of five other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        Out - the type of the values to be ultimately yielded by the result Generator (i.e, the return type of the combine function)
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        combine - a function to combine the results from the component generators
        Returns:
        a Generator<Out>
        See Also:
        generateTuple(Generator, Generator, Generator, Generator, Generator)
      • generateProduct

        public static <A,​B,​C,​D,​E,​F,​Out> Generator<Out> generateProduct​(Generator<A> a,
                                                                                                           Generator<B> b,
                                                                                                           Generator<C> c,
                                                                                                           Generator<D> d,
                                                                                                           Generator<E> e,
                                                                                                           Generator<F> f,
                                                                                                           com.jnape.palatable.lambda.functions.Fn6<A,​B,​C,​D,​E,​F,​Out> combine)
        Creates a Generator that is a product of six other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        F - the type of the values generated by the sixth component generator
        Out - the type of the values to be ultimately yielded by the result Generator (i.e, the return type of the combine function)
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        f - the sixth component generator
        combine - a function to combine the results from the component generators
        Returns:
        a Generator<Out>
        See Also:
        generateTuple(Generator, Generator, Generator, Generator, Generator, Generator)
      • generateProduct

        public static <A,​B,​C,​D,​E,​F,​G,​Out> Generator<Out> generateProduct​(Generator<A> a,
                                                                                                                   Generator<B> b,
                                                                                                                   Generator<C> c,
                                                                                                                   Generator<D> d,
                                                                                                                   Generator<E> e,
                                                                                                                   Generator<F> f,
                                                                                                                   Generator<G> g,
                                                                                                                   com.jnape.palatable.lambda.functions.Fn7<A,​B,​C,​D,​E,​F,​G,​Out> combine)
        Creates a Generator that is a product of seven other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        F - the type of the values generated by the sixth component generator
        G - the type of the values generated by the seventh component generator
        Out - the type of the values to be ultimately yielded by the result Generator (i.e, the return type of the combine function)
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        f - the sixth component generator
        g - the seventh component generator
        combine - a function to combine the results from the component generators
        Returns:
        a Generator<Out>
        See Also:
        generateTuple(Generator, Generator, Generator, Generator, Generator, Generator, Generator)
      • generateProduct

        public static <A,​B,​C,​D,​E,​F,​G,​H,​Out> Generator<Out> generateProduct​(Generator<A> a,
                                                                                                                           Generator<B> b,
                                                                                                                           Generator<C> c,
                                                                                                                           Generator<D> d,
                                                                                                                           Generator<E> e,
                                                                                                                           Generator<F> f,
                                                                                                                           Generator<G> g,
                                                                                                                           Generator<H> h,
                                                                                                                           com.jnape.palatable.lambda.functions.Fn8<A,​B,​C,​D,​E,​F,​G,​H,​Out> combine)
        Creates a Generator that is a product of eight other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        F - the type of the values generated by the sixth component generator
        G - the type of the values generated by the seventh component generator
        H - the type of the values generated by the eighth component generator
        Out - the type of the values to be ultimately yielded by the result Generator (i.e, the return type of the combine function)
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        f - the sixth component generator
        g - the seventh component generator
        h - the eighth component generator
        combine - a function to combine the results from the component generators
        Returns:
        a Generator<Out>
        See Also:
        generateTuple(Generator, Generator, Generator, Generator, Generator, Generator, Generator, Generator)
      • generateTuple

        public static <A,​B> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple2<A,​B>> generateTuple​(Generator<A> a,
                                                                                                                  Generator<B> b)
        Creates a Generator that yields Tuple2s by combining the outputs of two other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        Parameters:
        a - the first component generator
        b - the second component generator
        Returns:
        a Generator<Tuple2<A, B>
        See Also:
        generateProduct(Generator, Generator, Fn2)
      • generateTuple

        public static <A,​B,​C> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple3<A,​B,​C>> generateTuple​(Generator<A> a,
                                                                                                                                  Generator<B> b,
                                                                                                                                  Generator<C> c)
        Creates a Generator that yields Tuple3s by combining the outputs of three other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        Returns:
        a Generator<Tuple3<A, B, C>
        See Also:
        generateProduct(Generator, Generator, Generator, Fn3)
      • generateTuple

        public static <A,​B,​C,​D> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple4<A,​B,​C,​D>> generateTuple​(Generator<A> a,
                                                                                                                                                  Generator<B> b,
                                                                                                                                                  Generator<C> c,
                                                                                                                                                  Generator<D> d)
        Creates a Generator that yields Tuple4s by combining the outputs of four other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        Returns:
        a Generator<Tuple4<A, B, C, D>
        See Also:
        generateProduct(Generator, Generator, Generator, Generator, Fn4)
      • generateTuple

        public static <A,​B,​C,​D,​E> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple5<A,​B,​C,​D,​E>> generateTuple​(Generator<A> a,
                                                                                                                                                                  Generator<B> b,
                                                                                                                                                                  Generator<C> c,
                                                                                                                                                                  Generator<D> d,
                                                                                                                                                                  Generator<E> e)
        Creates a Generator that yields Tuple5s by combining the outputs of five other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        Returns:
        a Generator<Tuple5<A, B, C, D, E>
        See Also:
        generateProduct(Generator, Generator, Generator, Generator, Generator, Fn5)
      • generateTuple

        public static <A,​B,​C,​D,​E,​F> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple6<A,​B,​C,​D,​E,​F>> generateTuple​(Generator<A> a,
                                                                                                                                                                                  Generator<B> b,
                                                                                                                                                                                  Generator<C> c,
                                                                                                                                                                                  Generator<D> d,
                                                                                                                                                                                  Generator<E> e,
                                                                                                                                                                                  Generator<F> f)
        Creates a Generator that yields Tuple6s by combining the outputs of six other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        F - the type of the values generated by the sixth component generator
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        f - the sixth component generator
        Returns:
        a Generator<Tuple6<A, B, C, D, E, F>
        See Also:
        generateProduct(Generator, Generator, Generator, Generator, Generator, Generator, Fn6)
      • generateTuple

        public static <A,​B,​C,​D,​E,​F,​G> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple7<A,​B,​C,​D,​E,​F,​G>> generateTuple​(Generator<A> a,
                                                                                                                                                                                                  Generator<B> b,
                                                                                                                                                                                                  Generator<C> c,
                                                                                                                                                                                                  Generator<D> d,
                                                                                                                                                                                                  Generator<E> e,
                                                                                                                                                                                                  Generator<F> f,
                                                                                                                                                                                                  Generator<G> g)
        Creates a Generator that yields Tuple7s by combining the outputs of seven other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        F - the type of the values generated by the sixth component generator
        G - the type of the values generated by the seventh component generator
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        f - the sixth component generator
        g - the seventh component generator
        Returns:
        a Generator<Tuple7<A, B, C, D, E, F, G>
        See Also:
        generateProduct(Generator, Generator, Generator, Generator, Generator, Generator, Generator, Fn7)
      • generateTuple

        public static <A,​B,​C,​D,​E,​F,​G,​H> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple8<A,​B,​C,​D,​E,​F,​G,​H>> generateTuple​(Generator<A> a,
                                                                                                                                                                                                                  Generator<B> b,
                                                                                                                                                                                                                  Generator<C> c,
                                                                                                                                                                                                                  Generator<D> d,
                                                                                                                                                                                                                  Generator<E> e,
                                                                                                                                                                                                                  Generator<F> f,
                                                                                                                                                                                                                  Generator<G> g,
                                                                                                                                                                                                                  Generator<H> h)
        Creates a Generator that yields Tuple8s by combining the outputs of eight other Generators.
        Type Parameters:
        A - the type of the values generated by the first component generator
        B - the type of the values generated by the second component generator
        C - the type of the values generated by the third component generator
        D - the type of the values generated by the fourth component generator
        E - the type of the values generated by the fifth component generator
        F - the type of the values generated by the sixth component generator
        G - the type of the values generated by the seventh component generator
        H - the type of the values generated by the eighth component generator
        Parameters:
        a - the first component generator
        b - the second component generator
        c - the third component generator
        d - the fourth component generator
        e - the fifth component generator
        f - the sixth component generator
        g - the seventh component generator
        h - the eighth component generator
        Returns:
        a Generator<Tuple8<A, B, C, D, E, F, G, H>
        See Also:
        generateProduct(Generator, Generator, Generator, Generator, Generator, Generator, Generator, Generator, Fn8)
      • sequence

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> sequence​(java.lang.Iterable<Generator<A>> gs)
        Converts a sequence of Generators to a Generator of sequences.
        Type Parameters:
        A - the element type
        Parameters:
        gs - a sequence of zero or more Generator<A>s
        Returns:
        a Generator<ImmutableVector<A>>
      • sequenceNonEmpty

        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> sequenceNonEmpty​(software.kes.enhancediterables.NonEmptyIterable<Generator<A>> gs)
        Converts a non-empty sequence of Generators to a Generator of non-empty sequences.
        Type Parameters:
        A - the element type
        Parameters:
        gs - a sequence of one or more Generator<A>s
        Returns:
        a Generator<ImmutableNonEmptyVector<A>>
      • generateString

        public static Generator<java.lang.String> generateString()
        Creates a Generator that yields Strings of printable ASCII characters, with varying lengths.
        Returns:
        a Generator<String>
      • generateString

        public static Generator<java.lang.String> generateString​(int numberOfChunks,
                                                                 Generator<java.lang.String> chunkGenerator)
        Creates a Generator that yields Strings by invoking another Generator a specific number of times, and concatenating the results.
        Parameters:
        numberOfChunks - the number of chunks to generate and concatenate
        chunkGenerator - the generator for each chunk to be concatenated
        Returns:
        a Generator<String>
      • generateString

        public static Generator<java.lang.String> generateString​(IntRange numberOfChunksRange,
                                                                 Generator<java.lang.String> chunkGenerator)
        Creates a Generator that yields Strings by invoking another Generator a random number of times within a specific range, and concatenating the results.
        Parameters:
        numberOfChunksRange - the IntRange of the number of chunks to generate and concatenate
        chunkGenerator - the generator for each chunk to be concatenated
        Returns:
        a Generator<String>
      • generateStringFromCharacters

        public static Generator<java.lang.String> generateStringFromCharacters​(Generator<java.lang.Character> g)
        Creates a Generator that yields Strings by invoking a Generator<Character> a varying number of times, and concatenating the results.
        Parameters:
        g - the generator for each character to be concatenated
        Returns:
        a Generator<String>
      • generateStringFromCharacters

        public static Generator<java.lang.String> generateStringFromCharacters​(software.kes.collectionviews.NonEmptyVector<java.lang.Character> characters)
        Creates a Generator that yields Strings by choosing from a collection of Characters a varying number of times, and concatenating the results.
        Parameters:
        characters - the characters to choose from
        Returns:
        a Generator<String>
      • generateStringFromCharacters

        public static Generator<java.lang.String> generateStringFromCharacters​(int length,
                                                                               Generator<java.lang.Character> g)
        Creates a Generator that yields Strings by invoking a Generator<Character> a specific number of times, and concatenating the results.

        The length of the generated Strings will always be length.

        Parameters:
        g - the generator for each character to be concatenated
        Returns:
        a Generator<String>
      • generateStringFromCharacters

        public static Generator<java.lang.String> generateStringFromCharacters​(int length,
                                                                               software.kes.collectionviews.NonEmptyVector<java.lang.Character> characters)
        Creates a Generator that yields Strings by choosing from a collection of Characters a specific number of times, and concatenating the results.

        The length of the generated Strings will always be length.

        Parameters:
        characters - the characters to choose from
        Returns:
        a Generator<String>
      • generateStringFromCharacters

        public static Generator<java.lang.String> generateStringFromCharacters​(IntRange lengthRange,
                                                                               Generator<java.lang.Character> g)
        Creates a Generator that yields Strings by invoking a Generator<Character> a varying number of times within a specific range, and concatenating the results.

        The length of the generated Strings will always be within lengthRange.

        Parameters:
        lengthRange - the IntRange of the length of the string to generate
        g - the generator for each character to be concatenated
        Returns:
        a Generator<String>
      • generateStringFromCharacters

        public static Generator<java.lang.String> generateStringFromCharacters​(IntRange lengthRange,
                                                                               software.kes.collectionviews.NonEmptyVector<java.lang.Character> characters)
        Creates a Generator that yields Strings by choosing from a collection of Characters a varying number of times within a specific range, and concatenating the results.

        The length of the generated Strings will always be within lengthRange.

        Parameters:
        lengthRange - the IntRange of the length of the string to generate
        characters - the characters to choose from
        Returns:
        a Generator<String>
      • generateString

        @SafeVarargs
        public static Generator<java.lang.String> generateString​(Generator<java.lang.String> first,
                                                                 Generator<java.lang.String>... more)
        Creates a Generator that yields Strings by invoking one or more Generator<String>s in order and concatenating the result.
        Parameters:
        first - the generator of the first string to be concatenated
        more - the generators of the remaining strings to be concatenated
        Returns:
        a Generator<String>
      • generateIdentifier

        public static Generator<java.lang.String> generateIdentifier​(int length)
        Creates a Generator that yields Strings that are legal Java identifiers of a specific length.
        Parameters:
        length - the length of the identifiers to generate
        Returns:
        a Generator<String>
        See Also:
        generateIdentifier(), generateIdentifier(IntRange)
      • generateIdentifier

        public static Generator<java.lang.String> generateIdentifier​(IntRange lengthRange)
        Creates a Generator that yields Strings that are legal Java identifiers with a length within a specific range.
        Parameters:
        lengthRange - the IntRange of the length of the identifiers to generate
        Returns:
        a Generator<String>
        See Also:
        generateIdentifier(), generateIdentifier(int)
      • generateAlphaString

        public static Generator<java.lang.String> generateAlphaString​(int length)
        Creates a Generator that yields Strings consisting of ASCII alphabetic characters, both lowercase and uppercase, and with a specific length.
        Parameters:
        length - the length of the strings to generate
        Returns:
        a Generator<String>
        See Also:
        generateAlphaString(), generateAlphaString(IntRange)
      • generateAlphaString

        public static Generator<java.lang.String> generateAlphaString​(IntRange lengthRange)
        Creates a Generator that yields Strings consisting of ASCII alphabetic characters, both lowercase and uppercase, and with a length within a specific range.
        Parameters:
        lengthRange - the IntRange of the length of the strings to generate
        Returns:
        a Generator<String>
        See Also:
        generateAlphaString(), generateAlphaString(int)
      • generateAlphaUpperString

        public static Generator<java.lang.String> generateAlphaUpperString​(int length)
        Creates a Generator that yields Strings consisting of ASCII uppercase alphabetic characters, and with a specific length.
        Parameters:
        length - the length of the strings to generate
        Returns:
        a Generator<String>
        See Also:
        generateAlphaUpperString(), generateAlphaUpperString(IntRange)
      • generateAlphaLowerString

        public static Generator<java.lang.String> generateAlphaLowerString​(int length)
        Creates a Generator that yields Strings consisting of ASCII lowercase alphabetic characters, and with a specific length.
        Parameters:
        length - the length of the strings to generate
        Returns:
        a Generator<String>
        See Also:
        generateAlphaLowerString(), generateAlphaLowerString(IntRange)
      • generateAlphanumericString

        public static Generator<java.lang.String> generateAlphanumericString​(int length)
        Creates a Generator that yields Strings consisting of ASCII alphanumeric characters (A-Z, a-z, 0-9), and with a specific length.
        Parameters:
        length - the length of the strings to generate
        Returns:
        a Generator<String>
        See Also:
        generateAlphaLowerString(), generateAlphaLowerString(IntRange)
      • concatStrings

        public static Generator<java.lang.String> concatStrings​(java.lang.Iterable<Generator<java.lang.String>> components)
        Creates a Generator that yields Strings by invoking a sequence of component Generator<String>s and concatenating the results.
        Parameters:
        components - a sequence of Generator<String>s to be invoked to generate the components of the output
        Returns:
        a Generator<String>
        See Also:
        concatStrings(String, Iterable), concatStrings(Generator, Iterable)
      • concatStrings

        public static Generator<java.lang.String> concatStrings​(java.lang.String separator,
                                                                java.lang.Iterable<Generator<java.lang.String>> components)
        Creates a Generator that yields Strings by invoking a sequence of component Generator<String>s and concatenating the results, separating them with a specific separator.
        Parameters:
        separator - a String that will be inserted between each of the components of the output
        components - a sequence of Generator<String>s to be invoked to generate the components of the output
        Returns:
        a Generator<String>
        See Also:
        concatStrings(Iterable), concatStrings(Generator, Iterable)
      • concatStrings

        public static Generator<java.lang.String> concatStrings​(Generator<java.lang.String> separator,
                                                                java.lang.Iterable<Generator<java.lang.String>> components)
        Creates a Generator that yields Strings by invoking a sequence of component Generator<String>s and concatenating the results, separating them by a separator that is also generated.
        Parameters:
        separator - a Generator<String> to generate the separator strings. This generator is invoked every time a separator is called for (i.e., between the invocations of each component generator). Note that this can potentially result in a different separator used within the same result.
        components - a sequence of Generator<String>s to be invoked to generate the components of the output
        Returns:
        a Generator<String>
        See Also:
        concatStrings(Iterable), concatStrings(String, Iterable)
      • concatMaybeStrings

        public static Generator<java.lang.String> concatMaybeStrings​(java.lang.Iterable<Generator<com.jnape.palatable.lambda.adt.Maybe<java.lang.String>>> components)
        Creates a Generator that yields Strings by invoking a sequence of component Generator<Maybe<String>>s and concatenating the results.
        Parameters:
        components - a sequence of Generator<Maybe<String>>s to be invoked to generate the components of the output. If a generator outputs a Maybe.just(Object), it will be concatenated to the final output, otherwise ignored.
        Returns:
        a Generator<String>
        See Also:
        concatMaybeStrings(String, Iterable), concatMaybeStrings(Generator, Iterable)
      • concatMaybeStrings

        public static Generator<java.lang.String> concatMaybeStrings​(java.lang.String separator,
                                                                     java.lang.Iterable<Generator<com.jnape.palatable.lambda.adt.Maybe<java.lang.String>>> components)
        Creates a Generator that yields Strings by invoking a sequence of component Generator<Maybe<String>>s and concatenating the results, separating them with a specific separator.
        Parameters:
        separator - a String that will be inserted between each of the components of the output (but only those that yield a Maybe.just(Object)
        components - a sequence of Generator<Maybe<String>>s to be invoked to generate the components of the output. If a generator outputs a Maybe#just, it will be concatenated to the final output, otherwise ignored.
        Returns:
        a Generator<String>
        See Also:
        concatMaybeStrings(Iterable), concatMaybeStrings(Generator, Iterable)
      • concatMaybeStrings

        public static Generator<java.lang.String> concatMaybeStrings​(Generator<java.lang.String> separator,
                                                                     java.lang.Iterable<Generator<com.jnape.palatable.lambda.adt.Maybe<java.lang.String>>> components)
        Creates a Generator that yields Strings by invoking a sequence of component Generator<Maybe<String>>s and concatenating the results, separating them by a separator that is also generated.
        Parameters:
        separator - a Generator<String> to generate the separator strings. This generator is invoked every time a separator is called for (i.e., between the invocations of each component generator that yield a Maybe.just(Object)). Note that this can potentially result in a different separator used within the same result.
        components - a sequence of Generator<Maybe<String>>s to be invoked to generate the components of the output. If a generator outputs a Maybe#just, it will be concatenated to the final output, otherwise ignored.
        Returns:
        a Generator<String>
        See Also:
        concatMaybeStrings(Iterable), concatMaybeStrings(String, Iterable)
      • generateNull

        public static <A> Generator<A> generateNull()
        Creates a Generator that, when invoked, always yields null of a specific type.
        Type Parameters:
        A - the type of the output
        Returns:
        a Generator<A>
      • generateWithNulls

        public static <A> Generator<A> generateWithNulls​(Generator<A> gen)
        Creates a Generator that mixes occasional null values into the output of an existing Generator.
        Type Parameters:
        A - the type of the output
        Parameters:
        gen - the original generator
        Returns:
        a Generator<A>
      • generateWithNulls

        public static <A> Generator<A> generateWithNulls​(NullWeights weights,
                                                         Generator<A> gen)
        Creates a Generator that mixes occasional null values into the output of an existing Generator, with a specific probability for null.
        Type Parameters:
        A - the type of the output
        Parameters:
        weights - the probability for a null value to occur in the output
        gen - the original generator
        Returns:
        a Generator<A>
      • generateUnit

        public static Generator<com.jnape.palatable.lambda.adt.Unit> generateUnit()
        Creates a Generator that, when invoked, always yields Unit.UNIT.
        Returns:
        a Generator<Unit>
      • generateTrue

        public static Generator<java.lang.Boolean> generateTrue()
        Creates a Generator that, when invoked, always yields true.
        Returns:
        a Generator<Boolean>
      • generateFalse

        public static Generator<java.lang.Boolean> generateFalse()
        Creates a Generator that, when invoked, always yields false.
        Returns:
        a Generator<Boolean>
      • generateMaybe

        public static <A> Generator<com.jnape.palatable.lambda.adt.Maybe<A>> generateMaybe​(Generator<A> gen)
        Converts a Generator<A> into a Generator<Maybe<A>> that most of the time yields a just, but will occasionally yield a nothing.
        Type Parameters:
        A - the output type of the generator to convert
        Parameters:
        gen - the generator to convert
        Returns:
        a Generator<Maybe<A>>
      • generateMaybe

        public static <A> Generator<com.jnape.palatable.lambda.adt.Maybe<A>> generateMaybe​(MaybeWeights weights,
                                                                                           Generator<A> gen)
        Converts a Generator<A> into a Generator<Maybe<A>>, with custom probabilities for yielding just vs. nothing.
        Type Parameters:
        A - the output type of the generator to convert
        Parameters:
        weights - the probabilities for just vs. nothing
        gen - the generator to convert
        Returns:
        a Generator<Maybe<A>>
      • generateJust

        public static <A> Generator<com.jnape.palatable.lambda.adt.Maybe<A>> generateJust​(Generator<A> gen)
        Converts a Generator<A> into a Generator<Maybe<A>> that will always yield just.
        Type Parameters:
        A - the output type of the generator to convert
        Parameters:
        gen - the generator to convert
        Returns:
        a Generator<Maybe<A>>
      • generateNothing

        public static <A> Generator<com.jnape.palatable.lambda.adt.Maybe<A>> generateNothing()
        Creates a Generator that, when invoked, always yields Maybe.nothing().
        Type Parameters:
        A - the output type of the generator to convert
        Returns:
        a Generator<Maybe<A>>
      • generateEither

        public static <L,​R> Generator<com.jnape.palatable.lambda.adt.Either<L,​R>> generateEither​(Generator<L> leftGen,
                                                                                                             Generator<R> rightGen)
        Creates a Generator that yields Eithers, with equal probabilities for returning a left or a right.
        Type Parameters:
        L - the left type
        R - the right type
        Parameters:
        leftGen - the generator of left values
        rightGen - the generator of right values
        Returns:
        a Generator<Either<L, R>>
      • generateEither

        public static <L,​R> Generator<com.jnape.palatable.lambda.adt.Either<L,​R>> generateEither​(EitherWeights weights,
                                                                                                             Generator<L> leftGen,
                                                                                                             Generator<R> rightGen)
        Creates a Generator that yields Eithers, with custom probabilities for returning a left or a right.
        Type Parameters:
        L - the left type
        R - the right type
        Parameters:
        weights - the probabilities for left vs. right
        leftGen - the generator of left values
        rightGen - the generator of right values
        Returns:
        a Generator<Either<L, R>>
      • generateLeft

        public static <L,​R> Generator<com.jnape.palatable.lambda.adt.Either<L,​R>> generateLeft​(Generator<L> gen)
        Converts a Generator<L> into a Generator<Either<L, R>> that will always yield left.
        Type Parameters:
        L - the left type
        R - the right type
        Parameters:
        gen - the generator of left values
        Returns:
        a Generator<Either<L, R>>
      • generateRight

        public static <L,​R> Generator<com.jnape.palatable.lambda.adt.Either<L,​R>> generateRight​(Generator<R> gen)
        Converts a Generator<L> into a Generator<Either<L, R>> that will always yield right.
        Type Parameters:
        L - the left type
        R - the right type
        Parameters:
        gen - the generator of right values
        Returns:
        a Generator<Either<L, R>>
      • generateThese

        public static <A,​B> Generator<com.jnape.palatable.lambda.adt.These<A,​B>> generateThese​(Generator<A> generatorA,
                                                                                                           Generator<B> generatorB)
        Creates a Generator that yields Theses, with equal probabilities for returning a value from generatorA, generatorB, or a combination of both.
        Type Parameters:
        A - the first possible type
        B - the second possible type
        Parameters:
        generatorA - the generator of type A
        generatorB - the generator of type B
        Returns:
        a Generator<These<A, B>>
      • generateThese

        public static <A,​B> Generator<com.jnape.palatable.lambda.adt.These<A,​B>> generateThese​(TernaryWeights weights,
                                                                                                           Generator<A> generatorA,
                                                                                                           Generator<B> generatorB)
        Creates a Generator that yields Theses, with custom probabilities for returning a value from generatorA, generatorB, or a combination of both.
        Type Parameters:
        A - the first possible type
        B - the second possible type
        Parameters:
        weights - the probabilities for returning a value for generatorA vs. generatorB vs. both
        generatorA - the generator of type A
        generatorB - the generator of type B
        Returns:
        a Generator<These<A, B>>
      • generateFromEnum

        public static <A extends java.lang.Enum<A>> Generator<A> generateFromEnum​(java.lang.Class<A> enumType)
        Creates a Generator that chooses values from an enum.
        Type Parameters:
        A - the enum type
        Parameters:
        enumType - the class of the enum type
        Returns:
        a Generator<A>
      • chooseOneOf

        @SafeVarargs
        public static <A> Generator<A> chooseOneOf​(Generator<? extends A> first,
                                                   Generator<? extends A>... more)
        Creates a Generator that, when invoked, randomly selects from a list of candidate Generators, (with equal probabilities for each). The output is then drawn from the chosen Generator.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first candidate Generator
        more - the remaining candidate Generators
        Returns:
        a Generator<A>
      • chooseOneOfWeighted

        @SafeVarargs
        public static <A> Generator<A> chooseOneOfWeighted​(Weighted<? extends Generator<? extends A>> first,
                                                           Weighted<? extends Generator<? extends A>>... more)
        Creates a Generator that, when invoked, randomly selects from a list of candidate Generators, (with custom probabilities for each). The output is then drawn from the chosen Generator.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first weighted candidate Generator
        more - the remaining weighted candidates Generators
        Returns:
        a Generator<A>
      • chooseOneOfValues

        @SafeVarargs
        public static <A> Generator<A> chooseOneOfValues​(A first,
                                                         A... more)
        Creates a Generator that, when invoked, randomly chooses an item from one or more candidate values, with an equal probability for each.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first candidate value
        more - the remaining candidate values
        Returns:
        a Generator<A>
      • chooseOneOfWeightedValues

        @SafeVarargs
        public static <A> Generator<A> chooseOneOfWeightedValues​(Weighted<? extends A> first,
                                                                 Weighted<? extends A>... more)
        Creates a Generator that, when invoked, randomly chooses and item from one or more candidate values, with custom probabilities for each.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first weighted candidate value
        more - the remaining weighted candidate values
        Returns:
        a Generator<A>
      • chooseAtLeastOneOf

        @SafeVarargs
        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> chooseAtLeastOneOf​(Generator<? extends A> first,
                                                                                                                Generator<? extends A>... more)
        Creates a Generator that, when invoked, chooses one or more of the supplied candidate Generators. The chosen Generators are then invoked, and the outputs are collected for the result.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first candidate Generator
        more - the remaining candidate Generators
        Returns:
        a Generator<ImmutableNonEmptyVector<A>>
      • chooseAtLeastOneOfValues

        @SafeVarargs
        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> chooseAtLeastOneOfValues​(A first,
                                                                                                                      A... more)
        Creates a Generator that, when invoked, chooses one or more of the supplied candidate values, and returns a collection of all those chosen.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first candidate value
        more - the remaining candidate values
        Returns:
        a Generator<ImmutableNonEmptyVector<A>>
      • chooseSomeOf

        @SafeVarargs
        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> chooseSomeOf​(Generator<? extends A> first,
                                                                                                  Generator<? extends A>... more)
        Creates a Generator that, when invoked, chooses zero or more of the supplied candidate Generators. The chosen Generators are then invoked, and the outputs are collected for the result.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first candidate Generator
        more - the remaining candidate Generators
        Returns:
        a Generator<ImmutableVector<A>>
      • chooseSomeOfValues

        @SafeVarargs
        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> chooseSomeOfValues​(A first,
                                                                                                        A... more)
        Creates a Generator that, when invoked, chooses zero or more of the supplied candidate values, and returns a collection of all those chosen.
        Type Parameters:
        A - the output type
        Parameters:
        first - the first candidate Generator
        more - the remaining candidate Generators
        Returns:
        a Generator<ImmutableVector<A>>
      • chooseOneValueFromCollection

        public static <A> Generator<A> chooseOneValueFromCollection​(java.lang.Iterable<A> candidates)
        Creates a Generator that, when invoked, chooses a value from a collection, with an equal probability for each element.
        Type Parameters:
        A - the output type
        Parameters:
        candidates - the collection of candidate values. Must have at least one element.
        Returns:
        a Generator<A>
      • chooseOneFromCollection

        public static <A> Generator<A> chooseOneFromCollection​(java.lang.Iterable<Generator<? extends A>> candidates)
        Creates a Generator that, when invoked, chooses a Generator from a collection of candidate Generators (with an equal probability for each). The output is then drawn from the chosen Generator.
        Type Parameters:
        A - the output type
        Parameters:
        candidates - the collection of candidate Generators. Must have at least one element.
        Returns:
        a Generator<A>
      • chooseOneFromCollectionWeighted

        public static <A> Generator<A> chooseOneFromCollectionWeighted​(java.lang.Iterable<Weighted<? extends Generator<? extends A>>> candidates)
        Creates a Generator that, when invoked, chooses a Generator from a collection of candidate Generators (with a custom probability for each). The output is then drawn from the chosen Generator.
        Type Parameters:
        A - the output type
        Parameters:
        candidates - the collection of weighted candidate Generators. Must have at least one element.
        Returns:
        a Generator<A>
      • chooseOneValueFromDomain

        public static <A> Generator<A> chooseOneValueFromDomain​(software.kes.collectionviews.NonEmptyVector<A> domain)
        Creates a Generator that, when invoked, chooses a value from a custom domain.
        Type Parameters:
        A - the output type
        Parameters:
        domain - the collection of candidates values
        Returns:
        a Generator<A>
      • chooseAtLeastOneValueFromCollection

        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> chooseAtLeastOneValueFromCollection​(java.util.Collection<A> candidates)
        Creates a Generator that, when invoked, chooses one or more values from a collection and returns a collection of the values chosen.
        Type Parameters:
        A - the output type
        Parameters:
        candidates - the collection of candidate values. Must have at least one element.
        Returns:
        a Generator<A>
      • chooseAtLeastOneValueFromDomain

        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> chooseAtLeastOneValueFromDomain​(software.kes.collectionviews.NonEmptyVector<A> domain)
        Creates a Generator that, when invoked, chooses one or more values from a custom domain and returns a collection of the values chosen.
        Type Parameters:
        A - the output type
        Parameters:
        domain - the collection of candidate values
        Returns:
        a Generator<A>
      • chooseSomeValuesFromCollection

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> chooseSomeValuesFromCollection​(java.util.Collection<A> candidates)
        Creates a Generator that, when invoked, chooses zero or more values from a collection and returns a collection of the values chosen.
        Type Parameters:
        A - the output type
        Parameters:
        candidates - the collection of candidate values
        Returns:
        a Generator<A>
      • chooseSomeValuesFromDomain

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> chooseSomeValuesFromDomain​(software.kes.collectionviews.NonEmptyVector<A> domain)
        Creates a Generator that, when invoked, chooses zero or more values from a custom domain and returns a collection of the values chosen.
        Type Parameters:
        A - the output type
        Parameters:
        domain - the collection of candidate values
        Returns:
        a Generator<A>
      • chooseEntryFromMap

        public static <K,​V> Generator<java.util.Map.Entry<K,​V>> chooseEntryFromMap​(java.util.Map<K,​V> map)
        Creates a Generator that, when invoked, chooses a Map.Entry from a Map.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        map - a map with all candidate entries. Must contain at least one entry.
        Returns:
        a Generator<Map.Entry<K, V>>
      • chooseKeyFromMap

        public static <K,​V> Generator<K> chooseKeyFromMap​(java.util.Map<K,​V> map)
        Creates a Generator that, when invoked, chooses a key from a Map.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        map - a map with all candidate keys. Must contain at least one key.
        Returns:
        a Generator<K>
      • chooseValueFromMap

        public static <K,​V> Generator<V> chooseValueFromMap​(java.util.Map<K,​V> map)
        Creates a Generator that, when invoked, chooses a value from a Map.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        map - a map with all candidate values. Must contain at least one value.
        Returns:
        a Generator<V>
      • frequency

        public static <A> Generator<A> frequency​(FrequencyMap<A> frequencyMap)
        Creates a Generator that chooses its values from a FrequencyMap.
        Type Parameters:
        A - the output type
        Parameters:
        frequencyMap - the FrequencyMap
        Returns:
        a Generator<A>
      • generateArrayList

        public static <A> Generator<java.util.ArrayList<A>> generateArrayList​(Generator<A> elements)
        Creates a Generator that yields ArrayLists of various sizes.
        Type Parameters:
        A - the element type
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<ArrayList<A>>
      • generateNonEmptyArrayList

        public static <A> Generator<java.util.ArrayList<A>> generateNonEmptyArrayList​(Generator<A> elements)
        Creates a Generator that yields ArrayLists of various sizes, with a minimum size of one.
        Type Parameters:
        A - the element type
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<ArrayList<A>>
      • generateArrayListOfSize

        public static <A> Generator<java.util.ArrayList<A>> generateArrayListOfSize​(int size,
                                                                                    Generator<A> elements)
        Creates a Generator that yields ArrayLists of a specific size.
        Type Parameters:
        A - the element type
        Parameters:
        size - the size of the ArrayLists returned; must be >= 0
        elements - the generator for elements
        Returns:
        a Generator<ArrayList<A>>
      • generateArrayListOfSize

        public static <A> Generator<java.util.ArrayList<A>> generateArrayListOfSize​(IntRange sizeRange,
                                                                                    Generator<A> elements)
        Creates a Generator that yields ArrayLists of various sizes, within a specific range.
        Type Parameters:
        A - the element type
        Parameters:
        sizeRange - the size range of the ArrayLists returned
        elements - the generator for elements
        Returns:
        a Generator<ArrayList<A>>
      • generateHashSet

        public static <A> Generator<java.util.HashSet<A>> generateHashSet​(Generator<A> elements)
        Creates a Generator that yields HashSets of various sizes.
        Type Parameters:
        A - the element type
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<HashSet<A>>
      • generateNonEmptyHashSet

        public static <A> Generator<java.util.HashSet<A>> generateNonEmptyHashSet​(Generator<A> elements)
        Creates a Generator that yields HashSets of various sizes, with a minimum size of one.
        Type Parameters:
        A - the element type
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<HashSet<A>>
      • generateVector

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> generateVector​(Generator<A> elements)
        Creates a Generator that yields ImmutableVectors of various sizes.
        Type Parameters:
        A - the element type
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<ImmutableVector<A>>
      • generateVectorOfSize

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> generateVectorOfSize​(int size,
                                                                                                          Generator<A> elements)
        Creates a Generator that yields ImmutableVectors of a specific size.
        Type Parameters:
        A - the element type
        Parameters:
        size - the size of the ImmutableVectors returned; must be >= 0
        elements - the generator for elements
        Returns:
        a Generator<ImmutableVector<A>>
      • generateVectorOfSize

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> generateVectorOfSize​(IntRange sizeRange,
                                                                                                          Generator<A> elements)
        Creates a Generator that yields ImmutableVectors of a various sizes, within a specific range.
        Type Parameters:
        A - the element type
        Parameters:
        sizeRange - the size range of the ImmutableVectors returned
        elements - the generator for elements
        Returns:
        a Generator<ImmutableVector<A>>
      • generateNonEmptyVector

        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> generateNonEmptyVector​(Generator<A> elements)
        Creates a Generator that yields ImmutableNonEmptyVectors of various sizes.
        Type Parameters:
        A - the element type
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<ImmutableNonEmptyVector<A>>
      • generateNonEmptyVectorOfSize

        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> generateNonEmptyVectorOfSize​(int size,
                                                                                                                          Generator<A> elements)
        Creates a Generator that yields ImmutableNonEmptyVectors of a specific size.
        Type Parameters:
        A - the element type
        Parameters:
        size - the size of the ImmutableNonEmptyVectors returned; must be >= 1
        elements - the generator for elements
        Returns:
        a Generator<ImmutableNonEmptyVector<A>>
      • generateNonEmptyVectorOfSize

        public static <A> Generator<software.kes.collectionviews.ImmutableNonEmptyVector<A>> generateNonEmptyVectorOfSize​(IntRange sizeRange,
                                                                                                                          Generator<A> elements)
        Creates a Generator that yields ImmutableNonEmptyVectors of a various sizes, within a specific range.
        Type Parameters:
        A - the element type
        Parameters:
        sizeRange - the size range of the ImmutableNonEmptyVectors returned
        elements - the generator for elements
        Returns:
        a Generator<ImmutableNonEmptyVector<A>>
      • generateMap

        public static <K,​V> Generator<java.util.Map<K,​V>> generateMap​(Generator<K> generateKey,
                                                                                  Generator<V> generateValue)
        Creates a Generator that yields Maps of various sizes.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        generateKey - the generator for keys
        generateValue - the generator for values
        Returns:
        a Generator<Map<K, V>>
      • generateMap

        public static <K,​V> Generator<java.util.Map<K,​V>> generateMap​(java.util.Collection<K> keys,
                                                                                  Generator<V> generateValue)
        Creates a Generator that yields Maps with a given set of keys.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        keys - the keys to populate in the output. All keys will be in the output.
        generateValue - the generator for values
        Returns:
        a Generator<Map<K, V>>
      • generateMap

        public static <K,​V> Generator<java.util.Map<K,​V>> generateMap​(software.kes.collectionviews.Vector<K> keys,
                                                                                  Generator<V> generateValue)
        Creates a Generator that yields Maps with a given set of keys.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        keys - the keys to populate in the output. All keys will be in the output.
        generateValue - the generator for values
        Returns:
        a Generator<Map<K, V>>
      • generateNonEmptyMap

        public static <K,​V> Generator<java.util.Map<K,​V>> generateNonEmptyMap​(Generator<K> generateKey,
                                                                                          Generator<V> generateValue)
        Creates a Generator that yields Maps of various sizes, with a minimum size of one.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        generateKey - the generator for keys
        generateValue - the generator for values
        Returns:
        a Generator<Map<K, V>>
      • generateInfiniteIterable

        public static <A> Generator<ValueSupply<A>> generateInfiniteIterable​(Generator<A> elements)
        Creates a Generator that yields infinite Iterables.
        Type Parameters:
        A - the element type
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<ValueSupply<A>>
      • generateShuffled

        public static Generator<software.kes.collectionviews.Vector<java.lang.Integer>> generateShuffled​(int count)
        Creates a Generator that yields Vectors that contain the integers from 0..count-1 in random order.
        Parameters:
        count - the number of elements in the output; must be >= 0.
        Returns:
        a Generator<Vector<Integer>>
      • generateShuffled

        public static <A> Generator<software.kes.collectionviews.Vector<A>> generateShuffled​(int count,
                                                                                             com.jnape.palatable.lambda.functions.Fn1<java.lang.Integer,​A> fn)
        Creates a Generator that yields Vectors by shuffling the indices from 0..count-1 in random order, and mapping them to a given function.
        Type Parameters:
        A - the element type
        Parameters:
        count - the number of elements in the output; must be >= 0.
        fn - a pure function that converts an integer from 0..count-1 to an element; should be side-effect free.
        Returns:
        a Generator<Vector<A>>
      • generateNonEmptyShuffled

        public static <A> Generator<software.kes.collectionviews.NonEmptyVector<A>> generateNonEmptyShuffled​(int count,
                                                                                                             com.jnape.palatable.lambda.functions.Fn1<java.lang.Integer,​A> fn)
        Creates a Generator that yields NonEmptyVectors by shuffling the indices from 0..count-1 in random order, and mapping them to a given function.
        Type Parameters:
        A - the element type
        Parameters:
        count - the number of elements in the output; must be >= 1.
        fn - a pure function that converts an integer from 0..count-1 to an element; should be side-effect free.
        Returns:
        a Generator<NonEmptyVector<A>>
      • generateShuffled

        public static <A> Generator<software.kes.collectionviews.Vector<A>> generateShuffled​(software.kes.enhancediterables.FiniteIterable<A> input)
        Creates a Generator that yields Vectors by randomly shuffling the order of the elements in the input.
        Type Parameters:
        A - the element type
        Parameters:
        input - the input sequence. It is not altered, and is iterated at most once.
        Returns:
        a Generator<Vector<A>>
      • generateShuffled

        public static <A> Generator<software.kes.collectionviews.NonEmptyVector<A>> generateShuffled​(software.kes.enhancediterables.NonEmptyFiniteIterable<A> input)
        Creates a Generator that yields NonEmptyVectors by randomly shuffling the order of the elements in the input.
        Type Parameters:
        A - the element type
        Parameters:
        input - the input sequence. It is not altered, and is iterated at most once.
        Returns:
        a Generator<NonEmptyVector<A>>
      • generateShuffled

        public static <A> Generator<software.kes.collectionviews.Vector<A>> generateShuffled​(java.util.Collection<A> input)
        Creates a Generator that yields Vectors by randomly shuffling the order of the elements in the input.
        Type Parameters:
        A - the element type
        Parameters:
        input - the input sequence. It is not altered, and is iterated at most once.
        Returns:
        a Generator<Vector<A>>
      • generateShuffled

        public static <A> Generator<software.kes.collectionviews.Vector<A>> generateShuffled​(A[] input)
        Creates a Generator that yields Vectors by randomly shuffling the order of the elements in the input.
        Type Parameters:
        A - the element type
        Parameters:
        input - the input sequence. It is not altered, and is iterated at most once.
        Returns:
        a Generator<Vector<A>>
      • generateShuffled

        public static <A> Generator<software.kes.collectionviews.Vector<A>> generateShuffled​(software.kes.collectionviews.Vector<A> input)
        Creates a Generator that yields Vectors by randomly shuffling the order of the elements in the input.
        Type Parameters:
        A - the element type
        Parameters:
        input - the input Vector
        Returns:
        a Generator<Vector<A>>
      • generateShuffled

        public static <A> Generator<software.kes.collectionviews.NonEmptyVector<A>> generateShuffled​(software.kes.collectionviews.NonEmptyVector<A> input)
        Creates a Generator that yields NonEmptyVectors by randomly shuffling the order of the elements in the input.
        Type Parameters:
        A - the element type
        Parameters:
        input - the input NonEmptyVector
        Returns:
        a Generator<NonEmptyVector<A>>
      • choiceBuilder

        public static <A> ChoiceBuilder1<A> choiceBuilder​(Weighted<? extends Generator<? extends A>> firstChoice)
        Creates a ChoiceBuilder1.
        Type Parameters:
        A - the output type of the first choice
        Parameters:
        firstChoice - a weighted Generator for the first choice
        Returns:
        a ChoiceBuilder1<A>
      • choiceBuilder

        public static <A> ChoiceBuilder1<A> choiceBuilder​(Generator<? extends A> firstChoice)
        Creates a ChoiceBuilder1.
        Type Parameters:
        A - the output type of the first choice
        Parameters:
        firstChoice - a Generator for the first choice
        Returns:
        a ChoiceBuilder1<A>
      • choiceBuilderValue

        public static <A> ChoiceBuilder1<A> choiceBuilderValue​(Weighted<? extends A> firstChoice)
        Creates a ChoiceBuilder1.
        Type Parameters:
        A - the output type of the first choice
        Parameters:
        firstChoice - a weighted value for the first choice
        Returns:
        a ChoiceBuilder1<A>
      • choiceBuilderValue

        public static <A> ChoiceBuilder1<A> choiceBuilderValue​(A firstChoice)
        Creates a ChoiceBuilder1.
        Type Parameters:
        A - the output type of the first choice
        Parameters:
        firstChoice - a value for the first choice
        Returns:
        a ChoiceBuilder1<A>
      • generateChoice

        public static <A,​B> Generator<com.jnape.palatable.lambda.adt.choice.Choice2<A,​B>> generateChoice​(Weighted<? extends Generator<? extends A>> a,
                                                                                                                     Weighted<? extends Generator<? extends B>> b)
        Creates a Generator that yields Choice2s.
        Type Parameters:
        A - the output type of the first choice
        B - the output type of the second choice
        Parameters:
        a - a weighted Generator for the first choice
        b - a weighted Generator for the second choice
        Returns:
        a Generator<Choice2<A, B>>
      • generateChoice

        public static <A,​B,​C> Generator<com.jnape.palatable.lambda.adt.choice.Choice3<A,​B,​C>> generateChoice​(Weighted<? extends Generator<? extends A>> a,
                                                                                                                                     Weighted<? extends Generator<? extends B>> b,
                                                                                                                                     Weighted<? extends Generator<? extends C>> c)
        Creates a Generator that yields Choice3s.
        Type Parameters:
        A - the output type of the first choice
        B - the output type of the second choice
        C - the output type of the third choice
        Parameters:
        a - a weighted Generator for the first choice
        b - a weighted Generator for the second choice
        c - a weighted Generator for the third choice
        Returns:
        a Generator<Choice3<A, B, C>>
      • generateChoice

        public static <A,​B,​C,​D> Generator<com.jnape.palatable.lambda.adt.choice.Choice4<A,​B,​C,​D>> generateChoice​(Weighted<? extends Generator<? extends A>> a,
                                                                                                                                                     Weighted<? extends Generator<? extends B>> b,
                                                                                                                                                     Weighted<? extends Generator<? extends C>> c,
                                                                                                                                                     Weighted<? extends Generator<? extends D>> d)
        Creates a Generator that yields Choice4s.
        Type Parameters:
        A - the output type of the first choice
        B - the output type of the second choice
        C - the output type of the third choice
        D - the output type of the fourth choice
        Parameters:
        a - a weighted Generator for the first choice
        b - a weighted Generator for the second choice
        c - a weighted Generator for the third choice
        d - a weighted Generator for the fourth choice
        Returns:
        a Generator<Choice4<A, B, C, D>>
      • generateChoice

        public static <A,​B,​C,​D,​E> Generator<com.jnape.palatable.lambda.adt.choice.Choice5<A,​B,​C,​D,​E>> generateChoice​(Weighted<? extends Generator<? extends A>> a,
                                                                                                                                                                     Weighted<? extends Generator<? extends B>> b,
                                                                                                                                                                     Weighted<? extends Generator<? extends C>> c,
                                                                                                                                                                     Weighted<? extends Generator<? extends D>> d,
                                                                                                                                                                     Weighted<? extends Generator<? extends E>> e)
        Creates a Generator that yields Choice5s.
        Type Parameters:
        A - the output type of the first choice
        B - the output type of the second choice
        C - the output type of the third choice
        D - the output type of the fourth choice
        E - the output type of the fifth choice
        Parameters:
        a - a weighted Generator for the first choice
        b - a weighted Generator for the second choice
        c - a weighted Generator for the third choice
        d - a weighted Generator for the fourth choice
        e - a weighted Generator for the fifth choice
        Returns:
        a Generator<Choice5<A, B, C, D, E>>
      • generateChoice

        public static <A,​B,​C,​D,​E,​F> Generator<com.jnape.palatable.lambda.adt.choice.Choice6<A,​B,​C,​D,​E,​F>> generateChoice​(Weighted<? extends Generator<? extends A>> a,
                                                                                                                                                                                     Weighted<? extends Generator<? extends B>> b,
                                                                                                                                                                                     Weighted<? extends Generator<? extends C>> c,
                                                                                                                                                                                     Weighted<? extends Generator<? extends D>> d,
                                                                                                                                                                                     Weighted<? extends Generator<? extends E>> e,
                                                                                                                                                                                     Weighted<? extends Generator<? extends F>> f)
        Creates a Generator that yields Choice6s.
        Type Parameters:
        A - the output type of the first choice
        B - the output type of the second choice
        C - the output type of the third choice
        D - the output type of the fourth choice
        E - the output type of the fifth choice
        F - the output type of the sixth choice
        Parameters:
        a - a weighted Generator for the first choice
        b - a weighted Generator for the second choice
        c - a weighted Generator for the third choice
        d - a weighted Generator for the fourth choice
        e - a weighted Generator for the fifth choice
        f - a weighted Generator for the sixth choice
        Returns:
        a Generator<Choice6<A, B, C, D, E, F>>
      • generateChoice

        public static <A,​B,​C,​D,​E,​F,​G> Generator<com.jnape.palatable.lambda.adt.choice.Choice7<A,​B,​C,​D,​E,​F,​G>> generateChoice​(Weighted<? extends Generator<? extends A>> a,
                                                                                                                                                                                                     Weighted<? extends Generator<? extends B>> b,
                                                                                                                                                                                                     Weighted<? extends Generator<? extends C>> c,
                                                                                                                                                                                                     Weighted<? extends Generator<? extends D>> d,
                                                                                                                                                                                                     Weighted<? extends Generator<? extends E>> e,
                                                                                                                                                                                                     Weighted<? extends Generator<? extends F>> f,
                                                                                                                                                                                                     Weighted<? extends Generator<? extends G>> g)
        Creates a Generator that yields Choice7s.
        Type Parameters:
        A - the output type of the first choice
        B - the output type of the second choice
        C - the output type of the third choice
        D - the output type of the fourth choice
        E - the output type of the fifth choice
        F - the output type of the sixth choice
        G - the output type of the seventh choice
        Parameters:
        a - a weighted Generator for the first choice
        b - a weighted Generator for the second choice
        c - a weighted Generator for the third choice
        d - a weighted Generator for the fourth choice
        e - a weighted Generator for the fifth choice
        f - a weighted Generator for the sixth choice
        g - a weighted Generator for the seventh choice
        Returns:
        a Generator<Choice7<A, B, C, D, E, F, G>>
      • generateChoice

        public static <A,​B,​C,​D,​E,​F,​G,​H> Generator<com.jnape.palatable.lambda.adt.choice.Choice8<A,​B,​C,​D,​E,​F,​G,​H>> generateChoice​(Weighted<? extends Generator<? extends A>> a,
                                                                                                                                                                                                                     Weighted<? extends Generator<? extends B>> b,
                                                                                                                                                                                                                     Weighted<? extends Generator<? extends C>> c,
                                                                                                                                                                                                                     Weighted<? extends Generator<? extends D>> d,
                                                                                                                                                                                                                     Weighted<? extends Generator<? extends E>> e,
                                                                                                                                                                                                                     Weighted<? extends Generator<? extends F>> f,
                                                                                                                                                                                                                     Weighted<? extends Generator<? extends G>> g,
                                                                                                                                                                                                                     Weighted<? extends Generator<? extends H>> h)
        Creates a Generator that yields Choice8s.
        Type Parameters:
        A - the output type of the first choice
        B - the output type of the second choice
        C - the output type of the third choice
        D - the output type of the fourth choice
        E - the output type of the fifth choice
        F - the output type of the sixth choice
        G - the output type of the seventh choice
        H - the output type of the eighth choice
        Parameters:
        a - a weighted Generator for the first choice
        b - a weighted Generator for the second choice
        c - a weighted Generator for the third choice
        d - a weighted Generator for the fourth choice
        e - a weighted Generator for the fifth choice
        f - a weighted Generator for the sixth choice
        g - a weighted Generator for the seventh choice
        h - a weighted Generator for the eighth choice
        Returns:
        a Generator<Choice8<A, B, C, D, E, F, G, H>>
      • generateFn0

        public static <R> Generator<com.jnape.palatable.lambda.functions.Fn0<R>> generateFn0​(Generator<R> result)
        Creates a Generator that yields Fn0s.
        Type Parameters:
        R - the result type of the function
        Parameters:
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn0<R>>
      • generateFn1

        public static <A,​R> Generator<com.jnape.palatable.lambda.functions.Fn1<A,​R>> generateFn1​(Cogenerator<A> param1,
                                                                                                             Generator<R> result)
        Creates a Generator that yields Fn1s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn1<A, R>>
      • generateFn2

        public static <A,​B,​R> Generator<com.jnape.palatable.lambda.functions.Fn2<A,​B,​R>> generateFn2​(Cogenerator<A> param1,
                                                                                                                             Cogenerator<B> param2,
                                                                                                                             Generator<R> result)
        Creates a Generator that yields pure Fn2s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        B - the type of the second parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        param2 - a Cogenerator for the second parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn2<A, B, R>>
      • generateFn3

        public static <A,​B,​C,​R> Generator<com.jnape.palatable.lambda.functions.Fn3<A,​B,​C,​R>> generateFn3​(Cogenerator<A> param1,
                                                                                                                                             Cogenerator<B> param2,
                                                                                                                                             Cogenerator<C> param3,
                                                                                                                                             Generator<R> result)
        Creates a Generator that yields pure Fn3s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        B - the type of the second parameter of the function
        C - the type of the third parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        param2 - a Cogenerator for the second parameter of the function
        param3 - a Cogenerator for the third parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn3<A, B, C, R>>
      • generateFn4

        public static <A,​B,​C,​D,​R> Generator<com.jnape.palatable.lambda.functions.Fn4<A,​B,​C,​D,​R>> generateFn4​(Cogenerator<A> param1,
                                                                                                                                                             Cogenerator<B> param2,
                                                                                                                                                             Cogenerator<C> param3,
                                                                                                                                                             Cogenerator<D> param4,
                                                                                                                                                             Generator<R> result)
        Creates a Generator that yields pure Fn4s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        B - the type of the second parameter of the function
        C - the type of the third parameter of the function
        D - the type of the fourth parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        param2 - a Cogenerator for the second parameter of the function
        param3 - a Cogenerator for the third parameter of the function
        param4 - a Cogenerator for the fourth parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn4<A, B, C, D, R>>
      • generateFn5

        public static <A,​B,​C,​D,​E,​R> Generator<com.jnape.palatable.lambda.functions.Fn5<A,​B,​C,​D,​E,​R>> generateFn5​(Cogenerator<A> param1,
                                                                                                                                                                             Cogenerator<B> param2,
                                                                                                                                                                             Cogenerator<C> param3,
                                                                                                                                                                             Cogenerator<D> param4,
                                                                                                                                                                             Cogenerator<E> param5,
                                                                                                                                                                             Generator<R> result)
        Creates a Generator that yields pure Fn5s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        B - the type of the second parameter of the function
        C - the type of the third parameter of the function
        D - the type of the fourth parameter of the function
        E - the type of the fifth parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        param2 - a Cogenerator for the second parameter of the function
        param3 - a Cogenerator for the third parameter of the function
        param4 - a Cogenerator for the fourth parameter of the function
        param5 - a Cogenerator for the fifth parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn5<A, B, C, D, E, R>>
      • generateFn6

        public static <A,​B,​C,​D,​E,​F,​R> Generator<com.jnape.palatable.lambda.functions.Fn6<A,​B,​C,​D,​E,​F,​R>> generateFn6​(Cogenerator<A> param1,
                                                                                                                                                                                             Cogenerator<B> param2,
                                                                                                                                                                                             Cogenerator<C> param3,
                                                                                                                                                                                             Cogenerator<D> param4,
                                                                                                                                                                                             Cogenerator<E> param5,
                                                                                                                                                                                             Cogenerator<F> param6,
                                                                                                                                                                                             Generator<R> result)
        Creates a Generator that yields pure Fn6s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        B - the type of the second parameter of the function
        C - the type of the third parameter of the function
        D - the type of the fourth parameter of the function
        E - the type of the fifth parameter of the function
        F - the type of the sixth parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        param2 - a Cogenerator for the second parameter of the function
        param3 - a Cogenerator for the third parameter of the function
        param4 - a Cogenerator for the fourth parameter of the function
        param5 - a Cogenerator for the fifth parameter of the function
        param6 - a Cogenerator for the sixth parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn6<A, B, C, D, E, F, R>>
      • generateFn7

        public static <A,​B,​C,​D,​E,​F,​G,​R> Generator<com.jnape.palatable.lambda.functions.Fn7<A,​B,​C,​D,​E,​F,​G,​R>> generateFn7​(Cogenerator<A> param1,
                                                                                                                                                                                                             Cogenerator<B> param2,
                                                                                                                                                                                                             Cogenerator<C> param3,
                                                                                                                                                                                                             Cogenerator<D> param4,
                                                                                                                                                                                                             Cogenerator<E> param5,
                                                                                                                                                                                                             Cogenerator<F> param6,
                                                                                                                                                                                                             Cogenerator<G> param7,
                                                                                                                                                                                                             Generator<R> result)
        Creates a Generator that yields pure Fn7s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        B - the type of the second parameter of the function
        C - the type of the third parameter of the function
        D - the type of the fourth parameter of the function
        E - the type of the fifth parameter of the function
        F - the type of the sixth parameter of the function
        G - the type of the seventh parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        param2 - a Cogenerator for the second parameter of the function
        param3 - a Cogenerator for the third parameter of the function
        param4 - a Cogenerator for the fourth parameter of the function
        param5 - a Cogenerator for the fifth parameter of the function
        param6 - a Cogenerator for the sixth parameter of the function
        param7 - a Cogenerator for the seventh parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn7<A, B, C, D, E, F, G, R>>
      • generateFn8

        public static <A,​B,​C,​D,​E,​F,​G,​H,​R> Generator<com.jnape.palatable.lambda.functions.Fn8<A,​B,​C,​D,​E,​F,​G,​H,​R>> generateFn8​(Cogenerator<A> param1,
                                                                                                                                                                                                                             Cogenerator<B> param2,
                                                                                                                                                                                                                             Cogenerator<C> param3,
                                                                                                                                                                                                                             Cogenerator<D> param4,
                                                                                                                                                                                                                             Cogenerator<E> param5,
                                                                                                                                                                                                                             Cogenerator<F> param6,
                                                                                                                                                                                                                             Cogenerator<G> param7,
                                                                                                                                                                                                                             Cogenerator<H> param8,
                                                                                                                                                                                                                             Generator<R> result)
        Creates a Generator that yields pure Fn8s. Generated functions will be pure and total.
        Type Parameters:
        A - the type of the first parameter of the function
        B - the type of the second parameter of the function
        C - the type of the third parameter of the function
        D - the type of the fourth parameter of the function
        E - the type of the fifth parameter of the function
        F - the type of the sixth parameter of the function
        G - the type of the seventh parameter of the function
        H - the type of the eighth parameter of the function
        R - the result type of the function
        Parameters:
        param1 - a Cogenerator for the first parameter of the function
        param2 - a Cogenerator for the second parameter of the function
        param3 - a Cogenerator for the third parameter of the function
        param4 - a Cogenerator for the fourth parameter of the function
        param5 - a Cogenerator for the fifth parameter of the function
        param6 - a Cogenerator for the sixth parameter of the function
        param7 - a Cogenerator for the seventh parameter of the function
        param8 - a Cogenerator for the eighth parameter of the function
        result - a Generator for the result of the function
        Returns:
        a Generator<Fn8<A, B, C, D, E, F, G, H, R>>
      • generateUUID

        public static Generator<java.util.UUID> generateUUID()
        Creates a Generator that yields version 4 UUIDs.
        Returns:
        a Generator<UUID>
      • generateBigInteger

        public static Generator<java.math.BigInteger> generateBigInteger()
        Creates a Generator that yields BigIntegers.
        Returns:
        a Generator<BigInteger>
      • generateBigInteger

        public static Generator<java.math.BigInteger> generateBigInteger​(BigIntegerRange range)
        Creates a Generator that yields BigIntegers within a specific range.
        Parameters:
        range - the BigIntegerRange of the values to generate
        Returns:
        a Generator<BigInteger>
      • generateBigDecimal

        public static Generator<java.math.BigDecimal> generateBigDecimal()
        Creates a Generator that yields BigDecimals.
        Returns:
        a Generator<BigDecimal>
      • generateBigDecimal

        public static Generator<java.math.BigDecimal> generateBigDecimal​(BigDecimalRange range)
        Creates a Generator that yields BigDecimals within a specific range.
        Parameters:
        range - the BigDecimalRange of the values to generate
        Returns:
        a Generator<BigDecimal>
      • generateBigDecimal

        public static Generator<java.math.BigDecimal> generateBigDecimal​(Generator<java.lang.Integer> generateDecimalPlaces,
                                                                         BigDecimalRange range)
        Creates a Generator that yields BigDecimals within a specific range, and with the number of decimal places determined by a specific Generator.
        Parameters:
        generateDecimalPlaces - a Generator to determine the number of decimal places of the generated values
        range - the BigDecimalRange of the values to generate
        Returns:
        a Generator<BigDecimal>
      • generateBigDecimal

        public static Generator<java.math.BigDecimal> generateBigDecimal​(int decimalPlaces,
                                                                         BigDecimalRange range)
        Creates a Generator that yields BigDecimals within a specific range, and with a specific number of decimal places.
        Parameters:
        decimalPlaces - the number of decimal places of the generated values
        Returns:
        a Generator<BigDecimal>
      • generateMonth

        public static Generator<java.time.Month> generateMonth()
        Creates a Generator that yields Months.
        Returns:
        a Generator<Month>
      • generateDayOfWeek

        public static Generator<java.time.DayOfWeek> generateDayOfWeek()
        Creates a Generator that yields DayOfWeeks.
        Returns:
        a Generator<DayOfWeek>
      • generateLocalDate

        public static Generator<java.time.LocalDate> generateLocalDate()
        Creates a Generator that yields LocalDates.
        Returns:
        a Generator<LocalDate>
      • generateLocalDate

        public static Generator<java.time.LocalDate> generateLocalDate​(LocalDateRange range)
        Creates a Generator that yields LocalDates within a specific range.
        Parameters:
        range - the LocalDateRange of the values to generate
        Returns:
        a Generator<LocalDate>
      • generateLocalDateForYear

        public static Generator<java.time.LocalDate> generateLocalDateForYear​(java.time.Year year)
        Creates a Generator that yields LocalDates within a specific Year.
        Parameters:
        year - the year of the values to generate
        Returns:
        a Generator<LocalDate>
      • generateLocalDateForMonth

        public static Generator<java.time.LocalDate> generateLocalDateForMonth​(java.time.YearMonth yearMonth)
        Creates a Generator that yields LocalDates within a specific YearMonth.
        Parameters:
        yearMonth - the year and month of the values to generate
        Returns:
        a Generator<LocalDate>
      • generateLocalTime

        public static Generator<java.time.LocalTime> generateLocalTime()
        Creates a Generator that yields LocalTimes.
        Returns:
        a Generator<LocalTime>
      • generateLocalTime

        public static Generator<java.time.LocalTime> generateLocalTime​(LocalTimeRange range)
        Creates a Generator that yields LocalTimes within a specific range.
        Parameters:
        range - the LocalTimeRange of the values to generate
        Returns:
        a Generator<LocalTime>
      • generateLocalDateTime

        public static Generator<java.time.LocalDateTime> generateLocalDateTime()
        Creates a Generator that yields LocalDateTimes.
        Returns:
        a Generator<LocalDateTime>
      • generateLocalDateTime

        public static Generator<java.time.LocalDateTime> generateLocalDateTime​(LocalDateRange dateRange)
        Creates a Generator that yields LocalDateTimes within a specific date range.
        Parameters:
        dateRange - the LocalDateRange of the values to generate
        Returns:
        a Generator<LocalDateTime>
      • generateLocalDateTime

        public static Generator<java.time.LocalDateTime> generateLocalDateTime​(LocalDateTimeRange range)
        Creates a Generator that yields LocalDateTimes within a specific range.
        Parameters:
        range - the LocalDateTimeRange of the values to generate
        Returns:
        a Generator<LocalDateTime>
      • generateDuration

        public static Generator<java.time.Duration> generateDuration()
        Creates a Generator that yields Durations.
        Returns:
        a Generator<Duration>
      • generateDuration

        public static Generator<java.time.Duration> generateDuration​(DurationRange range)
        Creates a Generator that yields Durations with a specific range.
        Parameters:
        range - the DurationRange of the values to generate
        Returns:
        a Generator<Duration>
      • generateFromSemigroup

        public static <A> Generator<A> generateFromSemigroup​(com.jnape.palatable.lambda.semigroup.Semigroup<A> semigroup,
                                                             Generator<A> gen)
        Creates a Generator that builds its results by generating a random number of values (one or more) and combining them using Semigroup.
        Type Parameters:
        A - the output type
        Parameters:
        semigroup - the Semigroup to apply. May be called zero or more times.
        gen - the Generator of the values to feed through the Semigroup
        Returns:
        a Generator<A>
      • generateNFromSemigroup

        public static <A> Generator<A> generateNFromSemigroup​(com.jnape.palatable.lambda.semigroup.Semigroup<A> semigroup,
                                                              Generator<A> gen,
                                                              int count)
        Creates a Generator that builds its results by generating a specific number of values and combining them using Semigroup.
        Type Parameters:
        A - the output type
        Parameters:
        semigroup - the Semigroup to apply
        gen - the Generator of the values to feed through the Semigroup
        count - the number of elements to feed through the Semigroup; must be >= 1
        Returns:
        a Generator<A>
      • generateFromMonoid

        public static <A> Generator<A> generateFromMonoid​(com.jnape.palatable.lambda.monoid.Monoid<A> monoid,
                                                          Generator<A> gen)
        Creates a Generator that builds its results by generating a random number of values (zero or more) and combining them using Monoid.
        Type Parameters:
        A - the output type
        Parameters:
        monoid - the Monoid to apply. May be called zero or more times.
        gen - the Generator of the values to feed through the Monoid
        Returns:
        a Generator<A>
      • generateNFromMonoid

        public static <A> Generator<A> generateNFromMonoid​(com.jnape.palatable.lambda.monoid.Monoid<A> monoid,
                                                           Generator<A> gen,
                                                           int count)
        Creates a Generator that builds its results by generating a specific number of values and combining them using Monoid.
        Type Parameters:
        A - the output type
        Parameters:
        monoid - the Monoid to apply
        gen - the Generator of the values to feed through the Monoid
        count - the number of elements to feed through the Monoid; must be >= 0
        Returns:
        a Generator<A>
      • generateOrderedPair

        public static <A extends java.lang.Comparable<A>> Generator<com.jnape.palatable.lambda.adt.hlist.Tuple2<A,​A>> generateOrderedPair​(Generator<A> elements)
        Creates a Generator that yields ordered pairs of some Comparable type. The second element of the pair will be greater than or equal to the first element.
        Type Parameters:
        A - the element type - must be Comparable
        Parameters:
        elements - the generator for elements
        Returns:
        a Generator<Tuple2<A, A>>
      • generateOrderedSequence

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> generateOrderedSequence​(Generator<java.lang.Integer> countForEachElement,
                                                                                                             software.kes.collectionviews.ImmutableVector<A> orderedElems)
        Creates a Generator that yields ordered sequences.
        Type Parameters:
        A - the element type
        Parameters:
        countForEachElement - a Generator that determines the count (zero or more) for each element. For each element in orderedElems, this generator is invoked to yield a number, and the element is repeated in the output that number of times before moving on to the next element.
        orderedElems - the ordered sequence of candidates
        Returns:
        a Generator<ImmutableVector<A>>
      • generateOrderedSequence

        public static <A> Generator<software.kes.collectionviews.ImmutableVector<A>> generateOrderedSequence​(IntRange countForEachElementRange,
                                                                                                             software.kes.collectionviews.ImmutableVector<A> orderedElems)
        Creates a Generator that yields ordered sequences.
        Type Parameters:
        A - the element type
        Parameters:
        countForEachElementRange - the IntRange of the count of each element in the output. For each element in orderedElems, a random number in the range is selected, and the element is repeated in the output that number of times before moving on to the next element.
        orderedElems - the ordered sequence of candidates
        Returns:
        a Generator<ImmutableVector<A>>
      • generateIntRange

        public static Generator<IntRange> generateIntRange​(IntRange parentRange)
        Creates a Generator that yields IntRanges, within a specific parent range.
        Parameters:
        parentRange - the IntRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<IntRange>
      • generateLongRange

        public static Generator<LongRange> generateLongRange​(LongRange parentRange)
        Creates a Generator that yields LongRanges, within a specific parent range.
        Parameters:
        parentRange - the LongRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<LongRange>
      • generateShortRange

        public static Generator<ShortRange> generateShortRange​(ShortRange parentRange)
        Creates a Generator that yields ShortRanges, within a specific parent range.
        Parameters:
        parentRange - the ShortRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<ShortRange>
      • generateByteRange

        public static Generator<ByteRange> generateByteRange​(ByteRange parentRange)
        Creates a Generator that yields ByteRanges, within a specific parent range.
        Parameters:
        parentRange - the ByteRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<ByteRange>
      • generateDoubleRange

        public static Generator<DoubleRange> generateDoubleRange​(DoubleRange parentRange)
        Creates a Generator that yields DoubleRanges, within a specific parent range.
        Parameters:
        parentRange - the DoubleRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<DoubleRange>
      • generateFloatRange

        public static Generator<FloatRange> generateFloatRange​(FloatRange parentRange)
        Creates a Generator that yields FloatRanges, within a specific parent range.
        Parameters:
        parentRange - the FloatRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<FloatRange>
      • generateBigIntegerRange

        public static Generator<BigIntegerRange> generateBigIntegerRange​(BigIntegerRange parentRange)
        Creates a Generator that yields BigIntegerRanges, within a specific parent range.
        Parameters:
        parentRange - the BigIntegerRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<BigIntegerRange>
      • generateBigDecimalRange

        public static Generator<BigDecimalRange> generateBigDecimalRange​(BigDecimalRange parentRange)
        Creates a Generator that yields BigDecimalRanges, within a specific parent range.
        Parameters:
        parentRange - the BigDecimalRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<BigDecimalRange>
      • generateLocalDateRange

        public static Generator<LocalDateRange> generateLocalDateRange​(LocalDateRange parentRange)
        Creates a Generator that yields LocalDateRanges, within a specific parent range.
        Parameters:
        parentRange - the LocalDateRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<LocalDateRange>
      • generateLocalTimeRange

        public static Generator<LocalTimeRange> generateLocalTimeRange​(LocalTimeRange parentRange)
        Creates a Generator that yields LocalTimeRanges, within a specific parent range.
        Parameters:
        parentRange - the LocalTimeRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<LocalTimeRange>
      • generateLocalDateTimeRange

        public static Generator<LocalDateTimeRange> generateLocalDateTimeRange​(LocalDateRange parentRange)
        Creates a Generator that yields LocalDateTimeRanges, within a specific parent range.
        Parameters:
        parentRange - the LocalDateRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<LocalDateTimeRange>
      • generateLocalDateTimeRange

        public static Generator<LocalDateTimeRange> generateLocalDateTimeRange​(LocalDateTimeRange parentRange)
        Creates a Generator that yields LocalDateTimeRanges, within a specific parent range.
        Parameters:
        parentRange - the LocalDateTimeRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<LocalDateTimeRange>
      • generateDurationRange

        public static Generator<DurationRange> generateDurationRange​(DurationRange parentRange)
        Creates a Generator that yields DurationRanges, within a specific parent range.
        Parameters:
        parentRange - the DurationRange to restrict the output. The output ranges will either be equal to or fully subsumed by this range.
        Returns:
        a Generator<DurationRange>