Package net.java.quickcheck.generator.support

Examples of net.java.quickcheck.generator.support.TupleGenerator


   *            Generator for left values.
   * @param second
   *            Generator for right values.
   */
  public static <A, B> Generator<Pair<A, B>> pairs(Generator<A> first, Generator<B> second) {
    final TupleGenerator generator = new TupleGenerator(first, second);
    return new Generator<Pair<A, B>>() {
      @SuppressWarnings("unchecked")
      public Pair<A, B> next() {
        Object[] next = generator.next();
        return new Pair(next[0], next[1]);
      }
    };
  }
View Full Code Here


   * @param third
   *            Generator for third values.
   */
  public static <A, B, C> Generator<Triple<A, B, C>> triples(Generator<A> first, Generator<B> second,
      Generator<C> third) {
    final TupleGenerator generator = new TupleGenerator(first, second, third);
    return new Generator<Triple<A, B, C>>() {
      @SuppressWarnings("unchecked")
      public Triple<A, B, C> next() {
        Object[] next = generator.next();
        return new Triple<A, B, C>((A) next[0], (B) next[1], (C) next[2]);
      }
    };
  }
View Full Code Here

   *            Generator for left values.
   * @param second
   *            Generator for right values.
   */
  public static <A, B> Generator<Pair<A, B>> pairs(Generator<A> first, Generator<B> second) {
    final TupleGenerator generator = new TupleGenerator(first, second);
    return new Generator<Pair<A, B>>() {
      @SuppressWarnings("unchecked")
      @Override public Pair<A, B> next() {
        Object[] next = generator.next();
        return new Pair<A,B>((A) next[0], (B) next[1]);
      }
    };
  }
View Full Code Here

   * @param third
   *            Generator for third values.
   */
  public static <A, B, C> Generator<Triple<A, B, C>> triples(Generator<A> first, Generator<B> second,
      Generator<C> third) {
    final TupleGenerator generator = new TupleGenerator(first, second, third);
    return new Generator<Triple<A, B, C>>() {
      @Override
      @SuppressWarnings("unchecked")
      public Triple<A, B, C> next() {
        Object[] next = generator.next();
        return new Triple<A, B, C>((A) next[0], (B) next[1], (C) next[2]);
      }
    };
  }
View Full Code Here

TOP

Related Classes of net.java.quickcheck.generator.support.TupleGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.