commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r644470 [6/7] - in /commons/sandbox/functor/trunk/src: main/java/org/apache/commons/functor/ main/java/org/apache/commons/functor/adapter/ main/java/org/apache/commons/functor/core/ main/java/org/apache/commons/functor/core/collection/ main...
Date Thu, 03 Apr 2008 20:23:31 GMT
Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestNot.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestNot.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestNot.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestNot.java Thu Apr  3 13:23:16 2008
@@ -60,12 +60,12 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testTest() throws Exception {
         Predicate truePred = new Not(new Constant(false));
         assertTrue(truePred.test());
     }
-    
+
     public void testEquals() throws Exception {
         Not p = new Not(Constant.truePredicate());
         assertEquals(p,p);

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestOr.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestOr.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestOr.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestOr.java Thu Apr  3 13:23:16 2008
@@ -60,64 +60,64 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testTrue() throws Exception {
         assertTrue((new Or(new Constant(true))).test());
         assertTrue((new Or(new Constant(false),new Constant(true))).test());
         assertTrue((new Or(new Constant(false),new Constant(false),new Constant(true))).test());
-        
+
         Or p = new Or(new Constant(true));
-        assertTrue(p.test());        
+        assertTrue(p.test());
         for(int i=0;i<10;i++) {
             p.or(new Constant(i%2==0));
-            assertTrue(p.test());        
+            assertTrue(p.test());
         }
-        
+
         Or q = new Or(new Constant(true));
-        assertTrue(q.test());        
+        assertTrue(q.test());
         for(int i=0;i<10;i++) {
             q.or(new Constant(i%2==0));
-            assertTrue(q.test());        
+            assertTrue(q.test());
         }
-        
+
         Or r = new Or(p,q);
-        assertTrue(r.test());        
+        assertTrue(r.test());
     }
-    
+
     public void testFalse() throws Exception {
         assertTrue(!(new Or()).test());
         assertTrue(!(new Or(new Constant(false))).test());
         assertTrue(!(new Or(new Constant(false),new Constant(false))).test());
         assertTrue(!(new Or(new Constant(false),new Constant(false),new Constant(false))).test());
-        
+
         Or p = new Or(new Constant(false));
-        assertTrue(!p.test());        
+        assertTrue(!p.test());
         for(int i=0;i<10;i++) {
             p.or(new Constant(false));
-            assertTrue(!p.test());        
+            assertTrue(!p.test());
         }
-        
+
         Or q = new Or(new Constant(false));
-        assertTrue(!q.test());        
+        assertTrue(!q.test());
         for(int i=0;i<10;i++) {
             q.or(new Constant(false));
-            assertTrue(!q.test());        
+            assertTrue(!q.test());
         }
-        
+
         Or r = new Or(p,q);
-        assertTrue(!r.test());        
+        assertTrue(!r.test());
     }
-        
+
     public void testDuplicateAdd() throws Exception {
         Predicate p = new Constant(true);
         Or q = new Or(p,p);
         assertTrue(q.test());
         for(int i=0;i<10;i++) {
             q.or(p);
-            assertTrue(q.test());        
+            assertTrue(q.test());
         }
     }
-        
+
     public void testEquals() throws Exception {
         Or p = new Or();
         assertEquals(p,p);
@@ -127,7 +127,7 @@
 
         And r = new And();
         assertObjectsAreNotEqual(p,r);
-        
+
         for(int i=0;i<3;i++) {
             p.or(Constant.truePredicate());
             assertObjectsAreNotEqual(p,q);
@@ -137,13 +137,13 @@
             assertObjectsAreNotEqual(p,r);
 
             p.or(new Or(Constant.truePredicate(),Constant.falsePredicate()));
-            assertObjectsAreNotEqual(p,q);            
+            assertObjectsAreNotEqual(p,q);
             q.or(new Or(Constant.truePredicate(),Constant.falsePredicate()));
-            assertObjectsAreEqual(p,q);            
+            assertObjectsAreEqual(p,q);
             r.and(new Or(Constant.truePredicate(),Constant.falsePredicate()));
             assertObjectsAreNotEqual(p,r);
         }
-        
+
         assertObjectsAreNotEqual(p,Constant.truePredicate());
     }
 

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java Thu Apr  3 13:23:16 2008
@@ -63,7 +63,7 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testRunZero() throws Exception {
         Sequence seq = new Sequence();
         seq.run();
@@ -86,11 +86,11 @@
         assertEquals(1,counter[0].count);
         assertEquals(1,counter[1].count);
     }
-    
+
     public void testThen() throws Exception {
         List list = new ArrayList();
         Sequence seq = new Sequence();
-        seq.run();        
+        seq.run();
         for(int i=0;i<10;i++) {
             RunCounter counter = new RunCounter();
             seq.then(counter);
@@ -101,7 +101,7 @@
             }
         }
     }
-    
+
     public void testEquals() throws Exception {
         Sequence p = new Sequence();
         assertEquals(p,p);
@@ -114,21 +114,21 @@
             q.then(new NoOp());
             assertObjectsAreEqual(p,q);
             p.then(new Sequence(new NoOp(),new NoOp()));
-            assertObjectsAreNotEqual(p,q);            
+            assertObjectsAreNotEqual(p,q);
             q.then(new Sequence(new NoOp(),new NoOp()));
-            assertObjectsAreEqual(p,q);            
+            assertObjectsAreEqual(p,q);
         }
-                
+
         assertObjectsAreNotEqual(p,new NoOp());
     }
 
     // Classes
     // ------------------------------------------------------------------------
-    
-    static class RunCounter implements Procedure {        
+
+    static class RunCounter implements Procedure {
         public void run() {
-            count++;    
-        }        
+            count++;
+        }
         public int count = 0;
     }
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedFunction.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedFunction.java Thu Apr  3 13:23:16 2008
@@ -62,13 +62,13 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testEvaluate() throws Exception {
         BinaryFunction f = new TransposedFunction(new LeftIdentity());
         assertEquals("xyzzy",f.evaluate(null,"xyzzy"));
         assertNull(f.evaluate("xyzzy",null));
     }
-        
+
     public void testEquals() throws Exception {
         BinaryFunction f = new TransposedFunction(new LeftIdentity());
         assertEquals(f,f);

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedPredicate.java Thu Apr  3 13:23:16 2008
@@ -62,13 +62,13 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testEvaluate() throws Exception {
         BinaryPredicate p = new TransposedPredicate(BinaryFunctionBinaryPredicate.adapt(new LeftIdentity()));
         assertEquals(true,p.test(Boolean.FALSE,Boolean.TRUE));
         assertEquals(false,p.test(Boolean.TRUE,Boolean.FALSE));
     }
-        
+
     public void testEquals() throws Exception {
         BinaryPredicate p = new TransposedPredicate(Constant.truePredicate());
         assertEquals(p,p);

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestTransposedProcedure.java Thu Apr  3 13:23:16 2008
@@ -60,7 +60,7 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testEvaluate() throws Exception {
         LeftNotNullCounter counter = new LeftNotNullCounter();
         BinaryProcedure p = new TransposedProcedure(counter);
@@ -70,7 +70,7 @@
         p.run("not null",null);
         assertEquals(1,counter.count);
     }
-        
+
     public void testEquals() throws Exception {
         BinaryProcedure p = new TransposedProcedure(NoOp.instance());
         assertEquals(p,p);
@@ -91,14 +91,14 @@
 
     // Classes
     // ------------------------------------------------------------------------
-    
-    static class LeftNotNullCounter implements BinaryProcedure {        
+
+    static class LeftNotNullCounter implements BinaryProcedure {
         public void run(Object a, Object b) {
             if(null != a) {
-                count++;    
+                count++;
             }
-        }        
+        }
         public int count = 0;
     }
-    
+
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java Thu Apr  3 13:23:16 2008
@@ -60,64 +60,64 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testTrue() throws Exception {
         assertTrue((new UnaryAnd()).test("xyzzy"));
         assertTrue((new UnaryAnd(new Constant(true))).test("xyzzy"));
         assertTrue((new UnaryAnd(new Constant(true),new Constant(true))).test("xyzzy"));
         assertTrue((new UnaryAnd(new Constant(true),new Constant(true),new Constant(true))).test("xyzzy"));
-        
+
         UnaryAnd p = new UnaryAnd(new Constant(true));
-        assertTrue(p.test("xyzzy"));        
+        assertTrue(p.test("xyzzy"));
         for(int i=0;i<10;i++) {
             p.and(new Constant(true));
-            assertTrue(p.test("xyzzy"));        
+            assertTrue(p.test("xyzzy"));
         }
-        
+
         UnaryAnd q = new UnaryAnd(new Constant(true));
-        assertTrue(q.test("xyzzy"));        
+        assertTrue(q.test("xyzzy"));
         for(int i=0;i<10;i++) {
             q.and(new Constant(true));
-            assertTrue(q.test("xyzzy"));        
+            assertTrue(q.test("xyzzy"));
         }
-        
+
         UnaryAnd r = new UnaryAnd(p,q);
-        assertTrue(r.test("xyzzy"));        
+        assertTrue(r.test("xyzzy"));
     }
-    
+
     public void testFalse() throws Exception {
         assertTrue(!(new UnaryAnd(new Constant(false))).test("xyzzy"));
         assertTrue(!(new UnaryAnd(new Constant(true),new Constant(false))).test("xyzzy"));
         assertTrue(!(new UnaryAnd(new Constant(true),new Constant(true),new Constant(false))).test("xyzzy"));
-        
+
         UnaryAnd p = new UnaryAnd(new Constant(false));
-        assertTrue(!p.test("xyzzy"));        
+        assertTrue(!p.test("xyzzy"));
         for(int i=0;i<10;i++) {
             p.and(new Constant(false));
-            assertTrue(!p.test("xyzzy"));        
+            assertTrue(!p.test("xyzzy"));
         }
-        
+
         UnaryAnd q = new UnaryAnd(new Constant(true));
-        assertTrue(q.test("xyzzy"));        
+        assertTrue(q.test("xyzzy"));
         for(int i=0;i<10;i++) {
             q.and(new Constant(true));
-            assertTrue(q.test("xyzzy"));        
+            assertTrue(q.test("xyzzy"));
         }
-        
+
         UnaryAnd r = new UnaryAnd(p,q);
-        assertTrue(!r.test("xyzzy"));        
+        assertTrue(!r.test("xyzzy"));
     }
-        
+
     public void testDuplicateAdd() throws Exception {
         UnaryPredicate p = new Constant(true);
         UnaryAnd q = new UnaryAnd(p,p);
         assertTrue(q.test("xyzzy"));
         for(int i=0;i<10;i++) {
             q.and(p);
-            assertTrue(q.test("xyzzy"));        
+            assertTrue(q.test("xyzzy"));
         }
     }
-        
+
     public void testEquals() throws Exception {
         UnaryAnd p = new UnaryAnd();
         assertEquals(p,p);
@@ -130,11 +130,11 @@
             q.and(Constant.truePredicate());
             assertObjectsAreEqual(p,q);
             p.and(new UnaryAnd(Constant.truePredicate(),Constant.falsePredicate()));
-            assertObjectsAreNotEqual(p,q);            
+            assertObjectsAreNotEqual(p,q);
             q.and(new UnaryAnd(Constant.truePredicate(),Constant.falsePredicate()));
-            assertObjectsAreEqual(p,q);            
+            assertObjectsAreEqual(p,q);
         }
-        
+
         assertObjectsAreNotEqual(p,Constant.truePredicate());
     }
 

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryFunction.java Thu Apr  3 13:23:16 2008
@@ -66,7 +66,7 @@
 
     // Tests
     // ------------------------------------------------------------------------
-   
+
     public void testEvaluate() throws Exception {
         BinaryFunction f = new UnaryCompositeBinaryFunction(
             new RightIdentity(),
@@ -76,7 +76,7 @@
         assertNull("right",f.evaluate("left",null));
         assertEquals("right",f.evaluate(null,"right"));
     }
-    
+
     public void testEquals() throws Exception {
         BinaryFunction f = new UnaryCompositeBinaryFunction(
             new LeftIdentity(),

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryPredicate.java Thu Apr  3 13:23:16 2008
@@ -66,7 +66,7 @@
 
     // Tests
     // ------------------------------------------------------------------------
-   
+
     public void testEvaluate() throws Exception {
         BinaryPredicate f = new UnaryCompositeBinaryPredicate(
             new RightIdentity(),
@@ -75,7 +75,7 @@
         assertEquals(true,f.test(Boolean.TRUE,Boolean.TRUE));
         assertEquals(true,f.test(null,Boolean.TRUE));
     }
-    
+
     public void testEquals() throws Exception {
         BinaryPredicate f = new UnaryCompositeBinaryPredicate(
             new LeftIdentity(),

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryNot.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryNot.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryNot.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryNot.java Thu Apr  3 13:23:16 2008
@@ -60,14 +60,14 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testTest() throws Exception {
         UnaryPredicate truePred = new UnaryNot(new Constant(false));
         assertTrue(truePred.test(null));
         assertTrue(truePred.test("xyzzy"));
         assertTrue(truePred.test(new Integer(3)));
     }
-    
+
     public void testEquals() throws Exception {
         UnaryNot p = new UnaryNot(Constant.truePredicate());
         assertEquals(p,p);

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java Thu Apr  3 13:23:16 2008
@@ -60,64 +60,64 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testTrue() throws Exception {
         assertTrue((new UnaryOr(new Constant(true))).test("xyzzy"));
         assertTrue((new UnaryOr(new Constant(false),new Constant(true))).test("xyzzy"));
         assertTrue((new UnaryOr(new Constant(false),new Constant(false),new Constant(true))).test("xyzzy"));
-        
+
         UnaryOr p = new UnaryOr(new Constant(true));
-        assertTrue(p.test("xyzzy"));        
+        assertTrue(p.test("xyzzy"));
         for(int i=0;i<10;i++) {
             p.or(new Constant(i%2==0));
-            assertTrue(p.test("xyzzy"));        
+            assertTrue(p.test("xyzzy"));
         }
-        
+
         UnaryOr q = new UnaryOr(new Constant(true));
-        assertTrue(q.test("xyzzy"));        
+        assertTrue(q.test("xyzzy"));
         for(int i=0;i<10;i++) {
             q.or(new Constant(i%2==0));
-            assertTrue(q.test("xyzzy"));        
+            assertTrue(q.test("xyzzy"));
         }
-        
+
         UnaryOr r = new UnaryOr(p,q);
-        assertTrue(r.test("xyzzy"));        
+        assertTrue(r.test("xyzzy"));
     }
-    
+
     public void testFalse() throws Exception {
         assertTrue(!(new UnaryOr()).test("xyzzy"));
         assertTrue(!(new UnaryOr(new Constant(false))).test("xyzzy"));
         assertTrue(!(new UnaryOr(new Constant(false),new Constant(false))).test("xyzzy"));
         assertTrue(!(new UnaryOr(new Constant(false),new Constant(false),new Constant(false))).test("xyzzy"));
-        
+
         UnaryOr p = new UnaryOr(new Constant(false));
-        assertTrue(!p.test("xyzzy"));        
+        assertTrue(!p.test("xyzzy"));
         for(int i=0;i<10;i++) {
             p.or(new Constant(false));
-            assertTrue(!p.test("xyzzy"));        
+            assertTrue(!p.test("xyzzy"));
         }
-        
+
         UnaryOr q = new UnaryOr(new Constant(false));
-        assertTrue(!q.test("xyzzy"));        
+        assertTrue(!q.test("xyzzy"));
         for(int i=0;i<10;i++) {
             q.or(new Constant(false));
-            assertTrue(!q.test("xyzzy"));        
+            assertTrue(!q.test("xyzzy"));
         }
-        
+
         UnaryOr r = new UnaryOr(p,q);
-        assertTrue(!r.test("xyzzy"));        
+        assertTrue(!r.test("xyzzy"));
     }
-        
+
     public void testDuplicateAdd() throws Exception {
         UnaryPredicate p = new Constant(true);
         UnaryOr q = new UnaryOr(p,p);
         assertTrue(q.test("xyzzy"));
         for(int i=0;i<10;i++) {
             q.or(p);
-            assertTrue(q.test("xyzzy"));        
+            assertTrue(q.test("xyzzy"));
         }
     }
-        
+
     public void testEquals() throws Exception {
         UnaryOr p = new UnaryOr();
         assertEquals(p,p);
@@ -127,7 +127,7 @@
 
         UnaryAnd r = new UnaryAnd();
         assertObjectsAreNotEqual(p,r);
-        
+
         for(int i=0;i<3;i++) {
             p.or(Constant.truePredicate());
             assertObjectsAreNotEqual(p,q);
@@ -137,13 +137,13 @@
             assertObjectsAreNotEqual(p,r);
 
             p.or(new UnaryOr(Constant.truePredicate(),Constant.falsePredicate()));
-            assertObjectsAreNotEqual(p,q);            
+            assertObjectsAreNotEqual(p,q);
             q.or(new UnaryOr(Constant.truePredicate(),Constant.falsePredicate()));
-            assertObjectsAreEqual(p,q);            
+            assertObjectsAreEqual(p,q);
             r.and(new UnaryOr(Constant.truePredicate(),Constant.falsePredicate()));
             assertObjectsAreNotEqual(p,r);
         }
-        
+
         assertObjectsAreNotEqual(p,Constant.truePredicate());
     }
 

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java Thu Apr  3 13:23:16 2008
@@ -63,7 +63,7 @@
 
     // Tests
     // ------------------------------------------------------------------------
-    
+
     public void testRunZero() throws Exception {
         UnarySequence seq = new UnarySequence();
         seq.run(null);
@@ -92,11 +92,11 @@
         assertEquals(2,counter[0].count);
         assertEquals(2,counter[1].count);
     }
-    
+
     public void testThen() throws Exception {
         List list = new ArrayList();
         UnarySequence seq = new UnarySequence();
-        seq.run(null);        
+        seq.run(null);
         for(int i=0;i<10;i++) {
             RunCounter counter = new RunCounter();
             seq.then(counter);
@@ -107,7 +107,7 @@
             }
         }
     }
-    
+
     public void testEquals() throws Exception {
         UnarySequence p = new UnarySequence();
         assertEquals(p,p);
@@ -120,21 +120,21 @@
             q.then(new NoOp());
             assertObjectsAreEqual(p,q);
             p.then(new UnarySequence(new NoOp(),new NoOp()));
-            assertObjectsAreNotEqual(p,q);            
+            assertObjectsAreNotEqual(p,q);
             q.then(new UnarySequence(new NoOp(),new NoOp()));
-            assertObjectsAreEqual(p,q);            
+            assertObjectsAreEqual(p,q);
         }
-                
+
         assertObjectsAreNotEqual(p,new NoOp());
     }
 
     // Classes
     // ------------------------------------------------------------------------
-    
-    static class RunCounter implements UnaryProcedure {        
+
+    static class RunCounter implements UnaryProcedure {
         public void run(Object that) {
-            count++;    
-        }        
+            count++;
+        }
         public int count = 0;
     }
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java Thu Apr  3 13:23:16 2008
@@ -51,11 +51,11 @@
 /*
  * In this example, we'll demonstrate how we can use "pluggable" functors
  * to create specialized Map implementations via composition.
- * 
+ *
  * All our specializations will use the same basic Map implementation.
- * Once it is built, we'll only need to define the specialized behaviors. 
+ * Once it is built, we'll only need to define the specialized behaviors.
  */
- 
+
 /**
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
@@ -76,26 +76,26 @@
      * ----------------------------------------------------------------------------
      */
 
-    /* 
+    /*
      * In a "test first" style, let's first specify the Map behaviour we'd like
-     * to implement via unit tests. 
+     * to implement via unit tests.
      */
-     
+
     /*
      * First, let's review the basic Map functionality.
      */
-    
+
     /*
      * The basic Map interface lets one associate keys and values:
      */
     public void testBasicMap() {
         /* (We'll define these make*Map functions below.) */
-        Map map = makeBasicMap(); 
+        Map map = makeBasicMap();
         Object key = "key";
         Object value = new Integer(3);
         map.put(key,value);
         assertEquals(value, map.get(key) );
-    }    
+    }
 
     /*
      * If there is no value associated with a key,
@@ -104,11 +104,11 @@
     public void testBasicMapReturnsNullForMissingKey() {
         Map map = makeBasicMap();
         assertNull( map.get("key") );
-    }    
+    }
 
     /*
      * One can also explicitly store a null value for
-     * some key: 
+     * some key:
      */
     public void testBasicMapAllowsNull() {
         Map map = makeBasicMap();
@@ -116,7 +116,7 @@
         Object value = null;
         map.put(key,value);
         assertNull( map.get(key) );
-    }    
+    }
 
     /*
      * The basic Map deals with Objects--it can store keys
@@ -133,12 +133,12 @@
         assertEquals("value-2", map.get(new Integer(2)) );
         assertEquals(new Integer(3), map.get("key-3") );
         assertEquals(new Integer(4), map.get(new Integer(4)) );
-    }    
+    }
 
     /*
      * Finally, note that putting a second value for a given
      * key will overwrite the first value--the basic Map only
-     * stores the most recently put value for each key: 
+     * stores the most recently put value for each key:
      */
     public void testBasicMapStoresOnlyOneValuePerKey() {
         Map map = makeBasicMap();
@@ -147,19 +147,19 @@
         assertEquals("value-1", map.get("key") );
         assertEquals("value-1", map.put("key","value-2"));
         assertEquals("value-2", map.get("key") );
-    }    
-    
+    }
+
     /*
-     * Now let's look at some specializations of the Map behavior. 
+     * Now let's look at some specializations of the Map behavior.
      */
-    
+
     /*
-     * One common specialization is to forbid null values, 
-     * like our old friend Hashtable: 
+     * One common specialization is to forbid null values,
+     * like our old friend Hashtable:
      */
     public void testForbidNull() {
         Map map = makeNullForbiddenMap();
-        
+
         map.put("key","value");
         map.put("key2", new Integer(2) );
         try {
@@ -167,18 +167,18 @@
             fail("Expected NullPointerException");
         } catch(NullPointerException e) {
             // expected
-        }                
+        }
     }
 
     /*
      * Alternatively, we may want to provide a default
-     * value to return when null is associated with some 
+     * value to return when null is associated with some
      * key. (This might be useful, for example, when the Map
-     * contains a counter--when there's no count yet, we'll 
-     * want to treat it as zero.):  
+     * contains a counter--when there's no count yet, we'll
+     * want to treat it as zero.):
      */
     public void testNullDefaultsToZero() {
-        Map map = makeDefaultValueForNullMap(new Integer(0));        
+        Map map = makeDefaultValueForNullMap(new Integer(0));
         /*
          * We expect 0 when no value has been associated with "key".
          */
@@ -196,30 +196,30 @@
      */
 	public void testIntegerValuesOnly() {
 		Map map = makeTypeConstrainedMap(Integer.class);
-		map.put("key", new Integer(2));        
+		map.put("key", new Integer(2));
 		assertEquals( new Integer(2), map.get("key") );
 		try {
 			map.put("key2","value");
 			fail("Expected ClassCastException");
 		} catch(ClassCastException e) {
 			// expected
-		}                		
+		}
 	}
 
     /*
-     * A more interesting specialization is that used by the 
-     * Apache Commons Collections MultiMap class, which allows 
+     * A more interesting specialization is that used by the
+     * Apache Commons Collections MultiMap class, which allows
      * one to associate multiple values with each key.  The put
      * function still accepts a single value, but the get function
      * will return a Collection of values.  Associating multiple values
      * with a key adds to that collection, rather than overwriting the
-     * previous value: 
+     * previous value:
      */
 	public void testMultiMap() {
 		Map map = makeMultiMap();
 
 		map.put("key", "value 1");
-		
+
 		{
 			Collection result = (Collection)(map.get("key"));
 			assertEquals(1,result.size());
@@ -250,11 +250,11 @@
 	}
 
     /*
-     * Here's another variation on the MultiMap theme.  
-     * Rather than adding elements to a Collection, let's 
+     * Here's another variation on the MultiMap theme.
+     * Rather than adding elements to a Collection, let's
      * concatenate String values together, delimited by commas.
      * (Such a Map might be used by the Commons Collection's
-     * ExtendedProperties type.): 
+     * ExtendedProperties type.):
      */
 	public void testStringConcatMap() {
 		Map map = makeStringConcatMap();
@@ -274,30 +274,30 @@
 
     /*
      * How can one Map implementation support all these behaviors?
-     * Using functors and composition, of course.  
-     * 
-     * In order to keep our example small, we'll just consider the 
+     * Using functors and composition, of course.
+     *
+     * In order to keep our example small, we'll just consider the
      * primary Map.put and Map.get methods here, although the remaining
-     * Map methods could be handled similiarly.    
+     * Map methods could be handled similiarly.
      */
     static class FlexiMap implements Map {
 
         /*
-         * Our FlexiMap will accept two BinaryFunctions, one 
+         * Our FlexiMap will accept two BinaryFunctions, one
          * that's used to transform objects being put into the Map,
-         * and one that's used to transforms objects being retrieved 
+         * and one that's used to transforms objects being retrieved
          * from the map.
          */
         public FlexiMap(BinaryFunction putfn, BinaryFunction getfn) {
             onPut = null == putfn ? RightIdentity.instance() : putfn;
             onGet = null == getfn ? RightIdentity.instance() : getfn;
             proxiedMap = new HashMap();
-        }        
+        }
+
 
-        
         /*
-         * The arguments to our "onGet" function will be the 
-         * key and the value associated with that key in the 
+         * The arguments to our "onGet" function will be the
+         * key and the value associated with that key in the
          * underlying Map.  We'll return whatever the function
          * returns.
          */
@@ -306,12 +306,12 @@
         }
 
         /*
-         * The arguments to our "onPut" function will be the 
+         * The arguments to our "onPut" function will be the
          * value previously associated with that key (if any),
          * as well as the new value being associated with that key.
-         * 
-         * Since put returns the previously associated value, 
-         * we'll invoke onGet here as well. 
+         *
+         * Since put returns the previously associated value,
+         * we'll invoke onGet here as well.
          */
         public Object put(Object key, Object value) {
             Object oldvalue = proxiedMap.get(key);
@@ -319,10 +319,10 @@
             return onGet.evaluate(key,oldvalue);
         }
 
-       /* 
-        * We'll skip the remaining Map methods for now.    
+       /*
+        * We'll skip the remaining Map methods for now.
         */
-        
+
         public void clear() {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
@@ -377,14 +377,14 @@
     /*
      * For the "basic" Map, we'll simply create a HashMap.
      * Note that using a RightIdentity for onPut and onGet
-     * would yield the same behavior. 
+     * would yield the same behavior.
      */
     private Map makeBasicMap() {
         return new HashMap();
     }
-    
+
     /*
-     * To prohibit null values, we'll only need to 
+     * To prohibit null values, we'll only need to
      * provide an onPut function.
      */
     private Map makeNullForbiddenMap() {
@@ -392,22 +392,22 @@
             /*
              * We simply ignore the left-hand argument,
              */
-            IgnoreLeftFunction.adapt(                  
+            IgnoreLeftFunction.adapt(
                 /*
                  * and for the right-hand,
-                 */      
+                 */
                 Conditional.function(
                     /*
                      * we'll test for null,
-                     */      
+                     */
                     IsNull.instance(),
                     /*
                      * throwing a NullPointerException when the value is null,
-                     */      
+                     */
                     throwNPE,
                     /*
                      * and passing through all non-null values.
-                     */      
+                     */
                     Identity.instance()
                 )
             ),
@@ -416,7 +416,7 @@
     }
 
     /*
-     * To provide a default for null values, we'll only need to 
+     * To provide a default for null values, we'll only need to
      * provide an onGet function, simliar to the onPut method used
      * above.
      */
@@ -426,22 +426,22 @@
             /*
              * We ignore the left-hand argument,
              */
-			IgnoreLeftFunction.adapt(                        
+			IgnoreLeftFunction.adapt(
                 /*
                  * and for the right-hand,
-                 */      
+                 */
 				Conditional.function(
                     /*
                      * we'll test for null,
-                     */      
+                     */
 					IsNull.instance(),
                     /*
                      * returning our default when the value is otherwise null,
-                     */      
+                     */
 					new Constant(defaultValue),
                     /*
                      * and passing through all non-null values.
-                     */      
+                     */
 					Identity.instance()
 				)
 			)
@@ -449,7 +449,7 @@
 	}
 
     /*
-     * To constrain the value types, we'll 
+     * To constrain the value types, we'll
      * provide an onPut function,
      */
 	private Map makeTypeConstrainedMap(Class clazz) {
@@ -457,19 +457,19 @@
             /*
              * ignore the left-hand argument,
              */
-			IgnoreLeftFunction.adapt(                        
+			IgnoreLeftFunction.adapt(
 				Conditional.function(
                     /*
                      * we'll test the type of the right-hand argument,
-                     */      
+                     */
 					new IsInstanceOf(clazz),
                     /*
                      * and either pass the given value through,
-                     */      
+                     */
 					Identity.instance(),
                     /*
                      * or throw a ClassCastException.
-                     */      
+                     */
 					throwCCE
 				)
 			),
@@ -539,14 +539,14 @@
 	}
 
     /*
-     * (This "UniversalFunctor" type provides a functor 
+     * (This "UniversalFunctor" type provides a functor
      * that takes the same action regardless of the number of
-     * parameters. We used it above to throw Exceptions when 
+     * parameters. We used it above to throw Exceptions when
      * needed.)
      */
-     
-    private abstract class UniversalFunctor implements 
-        Procedure, UnaryProcedure, BinaryProcedure, 
+
+    private abstract class UniversalFunctor implements
+        Procedure, UnaryProcedure, BinaryProcedure,
         Function, UnaryFunction, BinaryFunction {
         public abstract void run();
 
@@ -575,11 +575,11 @@
 			throw new NullPointerException();
 		}
 	};
-    
+
 	private UniversalFunctor throwCCE = new UniversalFunctor() {
 		public void run() {
 			throw new ClassCastException();
 		}
 	};
-    
+
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java Thu Apr  3 13:23:16 2008
@@ -40,20 +40,20 @@
  * ----------------------------------------------------------------------------
  */
 
-/* 
+/*
  * Here's an example of the Quicksort sorting algorithm, implemented using
  * Commons Functor.
- * 
- * See http://commons.apache.org/sandbox/functor/examples.html 
+ *
+ * See http://commons.apache.org/sandbox/functor/examples.html
  * for additional examples.
  */
 
 /**
- * An example of implementing the quicksort sorting algorithm 
+ * An example of implementing the quicksort sorting algorithm
  * using commons-functor.
- * <p> 
+ * <p>
  * See the extensive in line comments for details.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -82,13 +82,13 @@
 /*
  * In "test first" style, let's start with the some functional descriptions
  * of what'd we'd like our Quicksort to do, expressed as unit tests.
- * 
+ *
  * In our tests, we'll use a "quicksort" method which takes a List and
  * returns a (new) sorted List.  We'll define that method a bit later.
  *
- * 
+ *
  * First, let's get some trivial cases out of the way.
- * 
+ *
  * Sorting an empty List should produce an empty list:
  */
 
@@ -110,12 +110,12 @@
         List sorted = quicksort(list);
 
         assertTrue(
-            "The quicksort() method should return a distinct list.", 
+            "The quicksort() method should return a distinct list.",
             list != sorted);
 
         assertEquals(
-            "Sorting a single-element list should produce an equivalent list", 
-            list, 
+            "Sorting a single-element list should produce an equivalent list",
+            list,
             sorted);
     }
 
@@ -132,7 +132,7 @@
         List sorted = quicksort(list);
 
         assertTrue(
-            "The quicksort() method should return a distinct list.", 
+            "The quicksort() method should return a distinct list.",
             list != sorted);
 
         assertEquals(list, sorted);
@@ -140,9 +140,9 @@
 
 /*
  * So far so good.
- * 
+ *
  * Next, let's take some slightly more complicated cases.
- * 
+ *
  * Sorting an already sorted list:
  */
     public void testSortSorted() {
@@ -154,17 +154,17 @@
         List sorted = quicksort(list);
 
         assertTrue(
-            "The quicksort() method should return a distinct list.", 
+            "The quicksort() method should return a distinct list.",
             list != sorted);
 
         assertEquals(
-            "Sorting an already sorted list should produce an equivalent list", 
-            list, 
+            "Sorting an already sorted list should produce an equivalent list",
+            list,
             sorted);
     }
 
 /*
- * Sorting a reverse-order list (finally, a test case that requires something 
+ * Sorting a reverse-order list (finally, a test case that requires something
  * more than an identity function):
  */
     public void testSortReversed() {
@@ -221,9 +221,9 @@
     }
 
 /*
- * Finally, while this quicksort implementation is intended to 
+ * Finally, while this quicksort implementation is intended to
  * illustrate the use of Commons Functor, not for performance,
- * let's output some timings just to demonstrate that the 
+ * let's output some timings just to demonstrate that the
  * performance is adequate.
  */
 
@@ -312,19 +312,19 @@
  * Our quicksort method will invoke a UnaryFunction named
  * quicksort:
  */
- 
+
     public List quicksort(List list) {
         return (List)(quicksort.evaluate(list));
     }
 
 /*
  * The quicksort sorting algorithm can be summarized as follows:
- * 
+ *
  * Given a list of elements to be sorted:
- * 
+ *
  * A) If the list is empty, consider it already sorted.
- * 
- * B) If the list is non-empty, we can sort it by first splitting it into 
+ *
+ * B) If the list is non-empty, we can sort it by first splitting it into
  *   three lists:
  *     1) one list containing only the first element in the list (the "head")
  *     2) one (possibly empty) list containing every element in the remaining
@@ -343,14 +343,14 @@
     private UnaryFunction quicksort = new ConditionalUnaryFunction(
         /* if the list is empty... */
         IsEmpty.instance(),
-        /* ...then return an empty list... */     
-        new Constant(Collections.EMPTY_LIST), 
+        /* ...then return an empty list... */
+        new Constant(Collections.EMPTY_LIST),
         /* ...else, apply the following function... */
-        new ListFunction() {                                   
+        new ListFunction() {
             public Object evaluate(List list) {
                 /* Create a list to contain the results. */
                 List result = new ArrayList(list.size());
-                /* 
+                /*
                  * Recursively apply quicksort the the elements in the
                  * tail less than the head, adding the result to the
                  * sorted list we're generating.
@@ -358,13 +358,13 @@
                 result.addAll(
                     (List)quicksort.evaluate(
                         lesserTail.evaluate(
-                            head.evaluate(list), 
+                            head.evaluate(list),
                             tail.evaluate(list))));
-                /* 
+                /*
                  * Add the head to the sorted list we're generating.
                  */
                 result.add(head.evaluate(list));
-                /* 
+                /*
                  * Recursively apply quicksort the the elements in the
                  * tail greater than the head, adding the result to the
                  * sorted list we're generating.
@@ -372,9 +372,9 @@
                 result.addAll(
                     (List)quicksort.evaluate(
                         greaterTail.evaluate(
-                            head.evaluate(list), 
+                            head.evaluate(list),
                             tail.evaluate(list))));
-                /* 
+                /*
                  * And return the generated list.
                  */
                 return result;
@@ -382,12 +382,12 @@
     });
 
 /*
- * Now let's look at the building blocks we need to flesh out that 
+ * Now let's look at the building blocks we need to flesh out that
  * function.
- * 
+ *
  * First, let's save ourselves some casting and error handling by
  * definining some functor sub-types.
- * 
+ *
  * Let ListFunction be a UnaryFunction that operates on Lists:
  */
 
@@ -401,17 +401,17 @@
                 throw new NullPointerException("The argument must not be null.");
             } else {
                 throw new ClassCastException(
-                    "The argument must be a List, found " + 
+                    "The argument must be a List, found " +
                     obj.getClass().getName());
             }
         }
     }
 
 /*
- * Let ObjectListFunction be a BinaryFunction that operates on 
+ * Let ObjectListFunction be a BinaryFunction that operates on
  * an Object, List pair:
  */
- 
+
     public abstract class ObjectListFunction implements BinaryFunction {
         public abstract Object evaluate(Object head, List tail);
 
@@ -424,15 +424,15 @@
                 throw new NullPointerException("The right argument must not be null.");
             } else {
                 throw new ClassCastException(
-                    "The right argument must be a List, found " + 
+                    "The right argument must be a List, found " +
                     right.getClass().getName());
             }
         }
     }
 
-/* 
+/*
  * Now for the implementations.
- * 
+ *
  * Given a List, we need to be able to break it into its head:
  */
 
@@ -442,21 +442,21 @@
         }
     };
 
-/* 
+/*
  * and its tail:
  */
     private UnaryFunction tail = new ListFunction() {
         public Object evaluate(List list) {
-            return list.size() < 2 ? 
-                Collections.EMPTY_LIST : 
+            return list.size() < 2 ?
+                Collections.EMPTY_LIST :
                 list.subList(1, list.size());
         }
     };
 
-/* 
+/*
  * Given a List in head/tail form, we should be able to find
  * the list of elements in the tail less than the head.
- * We can simply apply the select algorithm here, using 
+ * We can simply apply the select algorithm here, using
  * a predicate identifying elements less than the head.
  */
     private BinaryFunction lesserTail = new ObjectListFunction() {
@@ -467,9 +467,9 @@
         }
     };
 
-/* 
- * We must also be able to find the List of elements in 
- * the tail greater than (or equal to) the head. This 
+/*
+ * We must also be able to find the List of elements in
+ * the tail greater than (or equal to) the head. This
  * is similar to the lesserTail approach.
  */
     private BinaryFunction greaterTail = new ObjectListFunction() {
@@ -484,7 +484,7 @@
  * Note that each of these smaller functors is readily testable
  * in isolation:
  */
- 
+
     public void testHeadFunction() {
         List list = new ArrayList();
         try {
@@ -493,38 +493,38 @@
         } catch(IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         list.add("First");
         assertEquals("First",head.evaluate(list));
 
         list.add("Second");
         assertEquals("First",head.evaluate(list));
-        
+
     }
-    
+
     public void testTailFunction() {
         List list = new ArrayList();
         {
             List result = (List)(tail.evaluate(list));
-            assertTrue("Tail of an empty list is empty.",result.isEmpty()); 
+            assertTrue("Tail of an empty list is empty.",result.isEmpty());
         }
         list.add("First");
         {
             List result = (List)(tail.evaluate(list));
-            assertTrue("Tail of a one element list is empty.",result.isEmpty()); 
+            assertTrue("Tail of a one element list is empty.",result.isEmpty());
         }
         list.add("Second");
         {
             List result = (List)(tail.evaluate(list));
             assertEquals("Tail of a two element list has one element.",1,result.size());
-            assertEquals("Second",result.get(0)); 
+            assertEquals("Second",result.get(0));
         }
         list.add("Third");
         {
             List result = (List)(tail.evaluate(list));
             assertEquals("Tail of a three element list has two elements.",2,result.size());
-            assertEquals("Second",result.get(0)); 
-            assertEquals("Third",result.get(1)); 
+            assertEquals("Second",result.get(0));
+            assertEquals("Third",result.get(1));
         }
     }
 

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/TestAll.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/TestAll.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/TestAll.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/TestAll.java Thu Apr  3 13:23:16 2008
@@ -38,7 +38,7 @@
         suite.addTest(org.apache.commons.functor.example.lines.TestAll.suite());
         suite.addTest(org.apache.commons.functor.example.map.TestAll.suite());
         suite.addTest(org.apache.commons.functor.example.kata.TestAll.suite());
-        
+
         return suite;
     }
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java Thu Apr  3 13:23:16 2008
@@ -21,7 +21,7 @@
 /**
  * Evaluates to the absolute Integer value of the Number-valued
  * input parameter.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -37,6 +37,6 @@
     public static final Abs instance() {
         return INSTANCE;
     }
-    
+
     private static final Abs INSTANCE = new Abs();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/DataMunger.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/DataMunger.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/DataMunger.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/DataMunger.java Thu Apr  3 13:23:16 2008
@@ -36,9 +36,9 @@
 
 /**
  * The real workhorse of this Kata excercise.
- * 
+ *
  * DataMunger wires together various functors and exposes them
- * as static utility methhods. 
+ * as static utility methhods.
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -49,7 +49,7 @@
     }
 
 	/**
-	 * Processes each line of the given Reader, returning the <i>selected</i> column for the 
+	 * Processes each line of the given Reader, returning the <i>selected</i> column for the
 	 * line where the absolute difference between the integer value of <i>col1</i> and <i>col2</i>
 	 * is least.  Note that lines that don't begin with an Integer are ignored.
 	 */
@@ -57,20 +57,20 @@
         return NthColumn.instance(selected).evaluate(
             Algorithms.inject(
                 Lines.from(file).where(
-                    Composite.predicate(IsInteger.instance(),NthColumn.instance(0))),                    
+                    Composite.predicate(IsInteger.instance(),NthColumn.instance(0))),
                 null,
-                lesserSpread(col1,col2)));            
+                lesserSpread(col1,col2)));
     }
-    
 
-    /** 
+
+    /**
      * A BinaryFunction that will calcuate the absolute
-     * difference between col1 and col2 in the given 
+     * difference between col1 and col2 in the given
      * String arguments, and return the argument
      * whose difference is smallest.
      */
     private static final BinaryFunction lesserSpread(final int col1, final int col2) {
-        return new ConditionalBinaryFunction(            
+        return new ConditionalBinaryFunction(
             IsNull.left(),                                 // if left is null
             RightIdentity.instance(),                      //   return right
             Conditional.function(                          //   else return the parameter with the least spread
@@ -79,13 +79,13 @@
                     absSpread(col1,col2),
                     absSpread(col1,col2)),
                 LeftIdentity.instance(),                   //       return left
-                RightIdentity.instance()                   //       else return right 
+                RightIdentity.instance()                   //       else return right
             )
         );
     }
 
 	/**
-	 * A UnaryFunction that returns the absolute value of the difference 
+	 * A UnaryFunction that returns the absolute value of the difference
 	 * between the Integers stored in the <i>col1</i> and <i>col2</i>th
 	 * whitespace delimited columns of the input line (a String).
 	 */

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/IsInteger.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/IsInteger.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/IsInteger.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/IsInteger.java Thu Apr  3 13:23:16 2008
@@ -21,7 +21,7 @@
 /**
  * Tests to true iff the input object can be converted to
  * an Integer by {@link ToInteger}.
- *  
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -34,10 +34,10 @@
             return false;
         }
     }
-    
+
     public static final IsInteger instance() {
         return INSTANCE;
     }
-    
+
     private static final IsInteger INSTANCE = new IsInteger();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java Thu Apr  3 13:23:16 2008
@@ -23,7 +23,7 @@
 /**
  * Evaluates the input String to extrace the nth whitespace
  * delmited column.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -31,7 +31,7 @@
     public NthColumn(int n) {
         this.n = n;
     }
-    
+
     public Object evaluate(Object obj) {
         StringTokenizer toker = new StringTokenizer((String)obj);
         for(int count = 0; count < n && toker.hasMoreTokens();count++) {

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestAll.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestAll.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestAll.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestAll.java Thu Apr  3 13:23:16 2008
@@ -23,7 +23,7 @@
 /**
  * See http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestSoccer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestSoccer.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestSoccer.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestSoccer.java Thu Apr  3 13:23:16 2008
@@ -23,7 +23,7 @@
 /**
  * See http://pragprog.com/pragdave/Practices/Kata/KataFour.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -35,13 +35,13 @@
     public static Test suite() {
         return new TestSuite(TestSoccer.class);
     }
-    
+
     public void testProcess() {
     	// for our soccer example, we want to select the second column of the
     	// line with the minimal difference between the seventh and ninth columns.
         assertEquals(
             "Aston_Villa",
-            DataMunger.process(getClass().getResourceAsStream("soccer.txt"),1,6,8));            
+            DataMunger.process(getClass().getResourceAsStream("soccer.txt"),1,6,8));
     }
 
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestWeather.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestWeather.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestWeather.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/TestWeather.java Thu Apr  3 13:23:16 2008
@@ -23,7 +23,7 @@
 /**
  * See http://pragprog.com/pragdave/Practices/Kata/KataFour.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -41,7 +41,7 @@
 		// line with the minimal difference between the second and third columns.
         assertEquals(
             "14",
-            DataMunger.process(getClass().getResourceAsStream("weather.txt"),0,1,2));            
+            DataMunger.process(getClass().getResourceAsStream("weather.txt"),0,1,2));
     }
 
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java Thu Apr  3 13:23:16 2008
@@ -19,12 +19,12 @@
 import org.apache.commons.functor.UnaryFunction;
 
 /**
- * Converts a String value to an Integer, throwing 
+ * Converts a String value to an Integer, throwing
  * an exception if no such conversion can be made.
- * 
+ *
  * Trailing, non-{@link Character#isDigit digit} characters
  * are ignored.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -48,10 +48,10 @@
             throw new NumberFormatException(str);
         }
     }
-    
+
     public static final ToInteger instance() {
         return INSTANCE;
     }
-    
+
     private static final ToInteger INSTANCE = new ToInteger();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java Thu Apr  3 13:23:16 2008
@@ -32,7 +32,7 @@
     public Object evaluate(Number left, Number right) {
         return new Integer(left.intValue() + right.intValue());
     }
-    
+
     public static Add instance() {
         return INSTANCE;
     }
@@ -40,6 +40,6 @@
     public static UnaryFunction to(int factor) {
         return new LeftBoundFunction(instance(),new Integer(factor));
     }
-    
+
     private static Add INSTANCE = new Add();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java Thu Apr  3 13:23:16 2008
@@ -31,7 +31,7 @@
             this.function = f;
         }
     }
-    
+
     public Object evaluate(Object obj) {
         return function.evaluate(obj,obj);
     }
@@ -39,7 +39,7 @@
     public static UnaryFunction adapt(BinaryFunction f) {
         return null == f ? null : new BinaryFunctionUnaryFunction(f);
     }
-    
+
     private BinaryFunction function;
 
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java Thu Apr  3 13:23:16 2008
@@ -32,7 +32,7 @@
     public Object evaluate(Number left, Number right) {
         return new Integer(left.intValue() / right.intValue());
     }
-    
+
     public static Divide instance() {
         return INSTANCE;
     }
@@ -40,6 +40,6 @@
     public static UnaryFunction by(int factor) {
         return new RightBoundFunction(instance(),new Integer(factor));
     }
-    
+
     private static Divide INSTANCE = new Divide();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java Thu Apr  3 13:23:16 2008
@@ -32,7 +32,7 @@
     public Object evaluate(Number left, Number right) {
         return new Integer(left.intValue() % right.intValue());
     }
-    
+
     public static Mod instance() {
         return INSTANCE;
     }
@@ -40,6 +40,6 @@
     public static UnaryFunction by(int factor) {
         return new RightBoundFunction(instance(),new Integer(factor));
     }
-    
+
     private static Mod INSTANCE = new Mod();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java Thu Apr  3 13:23:16 2008
@@ -24,7 +24,7 @@
     public Money(int cents) {
         this.cents = cents;
     }
-    
+
     public int getValueAsCents() {
         return cents;
     }
@@ -41,11 +41,10 @@
     public int hashCode() {
         return getValueAsCents();
     }
-    
+
     public String toString() {
         return getValueAsCents() + " cents";
     }
 
     private int cents;
 }
- 
\ No newline at end of file

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java Thu Apr  3 13:23:16 2008
@@ -32,7 +32,7 @@
     public Object evaluate(Number left, Number right) {
         return new Integer(left.intValue() * right.intValue());
     }
-    
+
     public static Multiply instance() {
         return INSTANCE;
     }
@@ -40,6 +40,6 @@
     public static UnaryFunction by(int factor) {
         return new LeftBoundFunction(instance(),new Integer(factor));
     }
-    
+
     private static Multiply INSTANCE = new Multiply();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java Thu Apr  3 13:23:16 2008
@@ -32,7 +32,7 @@
     public Object evaluate(Number left, Number right) {
         return new Integer(left.intValue() - right.intValue());
     }
-    
+
     public static Subtract instance() {
         return INSTANCE;
     }
@@ -40,6 +40,6 @@
     public static UnaryFunction from(int factor) {
         return new LeftBoundFunction(instance(),new Integer(factor));
     }
-    
+
     private static Subtract INSTANCE = new Subtract();
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java Thu Apr  3 13:23:16 2008
@@ -29,25 +29,25 @@
 import org.apache.commons.functor.core.composite.ConditionalUnaryFunction;
 
 /**
- * Dave Thomas's Kata One asks us to think about how one might 
- * implement pricing rules:  
- * 
- * "Some things in supermarkets have simple prices: this can of 
- * beans costs $0.65. Other things have more complex prices. 
+ * Dave Thomas's Kata One asks us to think about how one might
+ * implement pricing rules:
+ *
+ * "Some things in supermarkets have simple prices: this can of
+ * beans costs $0.65. Other things have more complex prices.
  * For example:
  *
  * o three for a dollar (so what?s the price if I buy 4, or 5?)
  *
  * o $1.99/pound (so what does 4 ounces cost?)
- * 
+ *
  * o buy two, get one free (so does the third item have a price?)"
- * 
+ *
  * Functors provide one approach to this sort of problem, and in
  * this example we'll demonstrate some simple cases.
- *  
+ *
  * See http://pragprog.com/pragdave/Practices/Kata/KataOne.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -59,27 +59,27 @@
     public static Test suite() {
         return new TestSuite(SupermarketPricingExample.class);
     }
-    
+
     public void setUp() throws Exception {
         super.setUp();
     }
-    
+
     public void tearDown() throws Exception {
         super.tearDown();
     }
-    
+
     // tests
     //----------------------------------------------------------
-    
+
     /*
      * The simplest form of pricing is simply a constant
      * rate.  In Dave's example, a can of beans costs $0.65,
      * and n cans of beans cost n*0.65.
-     * 
+     *
      * This pricing rule simply multiplies the quantity by
      * a constant, e.g.:
      *   ToMoney.from(Multiply.by(65))
-     * 
+     *
      * This case is so common, we may want to introduce a
      * special Product constructor to wrap up create the
      * functors for us.
@@ -87,7 +87,7 @@
     public void testConstantPricePerUnit() throws Exception {
         {
             Product beans = new Product(
-                "Can of Beans", 
+                "Can of Beans",
                 "SKU-0001",
                 ToMoney.from(Multiply.by(65)));
 
@@ -99,7 +99,7 @@
         // or, using the speical constructor:
         {
             Product beans = new Product(
-                "Can of Beans", 
+                "Can of Beans",
                 "SKU-0001",
                 65);
 
@@ -111,29 +111,29 @@
     }
 
     /*
-     * A slighly more complicated example is a bulk 
+     * A slighly more complicated example is a bulk
      * discount.  For example, bananas may be
      * $0.33 cents each, or 4 for a dollar ($1.00).
-     * 
+     *
      * This rule is underspecified by itself, there are
      * at least two ways to interpret this pricing rule:
-     * 
-     * a) the cost is $0.33 cents for 3 or fewer, $0.25 
+     *
+     * a) the cost is $0.33 cents for 3 or fewer, $0.25
      *    for 4 or more
-     * 
+     *
      * or
-     *  
+     *
      * b) the cost is $1.00 for every group of 4, $0.33
      *    each for anything left over
-     * 
-     * although I think in practice, "4 for a dollar" 
+     *
+     * although I think in practice, "4 for a dollar"
      * usually means the former and not the latter.
      *
      * We can implement either:
-     */    
+     */
     public void testFourForADollar_A() throws Exception {
         Product banana = new Product(
-            "Banana", 
+            "Banana",
             "SKU-0002",
             ToMoney.from(
                 new ConditionalUnaryFunction(
@@ -155,7 +155,7 @@
 
     public void testFourForADollar_B() throws Exception {
         Product banana = new Product(
-            "Banana", 
+            "Banana",
             "SKU-0002",
             ToMoney.from(
                 new BinaryFunctionUnaryFunction(
@@ -182,18 +182,18 @@
 
 
     /*
-     * Another interesting pricing rule is 
-     * something like "buy 2, get 1 free". 
-     * 
+     * Another interesting pricing rule is
+     * something like "buy 2, get 1 free".
+     *
      * This may be implemented using a formula
      * like:
      *   costPerUnit * (quantity - quantity / 2)
-     *  
+     *
      * For example...
-     */    
+     */
     public void testBuyTwoGetOneFree_1() throws Exception {
         Product apple = new Product(
-            "Apple", 
+            "Apple",
             "SKU-0003",
             ToMoney.from(
                 new CompositeUnaryFunction(
@@ -206,8 +206,8 @@
 
         assertEquals(new Money(0*40),apple.getPrice(0));
         assertEquals(new Money(1*40),apple.getPrice(1));
-        assertEquals(new Money(2*40),apple.getPrice(2));       
-        assertEquals(new Money(2*40),apple.getPrice(3)); 
+        assertEquals(new Money(2*40),apple.getPrice(2));
+        assertEquals(new Money(2*40),apple.getPrice(3));
         assertEquals(new Money(3*40),apple.getPrice(4));
         assertEquals(new Money(4*40),apple.getPrice(5));
         assertEquals(new Money(4*40),apple.getPrice(6));
@@ -219,12 +219,12 @@
 
     /*
      * ...but our pricing rule is starting to get ugly,
-     * and we haven't even considered things 
-     * something like "buy 3, get 2 free", etc. 
-     * 
+     * and we haven't even considered things
+     * something like "buy 3, get 2 free", etc.
+     *
      * Perhaps a special UnaryFunction instance is in
      * order:
-     */    
+     */
 
     class BuyNGetMFree implements UnaryFunction {
        public BuyNGetMFree(int n, int m, int costPerUnit) {
@@ -232,41 +232,41 @@
            this.m = m;
            this.costPerUnit = costPerUnit;
        }
-        
+
        public Object evaluate(Object obj) {
            return evaluate((Number)obj);
        }
-                    
+
        public Object evaluate(Number num) {
            int quantity = num.intValue();
            int cost = 0;
-           
+
            while(quantity >= n) {
                // buy n
                cost += n * costPerUnit;
                quantity -= n;
-               // get m (or fewer) free 
-               quantity -= Math.min(quantity,m);                                  
+               // get m (or fewer) free
+               quantity -= Math.min(quantity,m);
            }
            // buy less than n
            cost += quantity * costPerUnit;
-           
+
            return new Integer(cost);
        }
-        
-       private int n, m, costPerUnit;        
+
+       private int n, m, costPerUnit;
    }
 
     public void testBuyTwoGetOneFree_2() throws Exception {
         Product apple = new Product(
-            "Apple", 
+            "Apple",
             "SKU-0003",
             ToMoney.from(new BuyNGetMFree(2,1,40)));
-            
+
         assertEquals(new Money(0*40),apple.getPrice(0));
         assertEquals(new Money(1*40),apple.getPrice(1));
-        assertEquals(new Money(2*40),apple.getPrice(2));       
-        assertEquals(new Money(2*40),apple.getPrice(3)); 
+        assertEquals(new Money(2*40),apple.getPrice(2));
+        assertEquals(new Money(2*40),apple.getPrice(3));
         assertEquals(new Money(3*40),apple.getPrice(4));
         assertEquals(new Money(4*40),apple.getPrice(5));
         assertEquals(new Money(4*40),apple.getPrice(6));
@@ -278,14 +278,14 @@
 
    public void testBuyThreeGetTwoFree() throws Exception {
         Product apple = new Product(
-            "Apple", 
+            "Apple",
             "SKU-0003",
             ToMoney.from(new BuyNGetMFree(3,2,40)));
-            
+
         assertEquals(new Money(0*40),apple.getPrice(0));
         assertEquals(new Money(1*40),apple.getPrice(1));
-        assertEquals(new Money(2*40),apple.getPrice(2));       
-        assertEquals(new Money(3*40),apple.getPrice(3)); 
+        assertEquals(new Money(2*40),apple.getPrice(2));
+        assertEquals(new Money(3*40),apple.getPrice(3));
         assertEquals(new Money(3*40),apple.getPrice(4));
         assertEquals(new Money(3*40),apple.getPrice(5));
         assertEquals(new Money(4*40),apple.getPrice(6));
@@ -298,14 +298,14 @@
 
     public void testBuyTwoGetFiveFree() throws Exception {
          Product apple = new Product(
-             "Apple", 
+             "Apple",
              "SKU-0003",
              ToMoney.from(new BuyNGetMFree(2,5,40)));
-            
+
          assertEquals(new Money(0*40),apple.getPrice(0));
          assertEquals(new Money(1*40),apple.getPrice(1));
-         assertEquals(new Money(2*40),apple.getPrice(2));       
-         assertEquals(new Money(2*40),apple.getPrice(3)); 
+         assertEquals(new Money(2*40),apple.getPrice(2));
+         assertEquals(new Money(2*40),apple.getPrice(3));
          assertEquals(new Money(2*40),apple.getPrice(4));
          assertEquals(new Money(2*40),apple.getPrice(5));
          assertEquals(new Money(2*40),apple.getPrice(6));

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/TestAll.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/TestAll.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/TestAll.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/TestAll.java Thu Apr  3 13:23:16 2008
@@ -23,7 +23,7 @@
 /**
  * See http://pragprog.com/pragdave/Practices/Kata/KataOne.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java Thu Apr  3 13:23:16 2008
@@ -31,7 +31,7 @@
     public Object evaluate(Number cents) {
         return new Money(cents.intValue());
     }
-    
+
     public static ToMoney instance() {
         return INSTANCE;
     }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java Thu Apr  3 13:23:16 2008
@@ -22,7 +22,7 @@
 /**
  * See http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -38,7 +38,7 @@
     public int find(Object seeking, Object[] in) {
         return find(seeking, Arrays.asList(in));
     }
-    
+
     protected static int compare(List list, int index, Object obj) {
         return ((Comparable)list.get(index)).compareTo(obj);
     }
@@ -50,8 +50,8 @@
     protected static boolean equals(List list, int index, Object obj) {
         return compare(list,index,obj) == 0;
     }
-    
+
     protected static final Integer NEGATIVE_ONE = new Integer(-1);
-    
+
     public abstract int find(Object seeking, List in);
-} 
\ No newline at end of file
+}
\ No newline at end of file

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java Thu Apr  3 13:23:16 2008
@@ -21,7 +21,7 @@
 /**
  * See http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java Thu Apr  3 13:23:16 2008
@@ -27,18 +27,18 @@
  * <pre>
  * new EiffelStyleLoop()
  *   .from(new Procedure() { public void run() {} }) // init code
- *   .invariant(new Predicate() { public boolean test() {} }) // invariants 
- *   .variant(new Procedure() { public Object evaluate() {} }) // diminishing comparable value 
+ *   .invariant(new Predicate() { public boolean test() {} }) // invariants
+ *   .variant(new Procedure() { public Object evaluate() {} }) // diminishing comparable value
  *   // or
- *   // .variant(new Predicate() { public boolean test() {} }) // more invariants 
+ *   // .variant(new Predicate() { public boolean test() {} }) // more invariants
  *   .until(new Predicate() { public boolean test() {} }) // terminating condition
  *   .loop(new Procedure() { public void run() {} }) // the acutal loop
  *   .run();
  * </pre>
- * 
+ *
  * Note that <tt>new EiffelStyleLoop().run()</tt> executes just fine.
  * You only need to set the parts of the loop you want to use.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -67,12 +67,12 @@
                     result = last.compareTo(next) > 0;
                 }
                 last = next;
-                return result;                
+                return result;
             }
             private Comparable last = null;
         });
     }
-    
+
     public EiffelStyleLoop until(Predicate predicate) {
         until = predicate;
         return this;
@@ -87,32 +87,32 @@
         from.run();
         assertTrue(invariant.test());
         while(! until.test() ) {
-            loop.run();                
+            loop.run();
             assertTrue(variant.test());
             assertTrue(invariant.test());
         }
-        
-        // Note that: 
+
+        // Note that:
         //   assertTrue(until.test());
         // holds here, but isn't necessary since that's
         // the only way we could get out of the loop
 
-        // Also note that: 
+        // Also note that:
         //   assertTrue(invariant.test());
         // holds here, but was the last thing called
         // before until.test()
     }
-    
+
     private void assertTrue(boolean value) {
         if(!value) {
             throw new IllegalStateException("Assertion failed");
         }
     }
-    
+
     private Procedure from = NoOp.instance();
     private Predicate invariant = Constant.truePredicate();
     private Predicate variant = Constant.truePredicate();
     private Predicate until = Constant.falsePredicate();
-    private Procedure loop = NoOp.instance();        
+    private Procedure loop = NoOp.instance();
 
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestAll.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestAll.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestAll.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestAll.java Thu Apr  3 13:23:16 2008
@@ -23,7 +23,7 @@
 /**
  * See http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v
  * for more information on this Kata.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */



Mime
View raw message