You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2003/07/18 00:44:46 UTC

cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util NumberRange.java CollectionTransformer.java EachElement.java

rwaldhoff    2003/07/17 15:44:46

  Modified:    functor/src/java/org/apache/commons/functor/generator
                        Generator.java IteratorToGeneratorAdapter.java
               functor/src/java/org/apache/commons/functor Algorithms.java
               functor/src/test/org/apache/commons/functor/generator
                        TestGenerator.java
               functor/src/java/org/apache/commons/functor/generator/util
                        NumberRange.java CollectionTransformer.java
                        EachElement.java
  Added:       functor/src/java/org/apache/commons/functor/generator
                        BaseGenerator.java
  Log:
  rename Generator to BaseGenerator
  extract interface Generator
  
  Revision  Changes    Path
  1.3       +18 -93    jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Generator.java	30 Jun 2003 23:36:14 -0000	1.2
  +++ Generator.java	17 Jul 2003 22:44:45 -0000	1.3
  @@ -1,5 +1,5 @@
   /*
  - * $Header$
  + * $Id$
    * ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -54,128 +54,53 @@
    * <http://www.apache.org/>.
    *
    */
  -
   package org.apache.commons.functor.generator;
   
   import java.util.Collection;
   
  -import org.apache.commons.functor.Algorithms;
   import org.apache.commons.functor.BinaryFunction;
   import org.apache.commons.functor.UnaryFunction;
   import org.apache.commons.functor.UnaryPredicate;
   import org.apache.commons.functor.UnaryProcedure;
  -import org.apache.commons.functor.generator.util.CollectionTransformer;
   
   /**
  - * Base class for generators. Adds support for all of the {@link Algorithms} to
  - * each subclass.
  - *
  - * @since 1.0
    * @version $Revision$ $Date$
    * @author  Jason Horman (jason@jhorman.org)
  + * @author Rodney Waldhoff
    */
  -
  -public abstract class Generator {
  -
  -    /** A generator can wrap another generator. */
  -    private Generator wrappedGenerator = null;
  -
  -    /** Create a new generator. */
  -    public Generator() {
  -    }
  -
  -    /**
  -     * A generator can wrap another generator. When wrapping generators you
  -     * should use probably this constructor since doing so will cause the
  -     * {@link #stop} method to stop the wrapped generator as well.
  -     */
  -    public Generator(Generator generator) {
  -        this.wrappedGenerator = generator;
  -    }
  -
  -    /** Get the generator that is being wrapped. */
  -    protected Generator getWrappedGenerator() {
  -        return wrappedGenerator;
  -    }
  -
  +public interface Generator {
       /** Generators must implement this method. */
       public abstract void run(UnaryProcedure proc);
  -
       /** Stop the generator. Will stop the wrapped generator if one was set. */
  -    public void stop() {
  -        if (wrappedGenerator != null) { wrappedGenerator.stop(); } 
  -        stopped = true;
  -    }
  -
  +    public abstract void stop();
       /** Check if the generator is stopped. */
  -    public boolean isStopped() {
  -        return stopped;
  -    }
  -
  -    /** Set to true when the generator is {@link #stop stopped}. */
  -    private boolean stopped = false;
  -
  +    public abstract boolean isStopped();
       /** See {@link Algorithms#apply}. */
  -    public final Generator apply(UnaryFunction func) {
  -        return Algorithms.apply(this,func);
  -    }
  -
  +    public abstract Generator apply(UnaryFunction func);
       /** See {@link Algorithms#contains}. */
  -    public final boolean contains(UnaryPredicate pred) {
  -        return Algorithms.contains(this, pred);
  -    }
  -
  +    public abstract boolean contains(UnaryPredicate pred);
       /** See {@link Algorithms#detect}. */
  -    public final Object detect(UnaryPredicate pred) {
  -        return Algorithms.detect(this, pred);
  -    }
  -
  +    public abstract Object detect(UnaryPredicate pred);
       /** See {@link Algorithms#detect}. */
  -    public final Object detect(UnaryPredicate pred, Object ifNone) {
  -        return Algorithms.detect(this, pred, ifNone);
  -    }
  -
  +    public abstract Object detect(UnaryPredicate pred, Object ifNone);
       /** Synonym for run. */
  -    public final void foreach(UnaryProcedure proc) {
  -        Algorithms.foreach(this, proc);
  -    }
  -
  +    public abstract void foreach(UnaryProcedure proc);
       /** See {@link Algorithms#inject}. */
  -    public final Object inject(Object seed, BinaryFunction func) {
  -        return Algorithms.inject(this, seed, func);
  -    }
  -
  +    public abstract Object inject(Object seed, BinaryFunction func);
       /** See {@link Algorithms#reject}. */
  -    public final Generator reject(UnaryPredicate pred) {
  -        return Algorithms.reject(this, pred);
  -    }
  -
  +    public abstract Generator reject(UnaryPredicate pred);
       /** See {@link Algorithms#select}. */
  -    public final Generator select(UnaryPredicate pred) {
  -        return Algorithms.select(this, pred);
  -    }
  -
  +    public abstract Generator select(UnaryPredicate pred);
       /** See {@link Algorithms#until}. */
  -    public final Generator until(UnaryPredicate pred) {
  -        return Algorithms.until(this, pred);
  -    }
  -
  +    public abstract Generator until(UnaryPredicate pred);
       /**
        * {@link Transformer Transforms} this generator using the passed in
        * transformer. An example transformer might turn the contents of the
        * generator into a {@link Collection} of elements.
        */
  -    public final Object to(Transformer transformer) {
  -        return transformer.transform(this);
  -    }
  -
  +    public abstract Object to(Transformer transformer);
       /** Same as to(new CollectionTransformer(collection)). */
  -    public final Collection to(Collection collection) {
  -        return (Collection)to(new CollectionTransformer(collection));
  -    }
  -
  +    public abstract Collection to(Collection collection);
       /** Same as to(new CollectionTransformer()). */
  -    public final Collection toCollection() {
  -        return (Collection)to(new CollectionTransformer());
  -    }
  +    public abstract Collection toCollection();
   }
  
  
  
  1.3       +3 -3      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java
  
  Index: IteratorToGeneratorAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IteratorToGeneratorAdapter.java	30 Jun 2003 23:36:13 -0000	1.2
  +++ IteratorToGeneratorAdapter.java	17 Jul 2003 22:44:45 -0000	1.3
  @@ -69,7 +69,7 @@
    * @author  Jason Horman (jason@jhorman.org)
    */
   
  -public class IteratorToGeneratorAdapter extends Generator {
  +public class IteratorToGeneratorAdapter extends BaseGenerator {
   
       /***************************************************
        *  Instance variables
  
  
  
  1.1                  jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseGenerator.java
  
  Index: BaseGenerator.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseGenerator.java,v 1.1 2003/07/17 22:44:45 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.functor.generator;
  
  import java.util.Collection;
  
  import org.apache.commons.functor.Algorithms;
  import org.apache.commons.functor.BinaryFunction;
  import org.apache.commons.functor.UnaryFunction;
  import org.apache.commons.functor.UnaryPredicate;
  import org.apache.commons.functor.UnaryProcedure;
  import org.apache.commons.functor.generator.util.CollectionTransformer;
  
  /**
   * Base class for generators. Adds support for all of the {@link Algorithms} to
   * each subclass.
   *
   * @since 1.0
   * @version $Revision: 1.1 $ $Date: 2003/07/17 22:44:45 $
   * @author  Jason Horman (jason@jhorman.org)
   */
  
  public abstract class BaseGenerator implements Generator {
  
      /** A generator can wrap another generator. */
      private Generator wrappedGenerator = null;
  
      /** Create a new generator. */
      public BaseGenerator() {
      }
  
      /**
       * A generator can wrap another generator. When wrapping generators you
       * should use probably this constructor since doing so will cause the
       * {@link #stop} method to stop the wrapped generator as well.
       */
      public BaseGenerator(Generator generator) {
          this.wrappedGenerator = generator;
      }
  
      /** Get the generator that is being wrapped. */
      protected Generator getWrappedGenerator() {
          return wrappedGenerator;
      }
  
      /** Generators must implement this method. */
      public abstract void run(UnaryProcedure proc);
  
      /** Stop the generator. Will stop the wrapped generator if one was set. */
      public void stop() {
          if (wrappedGenerator != null) { wrappedGenerator.stop(); } 
          stopped = true;
      }
  
      /** Check if the generator is stopped. */
      public boolean isStopped() {
          return stopped;
      }
  
      /** Set to true when the generator is {@link #stop stopped}. */
      private boolean stopped = false;
  
      /** See {@link Algorithms#apply}. */
      public final Generator apply(UnaryFunction func) {
          return Algorithms.apply(this,func);
      }
  
      /** See {@link Algorithms#contains}. */
      public final boolean contains(UnaryPredicate pred) {
          return Algorithms.contains(this, pred);
      }
  
      /** See {@link Algorithms#detect}. */
      public final Object detect(UnaryPredicate pred) {
          return Algorithms.detect(this, pred);
      }
  
      /** See {@link Algorithms#detect}. */
      public final Object detect(UnaryPredicate pred, Object ifNone) {
          return Algorithms.detect(this, pred, ifNone);
      }
  
      /** Synonym for run. */
      public final void foreach(UnaryProcedure proc) {
          Algorithms.foreach(this, proc);
      }
  
      /** See {@link Algorithms#inject}. */
      public final Object inject(Object seed, BinaryFunction func) {
          return Algorithms.inject(this, seed, func);
      }
  
      /** See {@link Algorithms#reject}. */
      public final Generator reject(UnaryPredicate pred) {
          return Algorithms.reject(this, pred);
      }
  
      /** See {@link Algorithms#select}. */
      public final Generator select(UnaryPredicate pred) {
          return Algorithms.select(this, pred);
      }
  
      /** See {@link Algorithms#until}. */
      public final Generator until(UnaryPredicate pred) {
          return Algorithms.until(this, pred);
      }
  
      /**
       * {@link Transformer Transforms} this generator using the passed in
       * transformer. An example transformer might turn the contents of the
       * generator into a {@link Collection} of elements.
       */
      public final Object to(Transformer transformer) {
          return transformer.transform(this);
      }
  
      /** Same as to(new CollectionTransformer(collection)). */
      public final Collection to(Collection collection) {
          return (Collection)to(new CollectionTransformer(collection));
      }
  
      /** Same as to(new CollectionTransformer()). */
      public final Collection toCollection() {
          return (Collection)to(new CollectionTransformer());
      }
  }
  
  
  1.5       +36 -35    jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java
  
  Index: Algorithms.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Algorithms.java	30 Jun 2003 22:40:53 -0000	1.4
  +++ Algorithms.java	17 Jul 2003 22:44:45 -0000	1.5
  @@ -57,17 +57,18 @@
   
   package org.apache.commons.functor;
   
  -import org.apache.commons.functor.generator.Generator;
  -import org.apache.commons.functor.generator.IteratorToGeneratorAdapter;
  -
   import java.util.Iterator;
   import java.util.NoSuchElementException;
   
  +import org.apache.commons.functor.generator.BaseGenerator;
  +import org.apache.commons.functor.generator.Generator;
  +import org.apache.commons.functor.generator.IteratorToGeneratorAdapter;
  +
   /**
  - * Utility methods and algorithms for applying functors to {@link Generator}s.
  - * {@link Generator}s also define these utility methods as instance methods. The
  + * Utility methods and algorithms for applying functors to {@link IfaceGenerator}s.
  + * {@link IfaceGenerator}s also define these utility methods as instance methods. The
    * {@link #apply}, {@link #select}, and {@link #reject} methods return new
  - * Generators. This becomes useful for constructing nested expressions. For
  + * IfaceGenerators. This becomes useful for constructing nested expressions. For
    * example:
    *
    * <pre>
  @@ -86,18 +87,18 @@
   public class Algorithms {
   
       /**
  -     * apply(new IteratorToGeneratorAdapter(iter),func);
  +     * apply(new IteratorToGeneratorAdapater(iter),func);
        */
       public static final Generator apply(Iterator iter, UnaryFunction func) {
           return apply(new IteratorToGeneratorAdapter(iter),func);
       }
   
       /**
  -     * Returns a {@link Generator} that will apply the given {@link UnaryFunction} to each
  +     * Returns a {@link IfaceGenerator} that will apply the given {@link UnaryFunction} to each
        * generated element.
        */
       public static final Generator apply(final Generator gen, final UnaryFunction func) {
  -        return new Generator(gen) {
  +        return new BaseGenerator(gen) {
               public void run(final UnaryProcedure proc) {
                   gen.run(new UnaryProcedure() {
                       public void run(Object obj) {
  @@ -109,17 +110,17 @@
       }
   
       /**
  -     * contains(new IteratorToGeneratorAdapter(iter),pred);
  +     * contains(new IteratorToGeneratorAdapater(iter),pred);
        */
       public static final boolean contains(Iterator iter, UnaryPredicate pred) {
           return contains(new IteratorToGeneratorAdapter(iter),pred);
       }
   
       /**
  -     * Return <code>true</code> if some element in the given {@link Generator}
  +     * Return <code>true</code> if some element in the given {@link IfaceGenerator}
        * that matches the given {@link UnaryPredicate UnaryPredicate}.
        *
  -     * @see #detect(Generator,UnaryPredicate)
  +     * @see #detect(IfaceGenerator,UnaryPredicate)
        */
       public static final boolean contains(final Generator gen, final UnaryPredicate pred) {
           // javas' inner classes suck, i should do this a different way i guess
  @@ -139,26 +140,26 @@
       }
   
       /**
  -     * detect(new IteratorToGeneratorAdapter(iter), pred);
  +     * detect(new IteratorToGeneratorAdapater(iter), pred);
        */
       public static final Object detect(Iterator iter, UnaryPredicate pred) {
           return detect(new IteratorToGeneratorAdapter(iter), pred);
       }
   
       /**
  -     * detect(new IteratorToGeneratorAdapter(iter), pred, ifNone);
  +     * detect(new IteratorToGeneratorAdapater(iter), pred, ifNone);
        */
       public static final Object detect(Iterator iter, UnaryPredicate pred, Object ifNone) {
           return detect(new IteratorToGeneratorAdapter(iter), pred, ifNone);
       }
   
       /**
  -     * Return the first element within the given {@link Generator} that matches
  +     * Return the first element within the given {@link IfaceGenerator} that matches
        * the given {@link UnaryPredicate UnaryPredicate}, or throw {@link
        * java.util.NoSuchElementException NoSuchElementException} if no
        * matching element can be found.
        *
  -     * @see #detect(Generator,UnaryPredicate,Object)
  +     * @see #detect(IfaceGenerator,UnaryPredicate,Object)
        * @throws NoSuchElementException If no element could be found.
        */
       public static final Object detect(final Generator gen, final UnaryPredicate pred) {
  @@ -180,12 +181,12 @@
       }
   
       /**
  -     * Return the first element within the given {@link Generator} that matches
  +     * Return the first element within the given {@link IfaceGenerator} that matches
        * the given {@link UnaryPredicate UnaryPredicate}, or return the given
        * (possibly <code>null</code> <code>Object</code> if no matching element
        * can be found.
        *
  -     * @see #detect(Generator,UnaryPredicate)
  +     * @see #detect(IfaceGenerator,UnaryPredicate)
        */
       public static final Object detect(final Generator gen, final UnaryPredicate pred, Object ifNone) {
           final Object[] foundObj = new Object[1];
  @@ -206,7 +207,7 @@
       }
   
       /**
  -     * foreach(new IteratorToGeneratorAdapter(iter), proc);
  +     * foreach(new IteratorToGeneratorAdapater(iter), proc);
        */
       public static final void foreach(Iterator iter, UnaryProcedure proc) {
           foreach(new IteratorToGeneratorAdapter(iter), proc);
  @@ -214,14 +215,14 @@
   
       /**
        * {@link UnaryProcedure#run Apply} the given {@link UnaryProcedure
  -     * UnaryProcedure} to each element in the given {@link Generator}.
  +     * UnaryProcedure} to each element in the given {@link IfaceGenerator}.
        */
       public static final void foreach(Generator gen, UnaryProcedure proc) {
           gen.run(proc);
       }
   
       /**
  -     * inject(new IteratorToGeneratorAdapter(iter), seed, func);
  +     * inject(new IteratorToGeneratorAdapater(iter), seed, func);
        */
       public static final Object inject(Iterator iter, Object seed, BinaryFunction func) {
           return inject(new IteratorToGeneratorAdapter(iter), seed, func);
  @@ -229,7 +230,7 @@
   
       /**
        * {@link BinaryFunction#evaluate Evaluate} the pair <i>( previousResult,
  -     * element )</i> for each element in the given {@link Generator} where
  +     * element )</i> for each element in the given {@link IfaceGenerator} where
        * previousResult is initially <i>seed</i>, and thereafter the result of the
        * evaluation of the previous element in the iterator. Returns the result
        * of the final evaluation.
  @@ -258,18 +259,18 @@
   
   
       /**
  -     * reject(new IteratorToGeneratorAdapter(iter), pred);
  +     * reject(new IteratorToGeneratorAdapater(iter), pred);
        */
       public static Generator reject(Iterator iter, UnaryPredicate pred) {
           return reject(new IteratorToGeneratorAdapter(iter), pred);
       }
   
       /**
  -     * Returns a {@link Generator} that will only "generate" elements that DO
  +     * Returns a {@link IfaceGenerator} that will only "generate" elements that DO
        * NOT match the given predicate.
        */
       public static Generator reject(final Generator gen, final UnaryPredicate pred) {
  -        return new Generator(gen) {
  +        return new BaseGenerator(gen) {
               public void run(final UnaryProcedure proc) {
                   gen.run(new UnaryProcedure() {
                       public void run(Object obj) {
  @@ -283,18 +284,18 @@
       }
   
       /**
  -     * select(new IteratorToGeneratorAdapter(iter), pred);
  +     * select(new IteratorToGeneratorAdapater(iter), pred);
        */
       public static final Generator select(Iterator iter, UnaryPredicate pred) {
           return select(new IteratorToGeneratorAdapter(iter), pred);
       }
   
       /**
  -     * Returns a {@link Generator} that will only "generate" elements that DO
  +     * Returns a {@link IfaceGenerator} that will only "generate" elements that DO
        * match the given predicate.
        */
       public static final Generator select(final Generator gen, final UnaryPredicate pred) {
  -        return new Generator(gen) {
  +        return new BaseGenerator(gen) {
               public void run(final UnaryProcedure proc) {
                   gen.run(new UnaryProcedure() {
                       public void run(Object obj) {
  @@ -308,25 +309,25 @@
       }
   
       /**
  -     * until(new IteratorToGeneratorAdapter(iter), pred);
  +     * until(new IteratorToGeneratorAdapater(iter), pred);
        */
       public static final Generator until(Iterator iter, UnaryPredicate pred) {
           return until(new IteratorToGeneratorAdapter(iter), pred);
       }
   
       /**
  -     * Returns a {@link Generator} that will stop when the predicate becomes
  -     * true. This is useful for imposing {@link Generator} limits. For example:
  +     * Returns a {@link IfaceGenerator} that will stop when the predicate becomes
  +     * true. This is useful for imposing {@link IfaceGenerator} limits. For example:
        *
        * <pre>
        *  EachLine.open(file).until(new MaxIterations(1));
        * </pre>
        *
  -     * Would only "generate" 1 line from the file before {@link Generator#stop
  +     * Would only "generate" 1 line from the file before {@link IfaceGenerator#stop
        * stopping} the generator.
        */
       public static final Generator until(final Generator gen, final UnaryPredicate pred) {
  -        return new Generator(gen) {
  +        return new BaseGenerator(gen) {
               public void run(final UnaryProcedure proc) {
                   gen.run(new UnaryProcedure() {
                       public void run(Object obj) {
  
  
  
  1.3       +3 -3      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java
  
  Index: TestGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestGenerator.java	17 Jul 2003 17:48:03 -0000	1.2
  +++ TestGenerator.java	17 Jul 2003 22:44:46 -0000	1.3
  @@ -96,7 +96,7 @@
       public void setUp() throws Exception {
           super.setUp();
   
  -        simpleGenerator = new Generator() {
  +        simpleGenerator = new BaseGenerator() {
               public void run(UnaryProcedure proc) {
                   for (int i=0;i<5;i++) {
                       proc.run(new Integer(i));
  @@ -164,7 +164,7 @@
   
       public void testWrappingGenerator() {
           final StringBuffer result = new StringBuffer();
  -        final Generator gen = new Generator(simpleGenerator) {
  +        final Generator gen = new BaseGenerator(simpleGenerator) {
               public void run(final UnaryProcedure proc) {
                   Generator wrapped = getWrappedGenerator();
                   assertSame(simpleGenerator, wrapped);
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/NumberRange.java
  
  Index: NumberRange.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/NumberRange.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NumberRange.java	30 Jun 2003 11:00:13 -0000	1.1
  +++ NumberRange.java	17 Jul 2003 22:44:46 -0000	1.2
  @@ -58,7 +58,7 @@
   package org.apache.commons.functor.generator.util;
   
   import org.apache.commons.functor.UnaryProcedure;
  -import org.apache.commons.functor.generator.Generator;
  +import org.apache.commons.functor.generator.BaseGenerator;
   
   /**
    * Generator for a numeric range. If {@link #min} <= {@link #max} generation
  @@ -69,7 +69,7 @@
    * @author  Jason Horman (jason@jhorman.org)
    */
   
  -public abstract class NumberRange extends Generator {
  +public abstract class NumberRange extends BaseGenerator {
   
       /***************************************************
        *  Instance variables
  
  
  
  1.2       +7 -7      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/CollectionTransformer.java
  
  Index: CollectionTransformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/CollectionTransformer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CollectionTransformer.java	30 Jun 2003 11:00:13 -0000	1.1
  +++ CollectionTransformer.java	17 Jul 2003 22:44:46 -0000	1.2
  @@ -57,12 +57,12 @@
   
   package org.apache.commons.functor.generator.util;
   
  -import org.apache.commons.functor.generator.Transformer;
  -import org.apache.commons.functor.generator.Generator;
  -import org.apache.commons.functor.UnaryProcedure;
  -
  -import java.util.Collection;
   import java.util.ArrayList;
  +import java.util.Collection;
  +
  +import org.apache.commons.functor.UnaryProcedure;
  +import org.apache.commons.functor.generator.Generator;
  +import org.apache.commons.functor.generator.Transformer;
   
   /**
    * Transforms a generator into a collection. If a collection is not passed into
  
  
  
  1.2       +4 -3      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/EachElement.java
  
  Index: EachElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/EachElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EachElement.java	30 Jun 2003 11:00:13 -0000	1.1
  +++ EachElement.java	17 Jul 2003 22:44:46 -0000	1.2
  @@ -63,6 +63,7 @@
   import java.util.Map;
   
   import org.apache.commons.functor.UnaryProcedure;
  +import org.apache.commons.functor.generator.BaseGenerator;
   import org.apache.commons.functor.generator.Generator;
   import org.apache.commons.functor.generator.IteratorToGeneratorAdapter;
   
  @@ -74,7 +75,7 @@
    * @author  Jason Horman (jason@jhorman.org)
    */
   
  -public class EachElement extends Generator {
  +public class EachElement extends BaseGenerator {
   
       /***************************************************
        *  Instance variables
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org