You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2008/06/09 19:17:43 UTC

svn commit: r665786 [6/6] - in /commons/sandbox/functor/trunk/src: main/java/org/apache/commons/functor/adapter/ main/java/org/apache/commons/functor/core/ main/java/org/apache/commons/functor/core/algorithm/ main/java/org/apache/commons/functor/core/c...

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java Mon Jun  9 10:17:39 2008
@@ -44,10 +44,10 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new ConditionalBinaryFunction(
-            new Constant(true),
-            new Constant("left"),
-            new Constant("right"));
+        return new ConditionalBinaryFunction<Object, Object, String>(
+            Constant.TRUE,
+            Constant.of("left"),
+            Constant.of("right"));
     }
 
     // Lifecycle
@@ -65,43 +65,31 @@
     // ------------------------------------------------------------------------
 
     public void testEvaluate() throws Exception {
-        ConditionalBinaryFunction f = new ConditionalBinaryFunction(
-            new LeftIdentity(),
-            new Constant("left"),
-            new Constant("right"));
+        ConditionalBinaryFunction<Boolean, Object, String> f = new ConditionalBinaryFunction<Boolean, Object, String>(
+            LeftIdentity.PREDICATE,
+            Constant.of("left"),
+            Constant.of("right"));
         assertEquals("left",f.evaluate(Boolean.TRUE,null));
         assertEquals("right",f.evaluate(Boolean.FALSE,null));
     }
 
     public void testEquals() throws Exception {
-        ConditionalBinaryFunction f = new ConditionalBinaryFunction(
-            new LeftIdentity(),
-            new Constant("left"),
-            new Constant("right"));
+        ConditionalBinaryFunction<Boolean, Object, String> f = new ConditionalBinaryFunction<Boolean, Object, String>(
+            LeftIdentity.PREDICATE,
+            Constant.of("left"),
+            Constant.of("right"));
         assertEquals(f,f);
-        assertObjectsAreEqual(f,new ConditionalBinaryFunction(
-            new LeftIdentity(),
-            new Constant("left"),
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
-            new LeftIdentity(),
-            new Constant(null),
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
-            new Constant(true),
-            new Constant("left"),
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
-            null,
-            new Constant("left"),
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
-            new Constant(true),
-            null,
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
-            new Constant(true),
-            new Constant("left"),
-            null));
+        assertObjectsAreEqual(f,new ConditionalBinaryFunction<Boolean, Object, String>(
+                LeftIdentity.PREDICATE,
+                Constant.of("left"),
+                Constant.of("right")));
+        assertObjectsAreNotEqual(f,new ConditionalBinaryFunction<Boolean, Object, Object>(
+            LeftIdentity.PREDICATE,
+            Constant.of(null),
+            Constant.of("right")));
+        assertObjectsAreNotEqual(f,new ConditionalBinaryFunction<Boolean, Object, String>(
+            Constant.TRUE,
+            Constant.of("left"),
+            Constant.of("right")));
     }
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java Mon Jun  9 10:17:39 2008
@@ -46,10 +46,10 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new ConditionalBinaryProcedure(
-            new Constant(true),
-            new NoOp(),
-            new NoOp());
+        return new ConditionalBinaryProcedure<Object, Object>(
+            Constant.TRUE,
+            NoOp.instance(),
+            NoOp.instance());
     }
 
     // Lifecycle
@@ -69,55 +69,43 @@
     public void testRun() throws Exception {
         RunCounter left = new RunCounter();
         RunCounter right = new RunCounter();
-        ConditionalBinaryProcedure p = new ConditionalBinaryProcedure(
-            new LeftIdentity(),
+        ConditionalBinaryProcedure<Boolean, Object> p = new ConditionalBinaryProcedure<Boolean, Object>(
+            LeftIdentity.PREDICATE,
             left,
             right);
         assertEquals(0,left.count);
         assertEquals(0,right.count);
-        p.run(Boolean.TRUE,null);
+        p.run(true, null);
         assertEquals(1,left.count);
         assertEquals(0,right.count);
-        p.run(Boolean.FALSE,null);
+        p.run(false, null);
         assertEquals(1,left.count);
         assertEquals(1,right.count);
-        p.run(Boolean.TRUE,null);
+        p.run(true, null);
         assertEquals(2,left.count);
         assertEquals(1,right.count);
     }
 
     public void testEquals() throws Exception {
-        ConditionalBinaryProcedure p = new ConditionalBinaryProcedure(
-            new LeftIdentity(),
-            new NoOp(),
-            new NoOp());
+        ConditionalBinaryProcedure<?, ?> p = new ConditionalBinaryProcedure<Boolean, Object>(
+            LeftIdentity.PREDICATE,
+            NoOp.instance(),
+            NoOp.instance());
         assertEquals(p,p);
-        assertObjectsAreEqual(p,new ConditionalBinaryProcedure(
-            new LeftIdentity(),
-            new NoOp(),
-            new NoOp()));
-        assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
-            new Constant(true),
-            new NoOp(),
-            new NoOp()));
-        assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
-            null,
-            new NoOp(),
-            new NoOp()));
-        assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
-            new LeftIdentity(),
-            null,
-            new NoOp()));
-        assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
-            new LeftIdentity(),
-            new NoOp(),
-            null));
+        assertObjectsAreEqual(p,new ConditionalBinaryProcedure<Boolean, Object>(
+            LeftIdentity.PREDICATE,
+            NoOp.instance(),
+            NoOp.instance()));
+        assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure<Object, Object>(
+            Constant.TRUE,
+            NoOp.instance(),
+            NoOp.instance()));
     }
 
     // Classes
     // ------------------------------------------------------------------------
 
-    static class RunCounter implements BinaryProcedure {
+    static class RunCounter implements BinaryProcedure<Object, Object> {
         public void run(Object left, Object right) {
             count++;
         }

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -30,6 +30,7 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
+@SuppressWarnings("unchecked")
 public class TestSequence extends BaseFunctorTest {
 
     // Conventional

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -46,7 +46,7 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new TransposedFunction(new LeftIdentity());
+        return new TransposedFunction<Object, Object, Object>(LeftIdentity.FUNCTION);
     }
 
     // Lifecycle
@@ -64,18 +64,17 @@
     // ------------------------------------------------------------------------
 
     public void testEvaluate() throws Exception {
-        BinaryFunction f = new TransposedFunction(new LeftIdentity());
+        BinaryFunction<Object, Object, Object> f = new TransposedFunction<Object, Object, Object>(LeftIdentity.FUNCTION);
         assertEquals("xyzzy",f.evaluate(null,"xyzzy"));
         assertNull(f.evaluate("xyzzy",null));
     }
 
     public void testEquals() throws Exception {
-        BinaryFunction f = new TransposedFunction(new LeftIdentity());
+        BinaryFunction<Object, Object, Object> f = new TransposedFunction<Object, Object, Object>(LeftIdentity.FUNCTION);
         assertEquals(f,f);
-        assertObjectsAreEqual(f,new TransposedFunction(new LeftIdentity()));
-        assertObjectsAreNotEqual(f,new TransposedFunction(new RightIdentity()));
-        assertObjectsAreNotEqual(f,new TransposedFunction(null));
-        assertObjectsAreNotEqual(f,new Constant("y"));
+        assertObjectsAreEqual(f,new TransposedFunction<Object, Object, Object>(LeftIdentity.FUNCTION));
+        assertObjectsAreNotEqual(f,new TransposedFunction<Object, Object, Object>(RightIdentity.FUNCTION));
+        assertObjectsAreNotEqual(f,Constant.of("y"));
     }
 
     public void testTransposeNull() throws Exception {
@@ -83,6 +82,6 @@
     }
 
     public void testTranspose() throws Exception {
-        assertNotNull(TransposedFunction.transpose(new Constant("x")));
+        assertNotNull(TransposedFunction.transpose(Constant.of("x")));
     }
 }

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -64,19 +64,19 @@
     // ------------------------------------------------------------------------
 
     public void testEvaluate() throws Exception {
-        BinaryPredicate p = new TransposedPredicate(BinaryFunctionBinaryPredicate.adapt(new LeftIdentity()));
+        BinaryPredicate<Boolean, Boolean> p = new TransposedPredicate<Boolean, Boolean>(BinaryFunctionBinaryPredicate
+                .adapt(LeftIdentity.<Boolean, Boolean> function()));
         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());
+        BinaryPredicate<Object, Object> p = new TransposedPredicate<Object, Object>(Constant.TRUE);
         assertEquals(p,p);
-        assertObjectsAreEqual(p,new TransposedPredicate(Constant.truePredicate()));
-        assertObjectsAreEqual(p,TransposedPredicate.transpose(Constant.truePredicate()));
-        assertObjectsAreNotEqual(p,new TransposedPredicate(Constant.falsePredicate()));
-        assertObjectsAreNotEqual(p,new TransposedPredicate(null));
-        assertObjectsAreNotEqual(p,new Constant(true));
+        assertObjectsAreEqual(p,new TransposedPredicate<Object, Object>(Constant.TRUE));
+        assertObjectsAreEqual(p,TransposedPredicate.transpose(Constant.TRUE));
+        assertObjectsAreNotEqual(p,new TransposedPredicate<Object, Object>(Constant.FALSE));
+        assertObjectsAreNotEqual(p,Constant.TRUE);
     }
 
     public void testTransposeNull() throws Exception {

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -47,10 +47,10 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new UnaryCompositeBinaryFunction(
-            new RightIdentity(),
-            new Constant("left"),
-            new Identity());
+        return new UnaryCompositeBinaryFunction<Object, Object, Object>(
+            RightIdentity.FUNCTION,
+            Constant.of("left"),
+            Identity.instance());
     }
 
     // Lifecycle
@@ -68,41 +68,37 @@
     // ------------------------------------------------------------------------
 
     public void testEvaluate() throws Exception {
-        BinaryFunction f = new UnaryCompositeBinaryFunction(
-            new RightIdentity(),
-            new Constant("K"),
-            new Identity());
+        BinaryFunction<Object, Object, Object> f = new UnaryCompositeBinaryFunction<Object, Object, Object>(
+                RightIdentity.FUNCTION,
+                Constant.of("K"),
+                Identity.instance());
         assertEquals("right",f.evaluate("left","right"));
         assertNull("right",f.evaluate("left",null));
         assertEquals("right",f.evaluate(null,"right"));
     }
 
     public void testEquals() throws Exception {
-        BinaryFunction f = new UnaryCompositeBinaryFunction(
-            new LeftIdentity(),
-            new Constant("left"),
-            new Constant("right"));
+        BinaryFunction<Object, Object, Object> f = new UnaryCompositeBinaryFunction<Object, Object, Object>(
+                LeftIdentity.FUNCTION,
+                Constant.of("left"),
+                Constant.of("right"));
         assertEquals(f,f);
-        assertObjectsAreEqual(f,new UnaryCompositeBinaryFunction(
-            new LeftIdentity(),
-            new Constant("left"),
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
-            new RightIdentity(),
-            new Constant("left"),
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
-            new LeftIdentity(),
-            new Identity(),
-            new Constant("right")));
-        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
-            new LeftIdentity(),
-            new Constant("left"),
-            new Identity()));
-        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(null,null,null));
-        assertObjectsAreEqual(
-            new UnaryCompositeBinaryFunction(null,null,null),
-            new UnaryCompositeBinaryFunction(null,null,null));
+        assertObjectsAreEqual(f,new UnaryCompositeBinaryFunction<Object, Object, Object>(
+                LeftIdentity.FUNCTION,
+                Constant.of("left"),
+                Constant.of("right")));
+        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction<Object, Object, Object>(
+                RightIdentity.FUNCTION,
+                Constant.of("left"),
+                Constant.of("right")));
+        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction<Object, Object, Object>(
+                LeftIdentity.FUNCTION,
+                Identity.instance(),
+            Constant.of("right")));
+        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction<Object, Object, Object>(
+                LeftIdentity.FUNCTION,
+                Constant.of("left"),
+                Identity.instance()));
     }
 
 }

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -47,10 +47,10 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new UnaryCompositeBinaryPredicate(
-            new RightIdentity(),
-            new Constant(Boolean.FALSE),
-            new Identity());
+        return new UnaryCompositeBinaryPredicate<Boolean, Boolean>(
+                RightIdentity.PREDICATE,
+                Constant.FALSE,
+                new Identity<Boolean>());
     }
 
     // Lifecycle
@@ -68,36 +68,32 @@
     // ------------------------------------------------------------------------
 
     public void testEvaluate() throws Exception {
-        BinaryPredicate f = new UnaryCompositeBinaryPredicate(
-            new RightIdentity(),
-            new Constant(Boolean.FALSE),
-            new Identity());
+        BinaryPredicate<Boolean, Boolean> f = new UnaryCompositeBinaryPredicate<Boolean, Boolean>(
+                RightIdentity.PREDICATE,
+                Constant.FALSE,
+                new Identity<Boolean>());
         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(),
-            new Constant(true),
-            new Constant(false));
+        BinaryPredicate<Boolean, Boolean> f = new UnaryCompositeBinaryPredicate<Boolean, Boolean>(
+                LeftIdentity.PREDICATE,
+                Constant.TRUE,
+                Constant.FALSE);
         assertEquals(f,f);
-        assertObjectsAreEqual(f,new UnaryCompositeBinaryPredicate(
-            new LeftIdentity(),
-            new Constant(true),
-            new Constant(false)));
-        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryPredicate(
-            new RightIdentity(),
-            new Constant(true),
-            new Constant(false)));
-        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryPredicate(
-            new LeftIdentity(),
-            new Identity(),
-            new Constant(true)));
-        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryPredicate(null,null,null));
-        assertObjectsAreEqual(
-            new UnaryCompositeBinaryPredicate(null,null,null),
-            new UnaryCompositeBinaryPredicate(null,null,null));
+        assertObjectsAreEqual(f,new UnaryCompositeBinaryPredicate<Boolean, Boolean>(
+                LeftIdentity.PREDICATE,
+                Constant.TRUE,
+                Constant.FALSE));
+        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryPredicate<Boolean, Boolean>(
+                RightIdentity.PREDICATE,
+                Constant.TRUE,
+                Constant.FALSE));
+        assertObjectsAreNotEqual(f,new UnaryCompositeBinaryPredicate<Boolean, Boolean>(
+                LeftIdentity.PREDICATE,
+                new Identity<Boolean>(),
+                Constant.TRUE));
     }
 
 }

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -30,6 +30,7 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
+@SuppressWarnings("unchecked")
 public class TestUnarySequence extends BaseFunctorTest {
 
     // Conventional

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -37,7 +37,7 @@
 import org.apache.commons.functor.adapter.IgnoreLeftFunction;
 import org.apache.commons.functor.core.Constant;
 import org.apache.commons.functor.core.Identity;
-import org.apache.commons.functor.core.IsInstanceOf;
+import org.apache.commons.functor.core.IsInstance;
 import org.apache.commons.functor.core.IsNull;
 import org.apache.commons.functor.core.RightIdentity;
 import org.apache.commons.functor.core.composite.Conditional;
@@ -60,6 +60,7 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
+@SuppressWarnings("unchecked")
 public class FlexiMapExample extends TestCase {
 
     public FlexiMapExample(String testName) {
@@ -289,8 +290,8 @@
          * from the map.
          */
         public FlexiMap(BinaryFunction putfn, BinaryFunction getfn) {
-            onPut = null == putfn ? RightIdentity.instance() : putfn;
-            onGet = null == getfn ? RightIdentity.instance() : getfn;
+            onPut = null == putfn ? RightIdentity.function() : putfn;
+            onGet = null == getfn ? RightIdentity.function() : getfn;
             proxiedMap = new HashMap();
         }
 
@@ -462,7 +463,7 @@
                     /*
                      * we'll test the type of the right-hand argument,
                      */
-					new IsInstanceOf(clazz),
+					IsInstance.of(clazz),
                     /*
                      * and either pass the given value through,
                      */

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -58,6 +58,7 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
+@SuppressWarnings("unchecked")
 public class QuicksortExample extends TestCase {
 
 /*

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -25,12 +25,9 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public final class Abs implements UnaryFunction {
-    public Object evaluate(Object obj) {
-        return evaluate((Number) obj);
-    }
+public final class Abs implements UnaryFunction<Number, Integer> {
 
-    public Object evaluate(Number num) {
+    public Integer evaluate(Number num) {
         return new Integer(Math.abs(num.intValue()));
     }
 

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -22,6 +22,7 @@
 
 import org.apache.commons.functor.BinaryFunction;
 import org.apache.commons.functor.UnaryFunction;
+import org.apache.commons.functor.adapter.BinaryFunctionUnaryFunction;
 import org.apache.commons.functor.core.IsNull;
 import org.apache.commons.functor.core.LeftIdentity;
 import org.apache.commons.functor.core.RightIdentity;
@@ -30,7 +31,6 @@
 import org.apache.commons.functor.core.composite.Composite;
 import org.apache.commons.functor.core.composite.Conditional;
 import org.apache.commons.functor.core.composite.ConditionalBinaryFunction;
-import org.apache.commons.functor.example.kata.one.BinaryFunctionUnaryFunction;
 import org.apache.commons.functor.example.kata.one.Subtract;
 import org.apache.commons.functor.example.lines.Lines;
 import org.apache.commons.functor.generator.FilteredGenerator;
@@ -56,7 +56,7 @@
 	 */
     public static final Object process(final Reader file, final int selected, final int col1, final int col2) {
         return NthColumn.instance(selected).evaluate(
-                new FoldLeft(lesserSpread(col1, col2)).evaluate(new FilteredGenerator(Lines.from(file),
+                new FoldLeft<String>(lesserSpread(col1, col2)).evaluate(new FilteredGenerator<String>(Lines.from(file),
                     Composite.predicate(IsInteger.instance(),NthColumn.instance(0)))));
     }
 
@@ -66,17 +66,17 @@
      * String arguments, and return the argument
      * whose difference is smallest.
      */
-    private static final BinaryFunction lesserSpread(final int col1, final int col2) {
-        return new ConditionalBinaryFunction(
-            IsNull.left(),                                 // if left is null
-            RightIdentity.instance(),                      //   return right
+    private static final BinaryFunction<String, String, String> lesserSpread(final int col1, final int col2) {
+        return new ConditionalBinaryFunction<String, String, String>(
+            IsNull.<String>left(),                                 // if left is null
+            RightIdentity.<String, String>function(),                      //   return right
             Conditional.function(                          //   else return the parameter with the least spread
                 Composite.predicate(                       //     if left is less than right
                     IsLessThan.instance(),
                     absSpread(col1,col2),
                     absSpread(col1,col2)),
-                LeftIdentity.instance(),                   //       return left
-                RightIdentity.instance()                   //       else return right
+                LeftIdentity.<String, String>function(),                   //       return left
+                RightIdentity.<String, String>function()                   //       else return right
             )
         );
     }
@@ -86,10 +86,10 @@
 	 * between the Integers stored in the <i>col1</i> and <i>col2</i>th
 	 * whitespace delimited columns of the input line (a String).
 	 */
-    private static UnaryFunction absSpread(final int col1, final int col2) {
+    private static UnaryFunction<String, Integer> absSpread(final int col1, final int col2) {
         return Composite.function(
             Abs.instance(),
-            new BinaryFunctionUnaryFunction(
+            new BinaryFunctionUnaryFunction<String, Number>(
                 Composite.function(
                     Subtract.instance(),
                     Composite.function(ToInteger.instance(),NthColumn.instance(col1)),

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -25,8 +25,8 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public final class IsInteger implements UnaryPredicate {
-    public boolean test(Object obj) {
+public final class IsInteger implements UnaryPredicate<String> {
+    public boolean test(String obj) {
         try {
             ToInteger.instance().evaluate(obj);
             return true;

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -27,12 +27,12 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public final class NthColumn implements UnaryFunction {
+public final class NthColumn implements UnaryFunction<String, String> {
     public NthColumn(int n) {
         this.n = n;
     }
 
-    public Object evaluate(Object obj) {
+    public String evaluate(String obj) {
         StringTokenizer toker = new StringTokenizer((String) obj);
         for (int count = 0; count < n && toker.hasMoreTokens();count++) {
             toker.nextToken();

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -28,12 +28,9 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public final class ToInteger implements UnaryFunction {
-    public Object evaluate(Object obj) {
-        return evaluate((String) obj);
-    }
+public final class ToInteger implements UnaryFunction<String, Integer> {
 
-    public Object evaluate(String str) {
+    public Integer evaluate(String str) {
         StringBuffer buf = new StringBuffer();
         for (int i=0;i<str.length();i++) {
             if (Character.isDigit(str.charAt(i))) {

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.functor.example.kata.one;
 
-import org.apache.commons.functor.BinaryFunction;
 import org.apache.commons.functor.UnaryFunction;
 import org.apache.commons.functor.adapter.LeftBoundFunction;
 
@@ -24,12 +23,8 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Add implements BinaryFunction {
-    public Object evaluate(Object left, Object right) {
-        return evaluate((Number) left,(Number) right);
-    }
-
-    public Object evaluate(Number left, Number right) {
+public class Add extends ArithmeticOperation {
+    public Number evaluate(Number left, Number right) {
         return new Integer(left.intValue() + right.intValue());
     }
 
@@ -37,8 +32,8 @@
         return INSTANCE;
     }
 
-    public static UnaryFunction to(int factor) {
-        return new LeftBoundFunction(instance(),new Integer(factor));
+    public static UnaryFunction<Number, Number> to(int factor) {
+        return LeftBoundFunction.bind(INSTANCE, factor);
     }
 
     private static Add INSTANCE = new Add();

Added: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ArithmeticOperation.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ArithmeticOperation.java?rev=665786&view=auto
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ArithmeticOperation.java (added)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ArithmeticOperation.java Mon Jun  9 10:17:39 2008
@@ -0,0 +1,6 @@
+package org.apache.commons.functor.example.kata.one;
+
+import org.apache.commons.functor.BinaryFunction;
+
+public abstract class ArithmeticOperation implements BinaryFunction<Number, Number, Number> {
+}

Propchange: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ArithmeticOperation.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.functor.example.kata.one;
 
-import org.apache.commons.functor.BinaryFunction;
 import org.apache.commons.functor.UnaryFunction;
 import org.apache.commons.functor.adapter.RightBoundFunction;
 
@@ -24,12 +23,9 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Divide implements BinaryFunction {
-    public Object evaluate(Object left, Object right) {
-        return evaluate((Number) left,(Number) right);
-    }
+public class Divide extends ArithmeticOperation {
 
-    public Object evaluate(Number left, Number right) {
+    public Number evaluate(Number left, Number right) {
         return new Integer(left.intValue() / right.intValue());
     }
 
@@ -37,8 +33,8 @@
         return INSTANCE;
     }
 
-    public static UnaryFunction by(int factor) {
-        return new RightBoundFunction(instance(),new Integer(factor));
+    public static UnaryFunction<Number, Number> by(int factor) {
+        return RightBoundFunction.bind(INSTANCE, 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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.functor.example.kata.one;
 
-import org.apache.commons.functor.BinaryFunction;
 import org.apache.commons.functor.UnaryFunction;
 import org.apache.commons.functor.adapter.RightBoundFunction;
 
@@ -24,12 +23,8 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Mod implements BinaryFunction {
-    public Object evaluate(Object left, Object right) {
-        return evaluate((Number) left,(Number) right);
-    }
-
-    public Object evaluate(Number left, Number right) {
+public class Mod extends ArithmeticOperation {
+    public Number evaluate(Number left, Number right) {
         return new Integer(left.intValue() % right.intValue());
     }
 
@@ -37,8 +32,8 @@
         return INSTANCE;
     }
 
-    public static UnaryFunction by(int factor) {
-        return new RightBoundFunction(instance(),new Integer(factor));
+    public static UnaryFunction<Number, Number> by(int factor) {
+        return RightBoundFunction.bind(instance(),factor);
     }
 
     private static Mod INSTANCE = new Mod();

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.functor.example.kata.one;
 
-import org.apache.commons.functor.BinaryFunction;
 import org.apache.commons.functor.UnaryFunction;
 import org.apache.commons.functor.adapter.LeftBoundFunction;
 
@@ -24,12 +23,9 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Multiply implements BinaryFunction {
-    public Object evaluate(Object left, Object right) {
-        return evaluate((Number) left,(Number) right);
-    }
+public class Multiply extends ArithmeticOperation {
 
-    public Object evaluate(Number left, Number right) {
+    public Number evaluate(Number left, Number right) {
         return new Integer(left.intValue() * right.intValue());
     }
 
@@ -37,8 +33,8 @@
         return INSTANCE;
     }
 
-    public static UnaryFunction by(int factor) {
-        return new LeftBoundFunction(instance(),new Integer(factor));
+    public static UnaryFunction<Number, Number> by(int factor) {
+        return LeftBoundFunction.bind(INSTANCE, factor);
     }
 
     private static Multiply INSTANCE = new Multiply();

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Product.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Product.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Product.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Product.java Mon Jun  9 10:17:39 2008
@@ -28,7 +28,7 @@
         this(name,sku,ToMoney.from(Multiply.by(cost)));
     }
 
-    public Product(String name, String sku, UnaryFunction price) {
+    public Product(String name, String sku, UnaryFunction<? super Integer, Money> price) {
         this.name = name;
         this.sku = sku;
         this.priceFunction = price;
@@ -38,7 +38,7 @@
         return name;
     }
 
-    public UnaryFunction getPriceFunction() {
+    public UnaryFunction<? super Integer, Money> getPriceFunction() {
         return priceFunction;
     }
 
@@ -50,7 +50,7 @@
         name = string;
     }
 
-    public void setPriceFunction(UnaryFunction function) {
+    public void setPriceFunction(UnaryFunction<? super Integer, Money> function) {
         priceFunction = function;
     }
 
@@ -59,10 +59,10 @@
     }
 
     public Money getPrice(int quantity) {
-        return (Money)(priceFunction.evaluate(new Integer(quantity)));
+        return priceFunction.evaluate(quantity);
     }
 
     private String name;
     private String sku;
-    private UnaryFunction priceFunction;
+    private UnaryFunction<? super Integer, Money> priceFunction;
 }

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.functor.example.kata.one;
 
-import org.apache.commons.functor.BinaryFunction;
 import org.apache.commons.functor.UnaryFunction;
 import org.apache.commons.functor.adapter.LeftBoundFunction;
 
@@ -24,12 +23,8 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Subtract implements BinaryFunction {
-    public Object evaluate(Object left, Object right) {
-        return evaluate((Number) left,(Number) right);
-    }
-
-    public Object evaluate(Number left, Number right) {
+public class Subtract extends ArithmeticOperation {
+    public Number evaluate(Number left, Number right) {
         return new Integer(left.intValue() - right.intValue());
     }
 
@@ -37,8 +32,8 @@
         return INSTANCE;
     }
 
-    public static UnaryFunction from(int factor) {
-        return new LeftBoundFunction(instance(),new Integer(factor));
+    public static UnaryFunction<Number, Number> from(int factor) {
+        return LeftBoundFunction.bind(INSTANCE, 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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -21,12 +21,12 @@
 import junit.framework.TestSuite;
 
 import org.apache.commons.functor.UnaryFunction;
-import org.apache.commons.functor.adapter.IgnoreRightFunction;
+import org.apache.commons.functor.adapter.BinaryFunctionUnaryFunction;
 import org.apache.commons.functor.core.Identity;
 import org.apache.commons.functor.core.comparator.IsGreaterThan;
-import org.apache.commons.functor.core.composite.BinaryCompositeBinaryFunction;
-import org.apache.commons.functor.core.composite.CompositeUnaryFunction;
+import org.apache.commons.functor.core.composite.Composite;
 import org.apache.commons.functor.core.composite.ConditionalUnaryFunction;
+import org.apache.commons.functor.core.composite.UnaryCompositeBinaryFunction;
 
 /**
  * Dave Thomas's Kata One asks us to think about how one might
@@ -136,7 +136,7 @@
             "Banana",
             "SKU-0002",
             ToMoney.from(
-                new ConditionalUnaryFunction(
+                new ConditionalUnaryFunction<Integer, Number>(
                     IsGreaterThan.instance(new Integer(3)),
                     Multiply.by(25),
                     Multiply.by(33))));
@@ -158,17 +158,15 @@
             "Banana",
             "SKU-0002",
             ToMoney.from(
-                new BinaryFunctionUnaryFunction(
-                    new BinaryCompositeBinaryFunction(
+                new BinaryFunctionUnaryFunction<Integer, Number>(
+                    new UnaryCompositeBinaryFunction<Integer, Integer, Number>(
                         Add.instance(),
-                        IgnoreRightFunction.adapt(
-                            new CompositeUnaryFunction(
-                                Multiply.by(100),
-                                Divide.by(4))),
-                        IgnoreRightFunction.adapt(
-                            new CompositeUnaryFunction(
-                                Multiply.by(33),
-                                Mod.by(4)))))));
+                        Composite.function(
+                            Multiply.by(100),
+                            Divide.by(4)),
+                        Composite.function(
+                            Multiply.by(33),
+                            Mod.by(4))))));
         assertEquals(new Money(0*33+0*25),banana.getPrice(0));
         assertEquals(new Money(1*33+0*25),banana.getPrice(1));
         assertEquals(new Money(2*33+0*25),banana.getPrice(2));
@@ -196,13 +194,10 @@
             "Apple",
             "SKU-0003",
             ToMoney.from(
-                new CompositeUnaryFunction(
-                    Multiply.by(40),
-                    new BinaryFunctionUnaryFunction(
-                        new BinaryCompositeBinaryFunction(
-                            Subtract.instance(),
-                            IgnoreRightFunction.adapt(Identity.instance()),
-                            IgnoreRightFunction.adapt(Divide.by(3)))))));
+                    Composite.function(Multiply.by(40),
+                    BinaryFunctionUnaryFunction.adapt(new UnaryCompositeBinaryFunction<Number, Number, Number>(Subtract.instance(),
+                            new Identity<Number>(),
+                            Divide.by(3))))));
 
         assertEquals(new Money(0*40),apple.getPrice(0));
         assertEquals(new Money(1*40),apple.getPrice(1));
@@ -226,18 +221,14 @@
      * order:
      */
 
-    class BuyNGetMFree implements UnaryFunction {
+    class BuyNGetMFree implements UnaryFunction<Number, Number> {
        public BuyNGetMFree(int n, int m, int costPerUnit) {
            this.n = n;
            this.m = m;
            this.costPerUnit = costPerUnit;
        }
 
-       public Object evaluate(Object obj) {
-           return evaluate((Number) obj);
-       }
-
-       public Object evaluate(Number num) {
+       public Number evaluate(Number num) {
            int quantity = num.intValue();
            int cost = 0;
 

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=665786&r1=665785&r2=665786&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 Mon Jun  9 10:17:39 2008
@@ -17,18 +17,15 @@
 package org.apache.commons.functor.example.kata.one;
 
 import org.apache.commons.functor.UnaryFunction;
-import org.apache.commons.functor.core.composite.CompositeUnaryFunction;
+import org.apache.commons.functor.core.composite.Composite;
 
 /**
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class ToMoney implements UnaryFunction {
-    public Object evaluate(Object cents) {
-        return evaluate((Number) cents);
-    }
+public class ToMoney implements UnaryFunction<Number, Money> {
 
-    public Object evaluate(Number cents) {
+    public Money evaluate(Number cents) {
         return new Money(cents.intValue());
     }
 
@@ -36,8 +33,8 @@
         return INSTANCE;
     }
 
-    public static UnaryFunction from(UnaryFunction fn) {
-        return new CompositeUnaryFunction(instance(),fn);
+    public static <X> UnaryFunction<X, Money> from(UnaryFunction<? super X, ? extends Number> fn) {
+        return Composite.function(INSTANCE, fn);
     }
 
     private static ToMoney INSTANCE = new ToMoney();

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Contains.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Contains.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Contains.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Contains.java Mon Jun  9 10:17:39 2008
@@ -23,12 +23,12 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Contains implements UnaryPredicate {
+public class Contains<T> implements UnaryPredicate<T> {
     public Contains(String str) {
         this.str = str;
     }
 
-    public boolean test(Object obj) {
+    public boolean test(T obj) {
         return null != obj && obj.toString().indexOf(str) != -1;
     }
 

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java Mon Jun  9 10:17:39 2008
@@ -29,7 +29,7 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Lines extends BaseGenerator {
+public class Lines extends BaseGenerator<String> {
     public static Lines from(Reader reader) {
         return new Lines(reader);
     }
@@ -46,7 +46,7 @@
         }
     }
     
-    public void run(UnaryProcedure proc) {
+    public void run(UnaryProcedure<? super String> proc) {
         try {
             for (String line = in.readLine(); line != null; line = in.readLine()) {
                 proc.run(line);

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/StartsWith.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/StartsWith.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/StartsWith.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/StartsWith.java Mon Jun  9 10:17:39 2008
@@ -23,12 +23,12 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class StartsWith implements UnaryPredicate {
+public class StartsWith<T> implements UnaryPredicate<T> {
     public StartsWith(String prefix) {
         this.prefix = prefix;
     }
 
-    public boolean test(Object obj) {
+    public boolean test(T obj) {
         return null != obj && obj.toString().startsWith(prefix);
     }
 

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java Mon Jun  9 10:17:39 2008
@@ -22,12 +22,11 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class Sum implements BinaryFunction {
-    public Object evaluate(Object left, Object right) {
-        return new Integer( ((Number) left).intValue() + ((Number) right).intValue() );
+public class Sum implements BinaryFunction<Number, Number, Integer> {
+    public Integer evaluate(Number left, Number right) {
+        return left.intValue() + right.intValue();
     }
 
-
     public static final Sum instance() {
         return INSTANCE;
     }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java Mon Jun  9 10:17:39 2008
@@ -33,7 +33,6 @@
 import org.apache.commons.functor.generator.FilteredGenerator;
 import org.apache.commons.functor.generator.TransformedGenerator;
 
-
 /**
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
@@ -61,15 +60,15 @@
     }
 
     public void testCountCharacters() throws Exception {
-        Object result = new FoldLeft(Sum.instance()).evaluate(
-                new TransformedGenerator(Lines.from(reader), Size.instance()));
+        Object result = new FoldLeft<Integer>(Sum.instance()).evaluate(
+                new TransformedGenerator<String, Integer>(Lines.from(reader), new Size<String>()));
 
         assertEquals("Expected 990 characters",new Integer(990),result);
     }
 
     public void testCountWords() throws Exception {
-        Object result = new FoldLeft(Sum.instance()).evaluate(
-                new TransformedGenerator(Lines.from(reader),WordCount.instance()));
+        Object result = new FoldLeft<Integer>(Sum.instance()).evaluate(
+                new TransformedGenerator<String, Integer>(Lines.from(reader),WordCount.instance()));
 
         assertEquals("Expected 157 words",new Integer(157),result);
     }
@@ -84,29 +83,30 @@
     }
 
     public void testCountWordsExcludingComments() throws Exception {
-        Object result = new FoldLeft(Sum.instance()).evaluate(new TransformedGenerator(new FilteredGenerator(Lines
-            .from(reader), new UnaryNot(new StartsWith("#"))),
-                    WordCount.instance()));
+        Object result = new FoldLeft<Integer>(Sum.instance()).evaluate(new TransformedGenerator<String, Integer>(
+                new FilteredGenerator<String>(Lines.from(reader), UnaryNot.not(new StartsWith<String>("#"))), WordCount
+                        .instance()));
 
         assertEquals("Expected 90 words",new Integer(90),result);
     }
 
     public void testCountCommentLines() throws Exception {
         Count count = new Count();
-        new FilteredGenerator(Lines.from(reader), new StartsWith("#"))
-                    .run(ProcedureUnaryProcedure.adapt(count));
+        new FilteredGenerator<String>(Lines.from(reader), new StartsWith<String>("#"))
+                    .run(ProcedureUnaryProcedure.<String>adapt(count));
 
         assertEquals("Expected 6 lines",6,count.getCount());
     }
 
     public void testFindMatchingLines() throws Exception {
-        Collection matches = new FilteredGenerator(Lines.from(reader), new Contains("lo")).toCollection();
+        Collection<String> matches = new FilteredGenerator<String>(Lines.from(reader), new Contains<String>("lo"))
+                .toCollection();
         assertEquals("Expected 5 lines",5,matches.size());
     }
 
     public void testFindMatchingFromTail() throws Exception {
-        Collection matches = new FilteredGenerator(Lines.from(reader), new UnaryAnd(new Offset(8), new Contains("lo")))
-                .toCollection();
+        Collection<String> matches = new FilteredGenerator<String>(Lines.from(reader), new UnaryAnd<String>(new Offset(
+                8), new Contains<String>("lo"))).toCollection();
         assertEquals("Expected 2 lines",2,matches.size());
     }
 

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java Mon Jun  9 10:17:39 2008
@@ -24,10 +24,9 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class WordCount implements UnaryFunction {
-    public Object evaluate(Object obj) {
-        StringTokenizer toker = new StringTokenizer((String) obj);
-        return new Integer(toker.countTokens());
+public class WordCount implements UnaryFunction<String, Integer> {
+    public Integer evaluate(String obj) {
+        return new StringTokenizer(obj).countTokens();
     }
 
     public static WordCount instance() {

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestPredicatedMap.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestPredicatedMap.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestPredicatedMap.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestPredicatedMap.java Mon Jun  9 10:17:39 2008
@@ -23,7 +23,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.commons.functor.core.IsInstanceOf;
+import org.apache.commons.functor.core.IsInstance;
 
 
 /**
@@ -45,7 +45,7 @@
     public void setUp() throws Exception {
         super.setUp();
         baseMap = new HashMap();
-        predicatedMap = new PredicatedMap(baseMap,new IsInstanceOf(String.class),new IsInstanceOf(Integer.class));
+        predicatedMap = new PredicatedMap(baseMap,IsInstance.of(String.class),IsInstance.of(Integer.class));
     }
 
     public void tearDown() throws Exception {

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java Mon Jun  9 10:17:39 2008
@@ -35,7 +35,7 @@
  * Tests the Base Generator class.
  * @author Jason Horman (jason@jhorman.org)
  */
-
+@SuppressWarnings("unchecked")
 public class TestBaseGenerator extends TestCase {
 
     private Generator simpleGenerator = null;

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestIteratorToGeneratorAdapter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestIteratorToGeneratorAdapter.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestIteratorToGeneratorAdapter.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestIteratorToGeneratorAdapter.java Mon Jun  9 10:17:39 2008
@@ -29,7 +29,7 @@
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-
+@SuppressWarnings("unchecked")
 public class TestIteratorToGeneratorAdapter extends BaseFunctorTest {
 
     // Conventional

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java Mon Jun  9 10:17:39 2008
@@ -37,7 +37,7 @@
 /**
  * @author Jason Horman (jason@jhorman.org)
  */
-
+@SuppressWarnings("unchecked")
 public class TestEachElement extends BaseFunctorTest {
 
     private List list = null;

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java Mon Jun  9 10:17:39 2008
@@ -29,6 +29,7 @@
  * @author Jason Horman (jason@jhorman.org)
  * @author Rodney Waldhoff
  */
+@SuppressWarnings("unchecked")
 public class TestIntegerRange extends BaseFunctorTest {
     // Conventional
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java?rev=665786&r1=665785&r2=665786&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java (original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java Mon Jun  9 10:17:39 2008
@@ -29,6 +29,7 @@
  * @author Jason Horman (jason@jhorman.org)
  * @author Rodney Waldhoff
  */
+@SuppressWarnings("unchecked")
 public class TestLongRange extends BaseFunctorTest {
     // Conventional
     // ------------------------------------------------------------------------