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
052     *            pairs of generators and their weights used to created the
053     *            values
054     * @param <T>
055     *            type of values generated by the generators.
056     */
057    public static <T> FrequencyGenerator<T> frequency(Generator<T> generator,
058            int weight) {
059        return Generators.frequency(generator, weight);
060    }
061
062    /**
063     * OneOf is a convenience method for
064     * {@link CombinedGenerators#frequency(Generator, int)} when all generator
065     * share the same weight.
066     */
067    public static <T> ExtendibleGenerator<T, T> oneOf(Generator<T> generator) {
068        return Generators.oneOf(generator);
069    }
070
071    /**
072     * Create a generator which will create vectors (here lists) of type T.
073     *
074     * @param <T>
075     *            Type of the list values.
076     * @param size
077     *            Number of element in the vector.
078     */
079    public static <T> Generator<List<T>> vectors(Generator<T> content, int size) {
080        return Generators.vectors(content, size);
081    }
082
083    /**
084     * Create a generator of pairs of type A for the left value and type B for
085     * the right value.
086     *
087     * @param <A>
088     *            Type of left value.
089     * @param <B>
090     *            Type of right value.
091     * @param first
092     *            Generator for left values.
093     * @param second
094     *            Generator for right values.
095     */
096    public static <A, B> Generator<Pair<A, B>> pairs(Generator<A> first, Generator<B> second) {
097        return Generators.pairs(first, second);
098    }
099
100    /**
101     * Create a generator of pairs where first value &lt;= second value.
102     *
103     * @param <T>
104     *            Type of the pair values.
105     * @param content
106     *            Generator for content of the pair values.
107     */
108    public static <T extends Comparable<T>> Generator<Pair<T, T>> sortedPairs(Generator<T> content) {
109        return Generators.sortedPairs(content);
110    }
111
112    /**
113     * Create a generator of triples of the types A, B and C for first, second
114     * and third value.
115     *
116     * @param <A>
117     *            Type of first value.
118     * @param <B>
119     *            Type of second value.
120     * @param <C>
121     *            Type of third value.
122     * @param first
123     *            Generator for first values.
124     * @param second
125     *            Generator for second values.
126     * @param third
127     *            Generator for third values.
128     */
129    public static <A, B, C> Generator<Triple<A, B, C>> triples(Generator<A> first, Generator<B> second,
130            Generator<C> third) {
131        return Generators.triples(first, second, third);
132    }
133
134    /**
135     * Create a generator return
136     * the given values.
137     *
138     * @param <T>
139     *            Type of the values generated.
140     */
141    @SafeVarargs
142    public static <T> Generator<T> nullsAnd(T... values) {
143        return Generators.nullsAnd(values);
144    }
145
146    /**
147     * Create a generator of triples where first value &lt;= second value &lt;= third value.
148     *
149     * @param <T>
150     *            Type of the triple values.
151     * @param content
152     *            Generator for content of the triple values.
153     */
154    public static <T extends Comparable<T>> Generator<Triple<T, T, T>> sortedTriple(Generator<T> content) {
155        return Generators.sortedTriple(content);
156    }
157
158    /**
159     * Create a generator as a combination of a null value generator and
160     * generator of type T.
161     *
162     * @param <T>
163     *            Type of the values generated.
164     */
165    public static <T> Generator<T> nullsAnd(Generator<T> generator) {
166        return Generators.nullsAnd(generator);
167    }
168
169    /**
170     * Create a generator as a combination of a null value generator and
171     * generator of type T.
172     *
173     * @param <T>
174     *            Type of the values generated.
175     * @param weight
176     *            weight of the provided generator
177     */
178    public static <T> Generator<T> nullsAnd(Generator<T> generator, int weight) {
179        return Generators.nullsAnd(generator, weight);
180    }
181
182    /**
183     * Create a generator of sets with values from the content generator.
184     *
185     * @param <T>
186     *            type of set elements generated
187     * @param content
188     *            generator providing the content of sets generated
189     */
190    public static <T> Generator<Set<T>> sets(Generator<? extends T> content) {
191        return Generators.sets(content);
192    }
193
194    /**
195     * Create a generator of sets with values from the content generator.
196     *
197     * @param <T>
198     *            type of set elements generated
199     * @param content
200     *            generator providing the content of sets generated
201     * @param size
202     *            size of the sets generated
203     */
204    public static <T> Generator<Set<T>> sets(Generator<? extends T> content,
205            Generator<Integer> size) {
206        return Generators.sets(content, size);
207    }
208
209    /**
210     * Create a generator of sets with values from the content generator. Length
211     * is between high and low.
212     *
213     * @param <T>
214     *            type of set elements generated
215     * @param content
216     *            generator providing the content of sets generated
217     * @param low
218     *            minimal size
219     * @param high
220     *            max size
221     */
222    public static <T> Generator<Set<T>> sets(Generator<? extends T> content, int low,
223            int high) {
224        return Generators.sets(content, low, high);
225    }
226
227    /**
228     * Create a generator of sets that are not empty.
229     *
230     * @param <T>
231     *            type of set elements generated
232     * @param content
233     *            generator providing the content of sets generated
234     */
235    public static <T> Generator<Set<T>> nonEmptySets(Generator<? extends T> content) {
236        return Generators.nonEmptySets(content);
237    }
238
239    @SafeVarargs
240    public static <T> Generator<Set<T>> sets(T... superset) {
241        return Generators.sets(superset);
242    }
243
244    /**
245     * Create a generator of subsets from a given set.
246     *
247     * @param <T>
248     *            type of set elements generated
249     * @param superset
250     *            of the generated set
251     */
252    public static <T> Generator<Set<T>> sets(Iterable<T> superset) {
253        return Generators.sets(superset);
254    }
255
256    /**
257     * Create a generator of subsets from a given set.
258     *
259     * @param <T>
260     *            type of set elements generated
261     * @param superset
262     *            of the generated set
263     * @param size
264     *            of the generated set
265     */
266    public static <T> Generator<Set<T>> sets(Iterable<T> superset, Generator<Integer> size) {
267        return Generators.sets(superset, size);
268    }
269
270    /**
271     * Create a generator that produces lists of duplicates.
272     *
273     * @return a list derived from the input values. At least one input value is
274     *         more than once in the resulting list.
275     */
276    @SafeVarargs
277    public static <T> Generator<List<T>> duplicates(T... input) {
278        return Generators.duplicates(input);
279    }
280
281    /**
282     * Create a generator that produces lists of duplicates.
283     *
284     * @return a list derived from the input values. At least one input value is
285     *         more than once in the resulting list.
286     */
287    public static <T> Generator<List<T>> duplicates(Iterable<T> input) {
288        return Generators.duplicates(input);
289    }
290
291    /**
292     * Create a generator of iterators.
293     *
294     * <p>
295     * Values of the elements will be taken from the content generator.
296     * </p>
297     *
298     * @param <T>
299     *            type of iterator elements generated
300     * @param content
301     *            generator providing the content of iterators generated
302     */
303    public static <T> Generator<Iterator<T>> iterators(Generator<? extends T> content) {
304        return Generators.iterators(content);
305    }
306
307    /**
308     * Create a generator of iterators.
309     *
310     * <p>
311     * Values of the elements will be taken from the content generator. The
312     * generated iterator will have at least one element.
313     * </p>
314     *
315     * @param <T>
316     *            type of iterator elements generated
317     * @param content
318     *            generator providing the content of iterators generated
319     */
320    public static <T> Generator<Iterator<T>> nonEmptyIterators(
321            Generator<T> content) {
322        return Generators.nonEmptyIterators(content);
323    }
324
325    /**
326     * Create a generator of iterators.
327     *
328     * <p>
329     * Values of the elements will be taken from the content generator. The
330     * length of the iterators will be determined with the size generator.
331     * </p>
332     *
333     * @param <T>
334     *            type of iterator elements generated
335     * @param content
336     *            generator providing the content of iterators generated
337     * @param size
338     *            used to determine the number of elements of the iterator
339     */
340    public static <T> Generator<Iterator<T>> iterators(Generator<? extends T> content,
341            Generator<Integer> size) {
342        return Generators.iterators(content, size);
343    }
344
345    /**
346     * Create a generator of lists with values from the content generator.
347     * Length values of lists generated will be created with
348     * {@link Distribution#UNIFORM}.
349     *
350     * @param <T>
351     *            type of list elements generated
352     * @param content
353     *            generator providing the content of lists generated
354     */
355    public static <T> Generator<List<T>> lists(Generator<? extends T> content) {
356        return Generators.lists(content);
357    }
358
359    /**
360     * Create a generator of non-empty lists with values from the content
361     * generator. Length values of lists generated will be created with
362     * {@link Distribution#UNIFORM}.
363     *
364     * @param <T>
365     *            type of list elements generated
366     * @param content
367     *            generator providing the content of lists generated
368     */
369    public static <T> Generator<List<T>> nonEmptyLists(Generator<? extends T> content) {
370        return Generators.nonEmptyLists(content);
371    }
372
373    /**
374     * Create a generator of lists with values from the content generator.
375     * Length values of lists generated will be created with size generator.
376     *
377     * @param <T>
378     *            type of list elements generated
379     * @param content
380     *            generator providing the content of lists generated
381     * @param size
382     *            integer used to determine the list size
383     */
384    public static <T> Generator<List<T>> lists(Generator<? extends T> content,
385            Generator<Integer> size) {
386        return Generators.lists(content, size);
387    }
388
389    /**
390     * Create a generator of lists with values from the content generator.
391     * Length is between high and low.
392     *
393     * @param <T>
394     *            type of list elements generated
395     * @param content
396     *            generator providing the content of lists generated
397     * @param low
398     *            minimal size
399     * @param high
400     *            max size
401     */
402    public static <T> Generator<List<T>> lists(Generator<? extends T> content, int low,
403            int high) {
404        return Generators.lists(content, low, high);
405    }
406
407    /**
408     * Create a generator of lists with values from the content generator.
409     * Length is at least low.
410     *
411     * @param <T>
412     *            type of list elements generated
413     * @param content
414     *            generator providing the content of lists generated
415     * @param low
416     *            minimal size. If low is larger than
417     *            {@link CombinedGenerators#DEFAULT_COLLECTION_MAX_SIZE} then it
418     *            is the upper size bound as well.
419     */
420    public static <T> Generator<List<T>> lists(Generator<? extends T> content, int low) {
421        return Generators.lists(content, low);
422    }
423
424    /**
425     * Create a generator of sorted lists with values from the content
426     * generator.
427     *
428     * @param <T>
429     *            type of list elements generated
430     * @param content
431     *            generator providing the content of lists generated
432     */
433    public static <T extends Comparable<T>> Generator<List<T>> sortedLists(
434            Generator<T> content) {
435        return Generators.sortedLists(content);
436
437    }
438
439    /**
440     * Create a generator of sorted lists with values from the content
441     * generator. Length is between high and low.
442     *
443     * @param <T>
444     *            type of list elements generated
445     * @param content
446     *            generator providing the content of lists generated
447     * @param low
448     *            minimal size
449     * @param high
450     *            max size
451     */
452    public static <T extends Comparable<T>> Generator<List<T>> sortedLists(
453            Generator<T> content, int low, int high) {
454        return Generators.sortedLists(content, low, high);
455
456    }
457
458    /**
459     * Create a generator of sorted lists with values from the content
460     * generator. Length is between high and low.
461     *
462     * @param <T>
463     *            type of list elements generated
464     * @param content
465     *            generator providing the content of lists generated
466     * @param size
467     *            integer used to determine the list size
468     */
469    public static <T extends Comparable<T>> Generator<List<T>> sortedLists(
470            Generator<T> content, Generator<Integer> size) {
471        return Generators.sortedLists(content, size);
472    }
473
474    /**
475     * Create a generator of arrays with values from the content generator.
476     * Length values of array generated will be created with
477     * {@link Distribution#UNIFORM}.
478     *
479     * @param <T>
480     *            type of arrays elements generated
481     * @param content
482     *            generator providing the content of arrays generated
483     * @param type
484     *            type of arrays generated
485     */
486    public static <T> Generator<T[]> arrays(Generator<? extends T> content, Class<T> type) {
487        return Generators.arrays(content, type);
488    }
489
490    /**
491     * Create a generator of arrays that are not empty.
492     *
493     * @param <T>
494     *            type of arrays elements generated
495     * @param content
496     *            generator providing the content of arrays generated
497     * @param type
498     *            type of arrays generated
499     */
500    public static <T> Generator<T[]> nonEmptyArrays(Generator<? extends T> content,
501            Class<T> type) {
502        return Generators.nonEmptyArrays(content, type);
503    }
504
505    /**
506     * Create a generator of arrays with values from the content generator.
507     * Length values of arrays generated will be created with size generator.
508     *
509     * @param <T>
510     *            type of arrays elements generated
511     * @param content
512     *            generator providing the content of arrays generated
513     * @param size
514     *            integer used to determine the array size
515     * @param type
516     *            type of arrays generated
517     */
518    public static <T> Generator<T[]> arrays(Generator<? extends T> content,
519            Generator<Integer> size, Class<T> type) {
520        return Generators.arrays(content, size, type);
521    }
522
523    /**
524     * Create a generator of byte arrays. The length of arrays generated will be
525     * determined by the {@link ByteArrayGenerator#MIN_SIZE} and
526     * {@link ByteArrayGenerator#MAX_SIZE} constants.
527     *
528     */
529    public static Generator<byte[]> byteArrays() {
530        return Generators.byteArrays();
531    }
532
533    /**
534     * Create a generator of byte arrays. Length values of arrays generated will
535     * be created with size generator.
536     *
537     * @param size
538     *            integer used to determine the array size
539     */
540    public static Generator<byte[]> byteArrays(Generator<Integer> size) {
541        return Generators.byteArrays(size);
542    }
543
544    /**
545     * Create a generator of byte arrays. Length values of arrays generated will
546     * be created with size generator.
547     *
548     * @param size
549     *            integer used to determine the array size
550     * @param content
551     *            generator for the byte array content
552     */
553    public static Generator<byte[]> byteArrays(Generator<Byte> content,
554            Generator<Integer> size) {
555        return Generators.byteArrays(content, size);
556    }
557
558    /**
559     * Create a generator of integer arrays.
560     *
561     */
562    public static Generator<int[]> intArrays() {
563        return Generators.intArrays();
564    }
565
566    /**
567     * Create a generator of integer arrays. Length values of arrays generated
568     * will be created with size generator.
569     *
570     * @param size
571     *            integer used to determine the array size
572     */
573    public static Generator<int[]> intArrays(Generator<Integer> size) {
574        return Generators.intArrays(size);
575    }
576
577    /**
578     * Create a generator of integer arrays. Length values of arrays generated
579     * will be created with size generator.
580     *
581     * @param size
582     *            integer used to determine the array size
583     * @param content
584     *            generator for the integer array content
585     */
586    public static Generator<int[]> intArrays(Generator<Integer> content,
587            Generator<Integer> size) {
588        return Generators.intArrays(content, size);
589    }
590
591    /**
592     * Create a generator of {@link Map maps}.
593     *
594     * <p>
595     * This is a generator for simple maps where the values are not related to the keys.
596     * </p>
597     *
598     * @param keys
599     *            {@link Generator} for the keys of the map
600     * @param values
601     *            {@link Generator} for the values of the map
602     */
603    public static <K, V> Generator<Map<K, V>> maps(Generator<K> keys, Generator<V> values) {
604        return Generators.maps(keys, values);
605    }
606
607    /**
608     * Create a generator of {@link Map maps}.
609     *
610     * <p>
611     * This is a generator for simple maps where the values are not related to the keys.
612     * </p>
613     *
614     * @param keys
615     *            {@link Generator} for the keys of the map
616     * @param values
617     *            {@link Generator} for the values of the map
618     * @param size
619     *            integer used to determine the size of the generated map
620     */
621    public static <K, V> Generator<Map<K, V>> maps(Generator<K> keys, Generator<V> values, Generator<Integer> size) {
622        return Generators.maps(keys, values, size);
623    }
624
625    /**
626     * Create a generator of maps from a given map.
627     *
628     * <p>
629     * The entry set of the generated maps are subsets of the given map's entry set.
630     * </p>
631     * 
632     * @param supermap of the generated maps
633     */
634    public static <K, V> Generator<Map<K, V>> maps(Map<K, V> supermap) {
635        return Generators.maps(supermap);
636    }
637
638    /**
639     * Create a generator of maps from a given map.
640     *
641     * <p>
642     * The entry set of the generated maps are subsets of the given map's entry set.
643     * </p>
644     *
645     * @param supermap of the generated maps
646     * @param sizes of the generated maps
647     */
648    public static <K, V> Generator<Map<K, V>> maps(Map<K, V> supermap, Generator<Integer> sizes) {
649        return Generators.maps(supermap, sizes);
650    }
651
652    /**
653     * Create a deterministic generator which guarantees that all values from
654     * the ensuredValues collection will be return
655     * {@link Generator#next()} are issued (i.e. ensuredValues.size() &lt;= # of
656     * runs). The order of values is undefined.
657     *
658     * @param <T> type of values return
659     */
660    public static <T> StatefulGenerator<T> ensureValues(Iterable<T> ensuredValues) {
661        return Generators.ensureValues(ensuredValues);
662    }
663
664    /**
665     * Create a deterministic generator which guarantees that all values from
666     * the ensuredValues array will be return
667     * {@link Generator#next()} are issued (i.e. ensuredValues.size() &lt;= # of
668     * runs). The order of values is undefined.
669     *
670     * @param <T>
671     *            type of values return
672     */
673    @SafeVarargs
674    public static <T> StatefulGenerator<T> ensureValues(T... content) {
675        return Generators.ensureValues(content);
676    }
677
678    /**
679     * <p>
680     * Create a deterministic generator which guarantees that all values from
681     * the ensuredValues collection will be return
682     * {@link Generator#next()} are issued (i.e. ensuredValues.size() &lt;= # of
683     * runs). The order of values is undefined.
684     * </p>
685     * <p>
686     * If all values of ensuredValues are generated calls to
687     * {@link Generator#next()} will return generator.
688     * </p>
689     *
690     * @param <T>
691     *            type of values return
692     */
693    public static <T> StatefulGenerator<T> ensureValues(
694            Iterable<T> ensuredValues, Generator<T> otherValues) {
695        return Generators.ensureValues(ensuredValues, otherValues);
696    }
697
698    /**
699     * <p>
700     * Create a generator which guarantees that all values from the
701     * ensuredValues will be return
702     * {@link Generator#next()} are issued.
703     * </p>
704     * <p>
705     * The order of values is undefined. All other values in the window and
706     * after the window are taken from the {@link Generator generator
707     * otherValues}.
708     * </p>
709     *
710     * @param <T>
711     *            type of values return
712     * @param window
713     *            After window number of calls to {@link Generator#next()} it is
714     *            guaranteed that all ensured values were return
715     */
716    public static <T> StatefulGenerator<T> ensureValues(Iterable<T> ensuredValues, int window,
717            Generator<T> otherValues) {
718        return Generators.ensureValues(ensuredValues, window, otherValues);
719    }
720
721    /**
722     * <p>
723     * Create a generator that ensures unique values.
724     * </p>
725     * <p>
726     * The actual values are created with an arbitrary generator.
727     * </p>
728     * <p>
729     * Note: unique generator depends on valid implementation of equals and
730     * hashCode method of the content type generated.
731     * </p>
732     *
733     * @param <T>
734     *            type of values return
735     * @param generator
736     *            used to create the raw values. This generator can
737     *            create duplicate values
738     * @param tries
739     *            Number of tries to create a new unique value. After this
740     *            number of tries is exceeded the generation aborts with a
741     *            {@link GeneratorException}.
742     * @return unique generator instance
743     */
744    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator,
745            int tries) {
746        return Generators.uniqueValues(generator, tries);
747    }
748
749    /**
750     * <p>
751     * Create a generator that ensures unique values.
752     * </p>
753     * <p>
754     * The actual values are created with an arbitrary generator.
755     * </p>
756     * <p>
757     * Unique generator depends on the {@link Comparator} implementation to
758     * decide if two instances are the same (i.e. when the comparator return
759     * for {@link Comparator#compare(Object, Object)}).
760     * </p>
761     *
762     * @param <T>
763     *            type of values return
764     * @param generator
765     *            used to create the raw values. This generator can create
766     *            duplicate values
767     * @param comparator
768     *            that decides if two values are of the same equivalence class.
769     * @param tries
770     *            Number of tries to create a new unique value. After this
771     *            number of tries is exceeded the generation aborts with a
772     *            {@link GeneratorException}.
773     * @return unique generator instance
774     */
775    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator,
776            Comparator<? super T> comparator, int tries) {
777        return Generators.uniqueValues(generator, comparator, tries);
778    }
779
780    /**
781     * <p>
782     * Create a generator that ensures unique values.
783     * </p>
784     * <p>
785     * The actual values are created with an arbitrary generator.
786     * </p>
787     * <p>
788     * Unique generator depends on the {@link Comparator} implementation to
789     * decide if two instances are the same (i.e. when the comparator return
790     * for {@link Comparator#compare(Object, Object)}).
791     * </p>
792     *
793     * @param <T>
794     *            type of values return
795     * @param generator
796     *            used to create the raw values. This generator can create
797     *            duplicate values
798     * @param comparator
799     *            that decides if two values are of the same equivalence class.
800     * @return unique generator instance
801     */
802    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator,
803            Comparator<? super T> comparator) {
804        return Generators.uniqueValues(generator, comparator);
805    }
806
807    /**
808     * <p>
809     * Create a generator that ensures unique values
810     * </p>
811     * <p>
812     * The actual values are created with an arbitrary generator.
813     * </p>
814     * <p>
815     * Note: unique generator depends on valid implementation of equals and
816     * hashCode method of the content type generated.
817     * </p>
818     *
819     * @param <T>
820     *            type of values return
821     * @param generator
822     *            used to create the raw values. This generator can
823     *            create duplicate values
824     * @return unique generator instance
825     */
826    public static <T> StatefulGenerator<T> uniqueValues(Generator<T> generator) {
827        return Generators.uniqueValues(generator);
828    }
829
830    /**
831     * Create a generator that omits a given set of values.
832     *
833     * @param generator used to create the raw values.
834     * @param excluded values. These values will not be return
835     */
836    @SafeVarargs
837    public static <T> Generator<T> excludeValues(Generator<T> generator, T... excluded) {
838        return Generators.excludeValues(generator, excluded);
839    }
840
841    /**
842     * Create a generator that omits a given set of values.
843     *
844     * @param values of generator
845     * @param excluded values. These values will not be return
846     */
847    @SafeVarargs
848    public static <T> Generator<T> excludeValues(Iterable<T> values, T... excluded) {
849        return Generators.excludeValues(values, excluded);
850    }
851
852    /**
853     * Create a generator that omits a given set of values.
854     *
855     * @param values of generator
856     * @param excluded values. These values will not be return
857     */
858    public static <T> Generator<T> excludeValues(Iterable<T> values, Iterable<T> excluded) {
859        return Generators.excludeValues(values, excluded);
860    }
861
862    /**
863     * Create a generator that omits a given set of values.
864     *
865     * @param generator used to create the raw values.
866     * @param excluded values. These values will not be return
867     */
868    public static <T> Generator<T> excludeValues(Generator<T> generator, Iterable<T> excluded) {
869        return Generators.excludeValues(generator, excluded);
870    }
871
872    /**
873     * A generator for a lists. The values in the lists are strictly increasing.
874     * <p>
875     * For every element x in the list: x(n) &lt; x(n+1).
876     * </p>
877     *
878     * @param input values generator
879     */
880    public static <T extends Comparable<T>> Generator<List<T>> strictlyOrdered(Generator<T> input) {
881        return Generators.strictlyOrdered(input);
882    }
883
884    /**
885     * A generator for a lists. The values in the lists are strictly increasing.
886     *
887     * <p>
888     * For every element x in the list: x(n) &lt; x(n+1).
889     * </p>
890     *
891     * @param input values generator
892     * @param low minimum size of the lists
893     * @param high maximum size of the lists
894     */
895    public static <T extends Comparable<T>> Generator<List<T>> strictlyOrdered(Generator<T> input,
896            int low, int high) {
897        return Generators.strictlyOrdered(input, low, high);
898    }
899
900    /**
901     * A generator for a lists. The values in the lists are strictly increasing.
902     * <p>
903     * For every element x in the list: x(n) &lt; x(n+1).
904     * </p>
905     * <p>
906     * This {@link Generator} can be used to generate a list of strictly decreasing values:
907     * {@code CombinedGenerators.strictlyOrdered(ts, Collections.&lt;T&gt; reverseOrder());}
908     * </p>
909     *
910     *
911     * @param input values generator
912     * @param comparator that orders the values
913     */
914    public static <T> Generator<List<T>> strictlyOrdered(Generator<T> input,
915            Comparator<T> comparator) {
916        return Generators.strictlyOrdered(input, comparator);
917    }
918
919    /**
920     * A generator for a lists. The values in the lists are strictly increasing.
921     * <p>
922     * For every element x in the list: x(n) &lt; x(n+1).
923     * </p>
924     *
925     * @param input values generator
926     * @param comparator that orders the values
927     * @param size of the resulting lists
928     */
929    public static <T> Generator<List<T>> strictlyOrdered(Generator<T> input,
930            Comparator<T> comparator, Generator<Integer> size) {
931        return Generators.strictlyOrdered(input, comparator, size);
932    }
933}