001/*
002 * Licensed to the author under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package de.cuioss.test.generator.internal.net.java.quickcheck.generator;
018
019import java.util.Comparator;
020import java.util.Iterator;
021import java.util.List;
022import java.util.Map;
023import java.util.Set;
024
025import de.cuioss.test.generator.internal.net.java.quickcheck.ExtendibleGenerator;
026import de.cuioss.test.generator.internal.net.java.quickcheck.FrequencyGenerator;
027import de.cuioss.test.generator.internal.net.java.quickcheck.Generator;
028import de.cuioss.test.generator.internal.net.java.quickcheck.GeneratorException;
029import de.cuioss.test.generator.internal.net.java.quickcheck.StatefulGenerator;
030import de.cuioss.test.generator.internal.net.java.quickcheck.collection.Pair;
031import de.cuioss.test.generator.internal.net.java.quickcheck.collection.Triple;
032import de.cuioss.test.generator.internal.net.java.quickcheck.generator.distribution.Distribution;
033import de.cuioss.test.generator.internal.net.java.quickcheck.generator.support.ByteArrayGenerator;
034
035/**
036 * {@link CombinedGenerators} can be used to create custom {@link Generator}s.
037 */
038public class CombinedGenerators {
039
040    public static final int DEFAULT_COLLECTION_MAX_SIZE = Generators.DEFAULT_COLLECTION_MAX_SIZE;
041    // TODO this could be a bit high
042    // for runs = 200 this means 20000 tries for the worst case
043    public static final int DEFAULT_MAX_TRIES = Generators.DEFAULT_MAX_TRIES;
044
045    /**
046     * <p>
047     * Create a frequency generator. The frequency of {@link Generator} usage
048     * depends on the generator weight.
049     * </p>
050     *
051     * @param generator pairs of generators and their weights used to created the
052     *                  values
053     * @param <T>       type of values generated by the generators.
054     */
055    public static <T> FrequencyGenerator<T> frequency(Generator<T> generator, int weight) {
056        return Generators.frequency(generator, weight);
057    }
058
059    /**
060     * OneOf is a convenience method for
061     * {@link CombinedGenerators#frequency(Generator, int)} when all generator share
062     * the same weight.
063     */
064    public static <T> ExtendibleGenerator<T, T> oneOf(Generator<T> generator) {
065        return Generators.oneOf(generator);
066    }
067
068    /**
069     * Create a generator which will create vectors (here lists) of type T.
070     *
071     * @param <T>  Type of the list values.
072     * @param size Number of element in the vector.
073     */
074    public static <T> Generator<List<T>> vectors(Generator<T> content, int size) {
075        return Generators.vectors(content, size);
076    }
077
078    /**
079     * Create a generator of pairs of type A for the left value and type B for the
080     * right value.
081     *
082     * @param <A>    Type of left value.
083     * @param <B>    Type of right value.
084     * @param first  Generator for left values.
085     * @param second Generator for right values.
086     */
087    public static <A, B> Generator<Pair<A, B>> pairs(Generator<A> first, Generator<B> second) {
088        return Generators.pairs(first, second);
089    }
090
091    /**
092     * Create a generator of pairs where first value &lt;= second value.
093     *
094     * @param <T>     Type of the pair values.
095     * @param content Generator for content of the pair values.
096     */
097    public static <T extends Comparable<T>> Generator<Pair<T, T>> sortedPairs(Generator<T> content) {
098        return Generators.sortedPairs(content);
099    }
100
101    /**
102     * Create a generator of triples of the types A, B and C for first, second and
103     * third value.
104     *
105     * @param <A>    Type of first value.
106     * @param <B>    Type of second value.
107     * @param <C>    Type of third value.
108     * @param first  Generator for first values.
109     * @param second Generator for second values.
110     * @param third  Generator for third values.
111     */
112    public static <A, B, C> Generator<Triple<A, B, C>> triples(Generator<A> first, Generator<B> second,
113            Generator<C> third) {
114        return Generators.triples(first, second, third);
115    }
116
117    /**
118     * Create a generator return the given values.
119     *
120     * @param <T> Type of the values generated.
121     */
122    @SafeVarargs
123    public static <T> Generator<T> nullsAnd(T... values) {
124        return Generators.nullsAnd(values);
125    }
126
127    /**
128     * Create a generator of triples where first value &lt;= second value &lt;=
129     * third value.
130     *
131     * @param <T>     Type of the triple values.
132     * @param content Generator for content of the triple values.
133     */
134    public static <T extends Comparable<T>> Generator<Triple<T, T, T>> sortedTriple(Generator<T> content) {
135        return Generators.sortedTriple(content);
136    }
137
138    /**
139     * Create a generator as a combination of a null value generator and generator
140     * of type T.
141     *
142     * @param <T> Type of the values generated.
143     */
144    public static <T> Generator<T> nullsAnd(Generator<T> generator) {
145        return Generators.nullsAnd(generator);
146    }
147
148    /**
149     * Create a generator as a combination of a null value generator and generator
150     * of type T.
151     *
152     * @param <T>    Type of the values generated.
153     * @param weight weight of the provided generator
154     */
155    public static <T> Generator<T> nullsAnd(Generator<T> generator, int weight) {
156        return Generators.nullsAnd(generator, weight);
157    }
158
159    /**
160     * Create a generator of sets with values from the content generator.
161     *
162     * @param <T>     type of set elements generated
163     * @param content generator providing the content of sets generated
164     */
165    public static <T> Generator<Set<T>> sets(Generator<? extends T> content) {
166        return Generators.sets(content);
167    }
168
169    /**
170     * Create a generator of sets with values from the content generator.
171     *
172     * @param <T>     type of set elements generated
173     * @param content generator providing the content of sets generated
174     * @param size    size of the sets generated
175     */
176    public static <T> Generator<Set<T>> sets(Generator<? extends T> content, Generator<Integer> size) {
177        return Generators.sets(content, size);
178    }
179
180    /**
181     * Create a generator of sets with values from the content generator. Length is
182     * between high and low.
183     *
184     * @param <T>     type of set elements generated
185     * @param content generator providing the content of sets generated
186     * @param low     minimal size
187     * @param high    max size
188     */
189    public static <T> Generator<Set<T>> sets(Generator<? extends T> content, int low, int high) {
190        return Generators.sets(content, low, high);
191    }
192
193    /**
194     * Create a generator of sets that are not empty.
195     *
196     * @param <T>     type of set elements generated
197     * @param content generator providing the content of sets generated
198     */
199    public static <T> Generator<Set<T>> nonEmptySets(Generator<? extends T> content) {
200        return Generators.nonEmptySets(content);
201    }
202
203    @SafeVarargs
204    public static <T> Generator<Set<T>> sets(T... superset) {
205        return Generators.sets(superset);
206    }
207
208    /**
209     * Create a generator of subsets from a given set.
210     *
211     * @param <T>      type of set elements generated
212     * @param superset of the generated set
213     */
214    public static <T> Generator<Set<T>> sets(Iterable<T> superset) {
215        return Generators.sets(superset);
216    }
217
218    /**
219     * Create a generator of subsets from a given set.
220     *
221     * @param <T>      type of set elements generated
222     * @param superset of the generated set
223     * @param size     of the generated set
224     */
225    public static <T> Generator<Set<T>> sets(Iterable<T> superset, Generator<Integer> size) {
226        return Generators.sets(superset, size);
227    }
228
229    /**
230     * Create a generator that produces lists of duplicates.
231     *
232     * @return a list derived from the input values. At least one input value is
233     *         more than once in the resulting list.
234     */
235    @SafeVarargs
236    public static <T> Generator<List<T>> duplicates(T... input) {
237        return Generators.duplicates(input);
238    }
239
240    /**
241     * Create a generator that produces lists of duplicates.
242     *
243     * @return a list derived from the input values. At least one input value is
244     *         more than once in the resulting list.
245     */
246    public static <T> Generator<List<T>> duplicates(Iterable<T> input) {
247        return Generators.duplicates(input);
248    }
249
250    /**
251     * Create a generator of iterators.
252     *
253     * <p>
254     * Values of the elements will be taken from the content generator.
255     * </p>
256     *
257     * @param <T>     type of iterator elements generated
258     * @param content generator providing the content of iterators generated
259     */
260    public static <T> Generator<Iterator<T>> iterators(Generator<? extends T> content) {
261        return Generators.iterators(content);
262    }
263
264    /**
265     * Create a generator of iterators.
266     *
267     * <p>
268     * Values of the elements will be taken from the content generator. The
269     * generated iterator will have at least one element.
270     * </p>
271     *
272     * @param <T>     type of iterator elements generated
273     * @param content generator providing the content of iterators generated
274     */
275    public static <T> Generator<Iterator<T>> nonEmptyIterators(Generator<T> content) {
276        return Generators.nonEmptyIterators(content);
277    }
278
279    /**
280     * Create a generator of iterators.
281     *
282     * <p>
283     * Values of the elements will be taken from the content generator. The length
284     * of the iterators will be determined with the size generator.
285     * </p>
286     *
287     * @param <T>     type of iterator elements generated
288     * @param content generator providing the content of iterators generated
289     * @param size    used to determine the number of elements of the iterator
290     */
291    public static <T> Generator<Iterator<T>> iterators(Generator<? extends T> content, Generator<Integer> size) {
292        return Generators.iterators(content, size);
293    }
294
295    /**
296     * Create a generator of lists with values from the content generator. Length
297     * values of lists generated will be created with {@link Distribution#UNIFORM}.
298     *
299     * @param <T>     type of list elements generated
300     * @param content generator providing the content of lists generated
301     */
302    public static <T> Generator<List<T>> lists(Generator<? extends T> content) {
303        return Generators.lists(content);
304    }
305
306    /**
307     * Create a generator of non-empty lists with values from the content generator.
308     * Length values of lists generated will be created with
309     * {@link Distribution#UNIFORM}.
310     *
311     * @param <T>     type of list elements generated
312     * @param content generator providing the content of lists generated
313     */
314    public static <T> Generator<List<T>> nonEmptyLists(Generator<? extends T> content) {
315        return Generators.nonEmptyLists(content);
316    }
317
318    /**
319     * Create a generator of lists with values from the content generator. Length
320     * values of lists generated will be created with size generator.
321     *
322     * @param <T>     type of list elements generated
323     * @param content generator providing the content of lists generated
324     * @param size    integer used to determine the list size
325     */
326    public static <T> Generator<List<T>> lists(Generator<? extends T> content, Generator<Integer> size) {
327        return Generators.lists(content, size);
328    }
329
330    /**
331     * Create a generator of lists with values from the content generator. Length is
332     * between high and low.
333     *
334     * @param <T>     type of list elements generated
335     * @param content generator providing the content of lists generated
336     * @param low     minimal size
337     * @param high    max size
338     */
339    public static <T> Generator<List<T>> lists(Generator<? extends T> content, int low, int high) {
340        return Generators.lists(content, low, high);
341    }
342
343    /**
344     * Create a generator of lists with values from the content generator. Length is
345     * at least low.
346     *
347     * @param <T>     type of list elements generated
348     * @param content generator providing the content of lists generated
349     * @param low     minimal size. If low is larger than
350     *                {@link CombinedGenerators#DEFAULT_COLLECTION_MAX_SIZE} then it
351     *                is the upper size bound as well.
352     */
353    public static <T> Generator<List<T>> lists(Generator<? extends T> content, int low) {
354        return Generators.lists(content, low);
355    }
356
357    /**
358     * Create a generator of sorted lists with values from the content generator.
359     *
360     * @param <T>     type of list elements generated
361     * @param content generator providing the content of lists generated
362     */
363    public static <T extends Comparable<T>> Generator<List<T>> sortedLists(Generator<T> content) {
364        return Generators.sortedLists(content);
365
366    }
367
368    /**
369     * Create a generator of sorted lists with values from the content generator.
370     * Length is between high and low.
371     *
372     * @param <T>     type of list elements generated
373     * @param content generator providing the content of lists generated
374     * @param low     minimal size
375     * @param high    max size
376     */
377    public static <T extends Comparable<T>> Generator<List<T>> sortedLists(Generator<T> content, int low, int high) {
378        return Generators.sortedLists(content, low, high);
379
380    }
381
382    /**
383     * Create a generator of sorted lists with values from the content generator.
384     * Length is between high and low.
385     *
386     * @param <T>     type of list elements generated
387     * @param content generator providing the content of lists generated
388     * @param size    integer used to determine the list size
389     */
390    public static <T extends Comparable<T>> Generator<List<T>> sortedLists(Generator<T> content,
391            Generator<Integer> size) {
392        return Generators.sortedLists(content, size);
393    }
394
395    /**
396     * Create a generator of arrays with values from the content generator. Length
397     * values of array generated will be created with {@link Distribution#UNIFORM}.
398     *
399     * @param <T>     type of arrays elements generated
400     * @param content generator providing the content of arrays generated
401     * @param type    type of arrays generated
402     */
403    public static <T> Generator<T[]> arrays(Generator<? extends T> content, Class<T> type) {
404        return Generators.arrays(content, type);
405    }
406
407    /**
408     * Create a generator of arrays that are not empty.
409     *
410     * @param <T>     type of arrays elements generated
411     * @param content generator providing the content of arrays generated
412     * @param type    type of arrays generated
413     */
414    public static <T> Generator<T[]> nonEmptyArrays(Generator<? extends T> content, Class<T> type) {
415        return Generators.nonEmptyArrays(content, type);
416    }
417
418    /**
419     * Create a generator of arrays with values from the content generator. Length
420     * values of arrays generated will be created with size generator.
421     *
422     * @param <T>     type of arrays elements generated
423     * @param content generator providing the content of arrays generated
424     * @param size    integer used to determine the array size
425     * @param type    type of arrays generated
426     */
427    public static <T> Generator<T[]> arrays(Generator<? extends T> content, Generator<Integer> size, Class<T> type) {
428        return Generators.arrays(content, size, type);
429    }
430
431    /**
432     * Create a generator of byte arrays. The length of arrays generated will be
433     * determined by the {@link ByteArrayGenerator#MIN_SIZE} and
434     * {@link ByteArrayGenerator#MAX_SIZE} constants.
435     *
436     */
437    public static Generator<byte[]> byteArrays() {
438        return Generators.byteArrays();
439    }
440
441    /**
442     * Create a generator of byte arrays. Length values of arrays generated will be
443     * created with size generator.
444     *
445     * @param size integer used to determine the array size
446     */
447    public static Generator<byte[]> byteArrays(Generator<Integer> size) {
448        return Generators.byteArrays(size);
449    }
450
451    /**
452     * Create a generator of byte arrays. Length values of arrays generated will be
453     * created with size generator.
454     *
455     * @param size    integer used to determine the array size
456     * @param content generator for the byte array content
457     */
458    public static Generator<byte[]> byteArrays(Generator<Byte> content, Generator<Integer> size) {
459        return Generators.byteArrays(content, size);
460    }
461
462    /**
463     * Create a generator of integer arrays.
464     *
465     */
466    public static Generator<int[]> intArrays() {
467        return Generators.intArrays();
468    }
469
470    /**
471     * Create a generator of integer arrays. Length values of arrays generated will
472     * be created with size generator.
473     *
474     * @param size integer used to determine the array size
475     */
476    public static Generator<int[]> intArrays(Generator<Integer> size) {
477        return Generators.intArrays(size);
478    }
479
480    /**
481     * Create a generator of integer arrays. Length values of arrays generated will
482     * be created with size generator.
483     *
484     * @param size    integer used to determine the array size
485     * @param content generator for the integer array content
486     */
487    public static Generator<int[]> intArrays(Generator<Integer> content, Generator<Integer> size) {
488        return Generators.intArrays(content, size);
489    }
490
491    /**
492     * Create a generator of {@link Map maps}.
493     *
494     * <p>
495     * This is a generator for simple maps where the values are not related to the
496     * keys.
497     * </p>
498     *
499     * @param keys   {@link Generator} for the keys of the map
500     * @param values {@link Generator} for the values of the map
501     */
502    public static <K, V> Generator<Map<K, V>> maps(Generator<K> keys, Generator<V> values) {
503        return Generators.maps(keys, values);
504    }
505
506    /**
507     * Create a generator of {@link Map maps}.
508     *
509     * <p>
510     * This is a generator for simple maps where the values are not related to the
511     * keys.
512     * </p>
513     *
514     * @param keys   {@link Generator} for the keys of the map
515     * @param values {@link Generator} for the values of the map
516     * @param size   integer used to determine the size of the generated map
517     */
518    public static <K, V> Generator<Map<K, V>> maps(Generator<K> keys, Generator<V> values, Generator<Integer> size) {
519        return Generators.maps(keys, values, size);
520    }
521
522    /**
523     * Create a generator of maps from a given map.
524     *
525     * <p>
526     * The entry set of the generated maps are subsets of the given map's entry set.
527     * </p>
528     * 
529     * @param supermap of the generated maps
530     */
531    public static <K, V> Generator<Map<K, V>> maps(Map<K, V> supermap) {
532        return Generators.maps(supermap);
533    }
534
535    /**
536     * Create a generator of maps from a given map.
537     *
538     * <p>
539     * The entry set of the generated maps are subsets of the given map's entry set.
540     * </p>
541     *
542     * @param supermap of the generated maps
543     * @param sizes    of the generated maps
544     */
545    public static <K, V> Generator<Map<K, V>> maps(Map<K, V> supermap, Generator<Integer> sizes) {
546        return Generators.maps(supermap, sizes);
547    }
548
549    /**
550     * Create a deterministic generator which guarantees that all values from the
551     * ensuredValues collection will be return {@link Generator#next()} are issued
552     * (i.e. ensuredValues.size() &lt;= # of runs). The order of values is
553     * undefined.
554     *
555     * @param <T> type of values return
556     */
557    public static <T> StatefulGenerator<T> ensureValues(Iterable<T> ensuredValues) {
558        return Generators.ensureValues(ensuredValues);
559    }
560
561    /**
562     * Create a deterministic generator which guarantees that all values from the
563     * ensuredValues array will be return {@link Generator#next()} are issued (i.e.
564     * ensuredValues.size() &lt;= # of runs). The order of values is undefined.
565     *
566     * @param <T> type of values return
567     */
568    @SafeVarargs
569    public static <T> StatefulGenerator<T> ensureValues(T... content) {
570        return Generators.ensureValues(content);
571    }
572
573    /**
574     * <p>
575     * Create a deterministic generator which guarantees that all values from the
576     * ensuredValues collection will be return {@link Generator#next()} are issued
577     * (i.e. ensuredValues.size() &lt;= # of runs). The order of values is
578     * undefined.
579     * </p>
580     * <p>
581     * If all values of ensuredValues are generated calls to
582     * {@link Generator#next()} will return generator.
583     * </p>
584     *
585     * @param <T> type of values return
586     */
587    public static <T> StatefulGenerator<T> ensureValues(Iterable<T> ensuredValues, Generator<T> otherValues) {
588        return Generators.ensureValues(ensuredValues, otherValues);
589    }
590
591    /**
592     * <p>
593     * Create a generator which guarantees that all values from the ensuredValues
594     * will be return {@link Generator#next()} are issued.
595     * </p>
596     * <p>
597     * The order of values is undefined. All other values in the window and after
598     * the window are taken from the {@link Generator generator otherValues}.
599     * </p>
600     *
601     * @param <T>    type of values return
602     * @param window After window number of calls to {@link Generator#next()} it is
603     *               guaranteed that all ensured values were return
604     */
605    public static <T> StatefulGenerator<T> ensureValues(Iterable<T> ensuredValues, int window,
606            Generator<T> otherValues) {
607        return Generators.ensureValues(ensuredValues, window, otherValues);
608    }
609
610    /**
611     * <p>
612     * Create a generator that ensures unique values.
613     * </p>
614     * <p>
615     * The actual values are created with an arbitrary generator.
616     * </p>
617     * <p>
618     * Note: unique generator depends on valid implementation of equals and hashCode
619     * method of the content type generated.
620     * </p>
621     *
622     * @param <T>       type of values return
623     * @param generator used to create the raw values. This generator can create
624     *                  duplicate values
625     * @param tries     Number of tries to create a new unique value. After this
626     *                  number of tries is exceeded the generation aborts with a
627     *                  {@link GeneratorException}.
628     * @return unique generator instance
629     */
630    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator, int tries) {
631        return Generators.uniqueValues(generator, tries);
632    }
633
634    /**
635     * <p>
636     * Create a generator that ensures unique values.
637     * </p>
638     * <p>
639     * The actual values are created with an arbitrary generator.
640     * </p>
641     * <p>
642     * Unique generator depends on the {@link Comparator} implementation to decide
643     * if two instances are the same (i.e. when the comparator return for
644     * {@link Comparator#compare(Object, Object)}).
645     * </p>
646     *
647     * @param <T>        type of values return
648     * @param generator  used to create the raw values. This generator can create
649     *                   duplicate values
650     * @param comparator that decides if two values are of the same equivalence
651     *                   class.
652     * @param tries      Number of tries to create a new unique value. After this
653     *                   number of tries is exceeded the generation aborts with a
654     *                   {@link GeneratorException}.
655     * @return unique generator instance
656     */
657    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator, Comparator<? super T> comparator,
658            int tries) {
659        return Generators.uniqueValues(generator, comparator, tries);
660    }
661
662    /**
663     * <p>
664     * Create a generator that ensures unique values.
665     * </p>
666     * <p>
667     * The actual values are created with an arbitrary generator.
668     * </p>
669     * <p>
670     * Unique generator depends on the {@link Comparator} implementation to decide
671     * if two instances are the same (i.e. when the comparator return for
672     * {@link Comparator#compare(Object, Object)}).
673     * </p>
674     *
675     * @param <T>        type of values return
676     * @param generator  used to create the raw values. This generator can create
677     *                   duplicate values
678     * @param comparator that decides if two values are of the same equivalence
679     *                   class.
680     * @return unique generator instance
681     */
682    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator, Comparator<? super T> comparator) {
683        return Generators.uniqueValues(generator, comparator);
684    }
685
686    /**
687     * <p>
688     * Create a generator that ensures unique values
689     * </p>
690     * <p>
691     * The actual values are created with an arbitrary generator.
692     * </p>
693     * <p>
694     * Note: unique generator depends on valid implementation of equals and hashCode
695     * method of the content type generated.
696     * </p>
697     *
698     * @param <T>       type of values return
699     * @param generator used to create the raw values. This generator can create
700     *                  duplicate values
701     * @return unique generator instance
702     */
703    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator) {
704        return Generators.uniqueValues(generator);
705    }
706
707    /**
708     * Create a generator that omits a given set of values.
709     *
710     * @param generator used to create the raw values.
711     * @param excluded  values. These values will not be return
712     */
713    @SafeVarargs
714    public static <T> Generator<T> excludeValues(Generator<T> generator, T... excluded) {
715        return Generators.excludeValues(generator, excluded);
716    }
717
718    /**
719     * Create a generator that omits a given set of values.
720     *
721     * @param values   of generator
722     * @param excluded values. These values will not be return
723     */
724    @SafeVarargs
725    public static <T> Generator<T> excludeValues(Iterable<T> values, T... excluded) {
726        return Generators.excludeValues(values, excluded);
727    }
728
729    /**
730     * Create a generator that omits a given set of values.
731     *
732     * @param values   of generator
733     * @param excluded values. These values will not be return
734     */
735    public static <T> Generator<T> excludeValues(Iterable<T> values, Iterable<T> excluded) {
736        return Generators.excludeValues(values, excluded);
737    }
738
739    /**
740     * Create a generator that omits a given set of values.
741     *
742     * @param generator used to create the raw values.
743     * @param excluded  values. These values will not be return
744     */
745    public static <T> Generator<T> excludeValues(Generator<T> generator, Iterable<T> excluded) {
746        return Generators.excludeValues(generator, excluded);
747    }
748
749    /**
750     * A generator for a lists. The values in the lists are strictly increasing.
751     * <p>
752     * For every element x in the list: x(n) &lt; x(n+1).
753     * </p>
754     *
755     * @param input values generator
756     */
757    public static <T extends Comparable<T>> Generator<List<T>> strictlyOrdered(Generator<T> input) {
758        return Generators.strictlyOrdered(input);
759    }
760
761    /**
762     * A generator for a lists. The values in the lists are strictly increasing.
763     *
764     * <p>
765     * For every element x in the list: x(n) &lt; x(n+1).
766     * </p>
767     *
768     * @param input values generator
769     * @param low   minimum size of the lists
770     * @param high  maximum size of the lists
771     */
772    public static <T extends Comparable<T>> Generator<List<T>> strictlyOrdered(Generator<T> input, int low, int high) {
773        return Generators.strictlyOrdered(input, low, high);
774    }
775
776    /**
777     * A generator for a lists. The values in the lists are strictly increasing.
778     * <p>
779     * For every element x in the list: x(n) &lt; x(n+1).
780     * </p>
781     * <p>
782     * This {@link Generator} can be used to generate a list of strictly decreasing
783     * values:
784     * {@code CombinedGenerators.strictlyOrdered(ts, Collections.&lt;T&gt; reverseOrder());}
785     * </p>
786     *
787     *
788     * @param input      values generator
789     * @param comparator that orders the values
790     */
791    public static <T> Generator<List<T>> strictlyOrdered(Generator<T> input, Comparator<T> comparator) {
792        return Generators.strictlyOrdered(input, comparator);
793    }
794
795    /**
796     * A generator for a lists. The values in the lists are strictly increasing.
797     * <p>
798     * For every element x in the list: x(n) &lt; x(n+1).
799     * </p>
800     *
801     * @param input      values generator
802     * @param comparator that orders the values
803     * @param size       of the resulting lists
804     */
805    public static <T> Generator<List<T>> strictlyOrdered(Generator<T> input, Comparator<T> comparator,
806            Generator<Integer> size) {
807        return Generators.strictlyOrdered(input, comparator, size);
808    }
809}