commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
Date Tue, 25 Nov 2003 17:49:35 GMT
rwaldhoff    2003/11/25 09:49:35

  Modified:    functor/src/java/org/apache/commons/functor/generator/util
                        MaxIterations.java
               functor/src/java/org/apache/commons/functor Algorithms.java
               functor/src/test/org/apache/commons/functor/generator
                        TestGenerator.java
               functor/src/test/org/apache/commons/functor/generator/util
                        TestEachElement.java
               functor/src/test/org/apache/commons/functor
                        TestAlgorithms.java
  Log:
  using Offset instead of MaxIterations
  
  Revision  Changes    Path
  1.3       +2 -3      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java
  
  Index: MaxIterations.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MaxIterations.java	25 Nov 2003 00:23:14 -0000	1.2
  +++ MaxIterations.java	25 Nov 2003 17:49:35 -0000	1.3
  @@ -73,7 +73,6 @@
    * @version $Revision$ $Date$
    * @author  Jason Horman (jason@jhorman.org)
    */
  -
   public class MaxIterations implements UnaryPredicate {
   
       /***************************************************
  
  
  
  1.7       +4 -5      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Algorithms.java	12 Nov 2003 00:50:44 -0000	1.6
  +++ Algorithms.java	25 Nov 2003 17:49:35 -0000	1.7
  @@ -81,9 +81,8 @@
    *
    * @since 1.0
    * @version $Revision$ $Date$
  - * @author  Jason Horman (jason@jhorman.org)
  + * @author Jason Horman (jason@jhorman.org)
    */
  -
   public class Algorithms {
   
       /**
  @@ -320,7 +319,7 @@
        * true. This is useful for imposing {@link Generator} limits. For example:
        *
        * <pre>
  -     *  EachLine.open(file).until(new MaxIterations(1));
  +     *  EachLine.open(file).until(new Offset(1));
        * </pre>
        *
        * Would only "generate" 1 line from the file before {@link Generator#stop
  
  
  
  1.6       +19 -9     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestGenerator.java	24 Nov 2003 20:12:17 -0000	1.5
  +++ TestGenerator.java	25 Nov 2003 17:49:35 -0000	1.6
  @@ -57,18 +57,28 @@
   
   package org.apache.commons.functor.generator;
   
  -import junit.framework.TestCase;
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.LinkedList;
  +import java.util.List;
  +import java.util.NoSuchElementException;
  +import java.util.Set;
  +
   import junit.framework.Test;
  +import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import org.apache.commons.functor.*;
  -import org.apache.commons.functor.core.IsEqual;
  -import org.apache.commons.functor.core.IdentityFunction;
  +
  +import org.apache.commons.functor.BinaryFunction;
  +import org.apache.commons.functor.UnaryPredicate;
  +import org.apache.commons.functor.UnaryProcedure;
   import org.apache.commons.functor.adapter.LeftBoundPredicate;
  +import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.IsEqual;
  +import org.apache.commons.functor.core.Offset;
   import org.apache.commons.functor.generator.util.CollectionTransformer;
   import org.apache.commons.functor.generator.util.EachElement;
  -import org.apache.commons.functor.generator.util.MaxIterations;
  -
  -import java.util.*;
   
   /**
    * Tests the Base Generator class.
  @@ -289,7 +299,7 @@
       }
   
       public void testLimit() {
  -        Collection col = simpleGenerator.until(new MaxIterations(2)).toCollection();
  +        Collection col = simpleGenerator.until(new Offset(2)).toCollection();
           assertEquals("[0, 1]", col.toString());
       }
   
  
  
  
  1.3       +3 -2      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestEachElement.java
  
  Index: TestEachElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestEachElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestEachElement.java	19 Jul 2003 22:12:25 -0000	1.2
  +++ TestEachElement.java	25 Nov 2003 17:49:35 -0000	1.3
  @@ -68,6 +68,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.commons.functor.BaseFunctorTest;
  +import org.apache.commons.functor.core.Offset;
   
   /**
    * @author Jason Horman (jason@jhorman.org)
  @@ -169,7 +170,7 @@
       }
   
       public void testWithStop() {
  -        Collection col = EachElement.from(list).until(new MaxIterations(3)).toCollection();
  +        Collection col = EachElement.from(list).until(new Offset(3)).toCollection();
           assertEquals("[0, 1, 2]", col.toString());
   
       }
  
  
  
  1.4       +4 -7      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java
  
  Index: TestAlgorithms.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestAlgorithms.java	24 Nov 2003 20:12:17 -0000	1.3
  +++ TestAlgorithms.java	25 Nov 2003 17:49:35 -0000	1.4
  @@ -68,13 +68,10 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  -import org.apache.commons.functor.BinaryFunction;
  -import org.apache.commons.functor.UnaryPredicate;
  -import org.apache.commons.functor.UnaryProcedure;
  -import org.apache.commons.functor.generator.util.MaxIterations;
   import org.apache.commons.functor.adapter.LeftBoundPredicate;
   import org.apache.commons.functor.core.IdentityFunction;
   import org.apache.commons.functor.core.IsEqual;
  +import org.apache.commons.functor.core.Offset;
   
   /**
    * @version $Revision$ $Date$
  @@ -219,7 +216,7 @@
       }
   
       public void testLimit() {
  -        Collection col = Algorithms.until(list.iterator(), new MaxIterations(2)).toCollection();
  +        Collection col = Algorithms.until(list.iterator(), new Offset(2)).toCollection();
           System.out.println(col);
           assertEquals("[0, 1]", col.toString());
       }
  
  
  

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


Mime
View raw message