commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
Date Tue, 02 Dec 2003 17:06:30 GMT
rwaldhoff    2003/12/02 09:06:30

  Modified:    functor/src/test/org/apache/commons/functor/core
                        TestIdentityFunction.java TestRightIdentity.java
                        TestAll.java TestIdentityPredicate.java
               functor/src/test/org/apache/commons/functor/adapter
                        TestIgnoreRightPredicate.java
                        TestIgnoreRightProcedure.java
                        TestBoundProcedure.java TestIgnoreLeftFunction.java
                        TestIgnoreRightFunction.java
                        TestIgnoreLeftPredicate.java
                        TestBoundPredicate.java
                        TestIgnoreLeftProcedure.java TestBoundFunction.java
               functor/src/test/org/apache/commons/functor/core/composite
                        TestCompositeUnaryFunction.java
                        TestUnaryCompositeBinaryFunction.java
                        TestConditionalUnaryProcedure.java
                        TestConditionalUnaryFunction.java
                        TestConditionalUnaryPredicate.java
               functor/src/test/org/apache/commons/functor/example
                        FlexiMapExample.java
               functor/src/test/org/apache/commons/functor/core/collection
                        TestTransformedIterator.java
               functor/src/java/org/apache/commons/functor/core
                        IdentityPredicate.java IdentityFunction.java
               functor/src/test/org/apache/commons/functor/example/kata/one
                        SupermarketPricingExample.java
               functor/src/test/org/apache/commons/functor
                        TestAlgorithms.java
  Added:       functor/src/test/org/apache/commons/functor/core
                        TestIdentity.java
               functor/src/java/org/apache/commons/functor/core
                        Identity.java
  Log:
  deprecate IdentityPredicate and IdentityFunction in favor of simply Identity
  
  Revision  Changes    Path
  1.4       +3 -2      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityFunction.java
  
  Index: TestIdentityFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestIdentityFunction.java	24 Nov 2003 20:12:15 -0000	1.3
  +++ TestIdentityFunction.java	2 Dec 2003 17:06:29 -0000	1.4
  @@ -65,6 +65,7 @@
   /**
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated Use {@link Identity}
    */
   public class TestIdentityFunction extends BaseFunctorTest {
   
  
  
  
  1.2       +3 -3      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestRightIdentity.java
  
  Index: TestRightIdentity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestRightIdentity.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestRightIdentity.java	2 Dec 2003 16:50:52 -0000	1.1
  +++ TestRightIdentity.java	2 Dec 2003 17:06:29 -0000	1.2
  @@ -136,7 +136,7 @@
           assertEquals(f,f);
           assertObjectsAreEqual(f,new RightIdentity());
           assertObjectsAreEqual(f,RightIdentity.instance());
  -        assertObjectsAreNotEqual(f,new IdentityPredicate());
  +        assertObjectsAreNotEqual(f,new Identity());
           assertObjectsAreNotEqual(f,new LeftIdentity());
           assertObjectsAreNotEqual(f,new ConstantPredicate(true));
           assertObjectsAreNotEqual(f,new ConstantFunction("abcde"));
  
  
  
  1.11      +7 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestAll.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestAll.java	2 Dec 2003 16:50:52 -0000	1.10
  +++ TestAll.java	2 Dec 2003 17:06:29 -0000	1.11
  @@ -74,10 +74,13 @@
           
           suite.addTest(TestConstantFunction.suite());
           suite.addTest(TestConstantPredicate.suite());
  -        suite.addTest(TestNoOp.suite());
  -        suite.addTest(TestIdentityFunction.suite());
  +
  +        suite.addTest(TestIdentity.suite());
           suite.addTest(TestLeftIdentity.suite());
           suite.addTest(TestRightIdentity.suite());
  +
  +        suite.addTest(TestNoOp.suite());
  +        suite.addTest(TestIdentityFunction.suite());
           suite.addTest(TestLeftIdentityFunction.suite());
           suite.addTest(TestRightIdentityFunction.suite());
           suite.addTest(TestIsInstanceOf.suite());
  
  
  
  1.4       +3 -2      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityPredicate.java
  
  Index: TestIdentityPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityPredicate.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestIdentityPredicate.java	24 Nov 2003 20:12:15 -0000	1.3
  +++ TestIdentityPredicate.java	2 Dec 2003 17:06:29 -0000	1.4
  @@ -65,6 +65,7 @@
   /**
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated
    */
   public class TestIdentityPredicate extends BaseFunctorTest {
   
  
  
  
  1.1                  jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentity.java
  
  Index: TestIdentity.java
  ===================================================================
  /* 
   * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentity.java,v 1.1 2003/12/02 17:06:29 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived 
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.functor.core;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.functor.BaseFunctorTest;
  import org.apache.commons.functor.UnaryFunction;
  import org.apache.commons.functor.UnaryPredicate;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/12/02 17:06:29 $
   * @author Rodney Waldhoff
   */
  public class TestIdentity extends BaseFunctorTest {
  
      // Conventional
      // ------------------------------------------------------------------------
  
      public TestIdentity(String testName) {
          super(testName);
      }
  
      public static Test suite() {
          return new TestSuite(TestIdentity.class);
      }
  
      // Functor Testing Framework
      // ------------------------------------------------------------------------
  
      protected Object makeFunctor() {
          return new Identity();
      }
      
      // Lifecycle
      // ------------------------------------------------------------------------
  
      public void setUp() throws Exception {
          super.setUp();
      }
  
      public void tearDown() throws Exception {
          super.tearDown();
      }
  
      // Tests
      // ------------------------------------------------------------------------
      
      public void testEvaluate() throws Exception {
          UnaryFunction f = new Identity();
          assertNull(f.evaluate(null));
          assertEquals("xyzzy",f.evaluate("xyzzy"));
          assertEquals(new Integer(3),f.evaluate(new Integer(3)));
          Object obj = new Long(12345L);
          assertSame(obj,f.evaluate(obj));
      }
      
      public void testTest() throws Exception {
          UnaryPredicate p = new Identity();
          assertTrue(p.test(Boolean.TRUE));
          assertTrue(!p.test(Boolean.FALSE));
          try {
              p.test("true");
              fail("Expected ClassCastException");
          } catch(ClassCastException e) {
              // expected
          }
          try {
              p.test(null);
              fail("Expected NullPointerException");
          } catch(NullPointerException e) {
              // expected
          }
      }
      public void testEquals() throws Exception {
          UnaryFunction f = new Identity();
          assertEquals(f,f);
          assertObjectsAreEqual(f,new Identity());
          assertObjectsAreEqual(f,Identity.instance());
          assertObjectsAreNotEqual(f,new ConstantFunction("abcde"));
      }
      
      public void testConstant() throws Exception {
          assertEquals(Identity.instance(),Identity.instance());
          assertSame(Identity.instance(),Identity.instance());
      }
  }
  
  
  
  1.2       +6 -6      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java
  
  Index: TestIgnoreRightPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestIgnoreRightPredicate.java	4 Mar 2003 21:33:56 -0000	1.1
  +++ TestIgnoreRightPredicate.java	2 Dec 2003 17:06:29 -0000	1.2
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryPredicate;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -103,15 +103,15 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        BinaryPredicate p = new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction()));
  +        BinaryPredicate p = new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new Identity()));
           assertTrue(p.test(Boolean.TRUE,null));
           assertTrue(!p.test(Boolean.FALSE,null));
       }
       
       public void testEquals() throws Exception {
  -        BinaryPredicate p = new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction()));
  +        BinaryPredicate p = new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new Identity()));
           assertEquals(p,p);
  -        assertObjectsAreEqual(p,new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction())));
  +        assertObjectsAreEqual(p,new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new Identity())));
           assertObjectsAreNotEqual(p,new ConstantPredicate(true));
           assertObjectsAreNotEqual(p,new IgnoreRightPredicate(new ConstantPredicate(false)));
           assertObjectsAreNotEqual(p,new ConstantPredicate(false));
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreRightProcedure.java
  
  Index: TestIgnoreRightProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreRightProcedure.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestIgnoreRightProcedure.java	4 Mar 2003 21:33:56 -0000	1.1
  +++ TestIgnoreRightProcedure.java	2 Dec 2003 17:06:29 -0000	1.2
  @@ -61,7 +61,7 @@
   
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryProcedure;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   import org.apache.commons.functor.core.NoOp;
   
   /**
  @@ -103,7 +103,7 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        BinaryProcedure p = new IgnoreRightProcedure(new UnaryFunctionUnaryProcedure(new IdentityFunction()));
  +        BinaryProcedure p = new IgnoreRightProcedure(new UnaryFunctionUnaryProcedure(new Identity()));
           p.run(Boolean.TRUE,null);
       }
       
  
  
  
  1.4       +5 -5      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBoundProcedure.java
  
  Index: TestBoundProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBoundProcedure.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestBoundProcedure.java	24 Feb 2003 11:48:08 -0000	1.3
  +++ TestBoundProcedure.java	2 Dec 2003 17:06:29 -0000	1.4
  @@ -61,7 +61,7 @@
   
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.Procedure;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   import org.apache.commons.functor.core.NoOp;
   
   /**
  @@ -103,7 +103,7 @@
       // ------------------------------------------------------------------------    
   
       public void testRun() throws Exception {
  -        Procedure p = new BoundProcedure(new UnaryFunctionUnaryProcedure(new IdentityFunction()),Boolean.TRUE);
  +        Procedure p = new BoundProcedure(new UnaryFunctionUnaryProcedure(new Identity()),Boolean.TRUE);
           p.run();
       }
       
  @@ -113,7 +113,7 @@
           assertObjectsAreEqual(f,new BoundProcedure(new NoOp(),"xyzzy"));
           assertObjectsAreNotEqual(f,new NoOp());
           assertObjectsAreNotEqual(f,new BoundProcedure(new NoOp(),"foo"));
  -        assertObjectsAreNotEqual(f,new BoundProcedure(new UnaryFunctionUnaryProcedure(new IdentityFunction()),"xyzzy"));
  +        assertObjectsAreNotEqual(f,new BoundProcedure(new UnaryFunctionUnaryProcedure(new Identity()),"xyzzy"));
           assertObjectsAreNotEqual(f,new BoundProcedure(null,"xyzzy"));
           assertObjectsAreNotEqual(f,new BoundProcedure(new NoOp(),null));
           assertObjectsAreEqual(new BoundProcedure(null,null),new BoundProcedure(null,null));
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreLeftFunction.java
  
  Index: TestIgnoreLeftFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreLeftFunction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestIgnoreLeftFunction.java	4 Mar 2003 21:33:56 -0000	1.1
  +++ TestIgnoreLeftFunction.java	2 Dec 2003 17:06:29 -0000	1.2
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryFunction;
   import org.apache.commons.functor.core.ConstantFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -103,7 +103,7 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        BinaryFunction f = new IgnoreLeftFunction(new IdentityFunction());
  +        BinaryFunction f = new IgnoreLeftFunction(new Identity());
           assertNull(f.evaluate(null,null));
           assertNull(f.evaluate("xyzzy",null));
           assertEquals("xyzzy",f.evaluate(null,"xyzzy"));
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreRightFunction.java
  
  Index: TestIgnoreRightFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreRightFunction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestIgnoreRightFunction.java	4 Mar 2003 21:33:56 -0000	1.1
  +++ TestIgnoreRightFunction.java	2 Dec 2003 17:06:29 -0000	1.2
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryFunction;
   import org.apache.commons.functor.core.ConstantFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -103,7 +103,7 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        BinaryFunction f = new IgnoreRightFunction(new IdentityFunction());
  +        BinaryFunction f = new IgnoreRightFunction(new Identity());
           assertNull(f.evaluate(null,null));
           assertNull(f.evaluate(null,"xyzzy"));
           assertEquals("xyzzy",f.evaluate("xyzzy",null));
  
  
  
  1.2       +6 -6      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java
  
  Index: TestIgnoreLeftPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestIgnoreLeftPredicate.java	4 Mar 2003 21:33:56 -0000	1.1
  +++ TestIgnoreLeftPredicate.java	2 Dec 2003 17:06:29 -0000	1.2
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryPredicate;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -103,15 +103,15 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        BinaryPredicate p = new IgnoreLeftPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction()));
  +        BinaryPredicate p = new IgnoreLeftPredicate(new UnaryFunctionUnaryPredicate(new Identity()));
           assertTrue(p.test(null,Boolean.TRUE));
           assertTrue(!p.test(null,Boolean.FALSE));
       }
       
       public void testEquals() throws Exception {
  -        BinaryPredicate p = new IgnoreLeftPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction()));
  +        BinaryPredicate p = new IgnoreLeftPredicate(new UnaryFunctionUnaryPredicate(new Identity()));
           assertEquals(p,p);
  -        assertObjectsAreEqual(p,new IgnoreLeftPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction())));
  +        assertObjectsAreEqual(p,new IgnoreLeftPredicate(new UnaryFunctionUnaryPredicate(new Identity())));
           assertObjectsAreNotEqual(p,new ConstantPredicate(true));
           assertObjectsAreNotEqual(p,new IgnoreLeftPredicate(new ConstantPredicate(false)));
           assertObjectsAreNotEqual(p,new ConstantPredicate(false));
  
  
  
  1.3       +5 -5      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBoundPredicate.java
  
  Index: TestBoundPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBoundPredicate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestBoundPredicate.java	19 Feb 2003 00:54:36 -0000	1.2
  +++ TestBoundPredicate.java	2 Dec 2003 17:06:29 -0000	1.3
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.Predicate;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -104,11 +104,11 @@
   
       public void testTest() throws Exception {
           {
  -            Predicate p = new BoundPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction()),Boolean.TRUE);
  +            Predicate p = new BoundPredicate(new UnaryFunctionUnaryPredicate(new Identity()),Boolean.TRUE);
               assertEquals(true,p.test());
           }
           {
  -            Predicate p = new BoundPredicate(new UnaryFunctionUnaryPredicate(new IdentityFunction()),Boolean.FALSE);
  +            Predicate p = new BoundPredicate(new UnaryFunctionUnaryPredicate(new Identity()),Boolean.FALSE);
               assertEquals(false,p.test());
           }
       }
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreLeftProcedure.java
  
  Index: TestIgnoreLeftProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestIgnoreLeftProcedure.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestIgnoreLeftProcedure.java	4 Mar 2003 21:33:56 -0000	1.1
  +++ TestIgnoreLeftProcedure.java	2 Dec 2003 17:06:29 -0000	1.2
  @@ -61,7 +61,7 @@
   
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryProcedure;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   import org.apache.commons.functor.core.NoOp;
   
   /**
  @@ -103,7 +103,7 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        BinaryProcedure p = new IgnoreLeftProcedure(new UnaryFunctionUnaryProcedure(new IdentityFunction()));
  +        BinaryProcedure p = new IgnoreLeftProcedure(new UnaryFunctionUnaryProcedure(new Identity()));
           p.run(null,Boolean.TRUE);
       }
       
  
  
  
  1.4       +11 -11    jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBoundFunction.java
  
  Index: TestBoundFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBoundFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestBoundFunction.java	4 Mar 2003 23:11:12 -0000	1.3
  +++ TestBoundFunction.java	2 Dec 2003 17:06:29 -0000	1.4
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.Function;
   import org.apache.commons.functor.core.ConstantFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -85,7 +85,7 @@
       // ------------------------------------------------------------------------
   
       protected Object makeFunctor() {
  -        return new BoundFunction(new IdentityFunction(),"xyzzy");
  +        return new BoundFunction(new Identity(),"xyzzy");
       }
   
       // Lifecycle
  @@ -103,19 +103,19 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        Function f = new BoundFunction(new IdentityFunction(),"xyzzy");
  +        Function f = new BoundFunction(new Identity(),"xyzzy");
           assertEquals("xyzzy",f.evaluate());
       }
       
       public void testEquals() throws Exception {
  -        Function f = new BoundFunction(new IdentityFunction(),"xyzzy");
  +        Function f = new BoundFunction(new Identity(),"xyzzy");
           assertEquals(f,f);
  -        assertObjectsAreEqual(f,new BoundFunction(new IdentityFunction(),"xyzzy"));
  +        assertObjectsAreEqual(f,new BoundFunction(new Identity(),"xyzzy"));
           assertObjectsAreNotEqual(f,new ConstantFunction("xyzzy"));
  -        assertObjectsAreNotEqual(f,new BoundFunction(new IdentityFunction(),"foo"));
  +        assertObjectsAreNotEqual(f,new BoundFunction(new Identity(),"foo"));
           assertObjectsAreNotEqual(f,new BoundFunction(new ConstantFunction("xyzzy"),"foo"));
           assertObjectsAreNotEqual(f,new BoundFunction(null,"xyzzy"));
  -        assertObjectsAreNotEqual(f,new BoundFunction(new IdentityFunction(),null));
  +        assertObjectsAreNotEqual(f,new BoundFunction(new Identity(),null));
           assertObjectsAreEqual(new BoundFunction(null,null),new BoundFunction(null,null));
       }
   
  @@ -124,7 +124,7 @@
       }
   
       public void testAdapt() throws Exception {
  -        assertNotNull(BoundFunction.bind(new IdentityFunction(),"xyzzy"));
  -        assertNotNull(BoundFunction.bind(new IdentityFunction(),null));
  +        assertNotNull(BoundFunction.bind(new Identity(),"xyzzy"));
  +        assertNotNull(BoundFunction.bind(new Identity(),null));
       }
   }
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryFunction.java
  
  Index: TestCompositeUnaryFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryFunction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestCompositeUnaryFunction.java	1 Feb 2003 13:46:26 -0000	1.1
  +++ TestCompositeUnaryFunction.java	2 Dec 2003 17:06:30 -0000	1.2
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.UnaryFunction;
   import org.apache.commons.functor.core.ConstantFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -85,7 +85,7 @@
       // ------------------------------------------------------------------------
   
       protected Object makeFunctor() {
  -        return new CompositeUnaryFunction(new IdentityFunction(),new ConstantFunction(new Integer(3)));
  +        return new CompositeUnaryFunction(new Identity(),new ConstantFunction(new Integer(3)));
       }
   
       // Lifecycle
  
  
  
  1.5       +7 -7      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryFunction.java
  
  Index: TestUnaryCompositeBinaryFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestUnaryCompositeBinaryFunction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestUnaryCompositeBinaryFunction.java	2 Dec 2003 16:50:53 -0000	1.4
  +++ TestUnaryCompositeBinaryFunction.java	2 Dec 2003 17:06:30 -0000	1.5
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryFunction;
   import org.apache.commons.functor.core.ConstantFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.RightIdentity;
   
  @@ -90,7 +90,7 @@
           return new UnaryCompositeBinaryFunction(
               new RightIdentity(),
               new ConstantFunction("left"),
  -            new IdentityFunction());
  +            new Identity());
       }
   
       // Lifecycle
  @@ -111,7 +111,7 @@
           BinaryFunction f = new UnaryCompositeBinaryFunction(
               new RightIdentity(),
               new ConstantFunction("K"),
  -            new IdentityFunction());
  +            new Identity());
           assertEquals("right",f.evaluate("left","right"));
           assertNull("right",f.evaluate("left",null));
           assertEquals("right",f.evaluate(null,"right"));
  @@ -133,12 +133,12 @@
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
               new LeftIdentity(),
  -            new IdentityFunction(),
  +            new Identity(),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
               new LeftIdentity(),
               new ConstantFunction("left"),
  -            new IdentityFunction()));
  +            new Identity()));
           assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(null,null,null));
           assertObjectsAreEqual(
               new UnaryCompositeBinaryFunction(null,null,null),
  
  
  
  1.4       +8 -8      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryProcedure.java
  
  Index: TestConditionalUnaryProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryProcedure.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestConditionalUnaryProcedure.java	24 Feb 2003 11:48:09 -0000	1.3
  +++ TestConditionalUnaryProcedure.java	2 Dec 2003 17:06:30 -0000	1.4
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.UnaryProcedure;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.IdentityPredicate;
  +import org.apache.commons.functor.core.Identity;
   import org.apache.commons.functor.core.NoOp;
   
   /**
  @@ -110,7 +110,7 @@
           RunCounter left = new RunCounter();
           RunCounter right = new RunCounter();
           ConditionalUnaryProcedure p = new ConditionalUnaryProcedure(
  -            new IdentityPredicate(),
  +            new Identity(),
               left,
               right);
           assertEquals(0,left.count);
  @@ -128,12 +128,12 @@
       
       public void testEquals() throws Exception {
           ConditionalUnaryProcedure p = new ConditionalUnaryProcedure(
  -            new IdentityPredicate(),
  +            new Identity(),
               new NoOp(),
               new NoOp());
           assertEquals(p,p);
           assertObjectsAreEqual(p,new ConditionalUnaryProcedure(
  -            new IdentityPredicate(),
  +            new Identity(),
               new NoOp(),
               new NoOp()));
           assertObjectsAreNotEqual(p,new ConditionalUnaryProcedure(
  @@ -145,11 +145,11 @@
               new NoOp(),
               new NoOp()));
           assertObjectsAreNotEqual(p,new ConditionalUnaryProcedure(
  -            new IdentityPredicate(),
  +            new Identity(),
               null,
               new NoOp()));
           assertObjectsAreNotEqual(p,new ConditionalUnaryProcedure(
  -            new IdentityPredicate(),
  +            new Identity(),
               new NoOp(),
               null));
       }
  
  
  
  1.3       +7 -7      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryFunction.java
  
  Index: TestConditionalUnaryFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryFunction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestConditionalUnaryFunction.java	29 Jan 2003 23:24:52 -0000	1.2
  +++ TestConditionalUnaryFunction.java	2 Dec 2003 17:06:30 -0000	1.3
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.core.ConstantFunction;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.IdentityPredicate;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -107,7 +107,7 @@
       
       public void testEvaluate() throws Exception {
           ConditionalUnaryFunction f = new ConditionalUnaryFunction(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantFunction("left"),
               new ConstantFunction("right"));
           assertEquals("left",f.evaluate(Boolean.TRUE));
  @@ -116,16 +116,16 @@
       
       public void testEquals() throws Exception {
           ConditionalUnaryFunction f = new ConditionalUnaryFunction(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantFunction("left"),
               new ConstantFunction("right"));
           assertEquals(f,f);
           assertObjectsAreEqual(f,new ConditionalUnaryFunction(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantFunction("left"),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new ConditionalUnaryFunction(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantFunction(null),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new ConditionalUnaryFunction(
  
  
  
  1.3       +7 -7      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryPredicate.java
  
  Index: TestConditionalUnaryPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryPredicate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestConditionalUnaryPredicate.java	29 Jan 2003 23:24:52 -0000	1.2
  +++ TestConditionalUnaryPredicate.java	2 Dec 2003 17:06:30 -0000	1.3
  @@ -61,7 +61,7 @@
   
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.IdentityPredicate;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -106,7 +106,7 @@
       
       public void testTest() throws Exception {
           ConditionalUnaryPredicate p = new ConditionalUnaryPredicate(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantPredicate(true),
               new ConstantPredicate(false));
           assertTrue(p.test(Boolean.TRUE));
  @@ -115,16 +115,16 @@
       
       public void testEquals() throws Exception {
           ConditionalUnaryPredicate p = new ConditionalUnaryPredicate(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantPredicate(true),
               new ConstantPredicate(true));
           assertEquals(p,p);
           assertObjectsAreEqual(p,new ConditionalUnaryPredicate(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantPredicate(true),
               new ConstantPredicate(true)));
           assertObjectsAreNotEqual(p,new ConditionalUnaryPredicate(
  -            new IdentityPredicate(),
  +            new Identity(),
               new ConstantPredicate(false),
               new ConstantPredicate(true)));
           assertObjectsAreNotEqual(p,new ConditionalUnaryPredicate(
  
  
  
  1.8       +6 -6      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/FlexiMapExample.java
  
  Index: FlexiMapExample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/FlexiMapExample.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FlexiMapExample.java	2 Dec 2003 16:50:53 -0000	1.7
  +++ FlexiMapExample.java	2 Dec 2003 17:06:30 -0000	1.8
  @@ -75,7 +75,7 @@
   import org.apache.commons.functor.adapter.IgnoreLeftFunction;
   import org.apache.commons.functor.adapter.UnaryProcedureUnaryFunction;
   import org.apache.commons.functor.core.ConstantFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   import org.apache.commons.functor.core.IsInstanceOf;
   import org.apache.commons.functor.core.IsNull;
   import org.apache.commons.functor.core.RightIdentity;
  @@ -457,7 +457,7 @@
                       /*
                        * and passing through all non-null values.
                        */      
  -                    IdentityFunction.instance()
  +                    Identity.instance()
                   )
               ),
               null
  @@ -491,7 +491,7 @@
                       /*
                        * and passing through all non-null values.
                        */      
  -					IdentityFunction.instance()
  +					Identity.instance()
   				)
   			)
   		);
  @@ -515,7 +515,7 @@
                       /*
                        * and either pass the given value through,
                        */      
  -					IdentityFunction.instance(),
  +					Identity.instance(),
                       /*
                        * or throw a ClassCastException.
                        */      
  
  
  
  1.3       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestTransformedIterator.java
  
  Index: TestTransformedIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestTransformedIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTransformedIterator.java	25 Nov 2003 19:06:42 -0000	1.2
  +++ TestTransformedIterator.java	2 Dec 2003 17:06:30 -0000	1.3
  @@ -67,7 +67,7 @@
   
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.UnaryFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   
   /**
    * @version $Revision$ $Date$
  @@ -89,7 +89,7 @@
       public Object makeFunctor() {
           List list = new ArrayList();
           list.add("xyzzy");        
  -        return TransformedIterator.transform(list.iterator(),IdentityFunction.instance());
  +        return TransformedIterator.transform(list.iterator(),Identity.instance());
       }
   
       // Lifecycle
  
  
  
  1.3       +3 -2      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityPredicate.java
  
  Index: IdentityPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityPredicate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IdentityPredicate.java	24 Nov 2003 20:12:16 -0000	1.2
  +++ IdentityPredicate.java	2 Dec 2003 17:06:30 -0000	1.3
  @@ -68,6 +68,7 @@
    * 
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated Use {@link Identity}
    */
   public final class IdentityPredicate implements UnaryPredicate, Serializable {
       
  
  
  
  1.4       +3 -2      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityFunction.java
  
  Index: IdentityFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IdentityFunction.java	24 Nov 2003 20:12:16 -0000	1.3
  +++ IdentityFunction.java	2 Dec 2003 17:06:30 -0000	1.4
  @@ -65,6 +65,7 @@
    * 
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated Use {@link Identity}
    */
   public final class IdentityFunction implements UnaryFunction, Serializable {
   
  
  
  
  1.1                  jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/Identity.java
  
  Index: Identity.java
  ===================================================================
  /* 
   * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/Identity.java,v 1.1 2003/12/02 17:06:30 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived 
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.functor.core;
  
  import java.io.Serializable;
  
  import org.apache.commons.functor.UnaryFunction;
  import org.apache.commons.functor.UnaryPredicate;
  
  /**
   * {@link #evaluate Evaluates} to its input argument.
   * 
   * {@link #test Tests} to the <code>boolean</code>
   * value of the <code>Boolean</code>-valued parameter.
   * The {@link #test} method throws an exception if 
   * the parameter isn't a non-<code>null</code> 
   * <code>Boolean</code>.
   * 
   * @version $Revision: 1.1 $ $Date: 2003/12/02 17:06:30 $
   * @author Rodney Waldhoff
   */
  public final class Identity implements UnaryFunction, UnaryPredicate, Serializable {
  
      // constructor
      // ------------------------------------------------------------------------
      public Identity() {
      }
   
      // function interface
      // ------------------------------------------------------------------------
      public Object evaluate(Object obj) {
          return obj;
      }
  
      public boolean test(Object obj) {
          return test((Boolean)obj);
      }
  
      public boolean test(Boolean bool) {
          return bool.booleanValue();
      }
  
      public boolean equals(Object that) {
          return (that instanceof Identity);
      }
      
      public int hashCode() {
          return "Identity".hashCode();
      }
      
      public String toString() {
          return "Identity";
      }
      
      // static methods
      // ------------------------------------------------------------------------
      public static Identity instance() {
          return INSTANCE;
      }
      
      // static attributes
      // ------------------------------------------------------------------------
      private static final Identity INSTANCE = new Identity();
  }
  
  
  
  1.3       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java
  
  Index: SupermarketPricingExample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SupermarketPricingExample.java	1 Dec 2003 22:01:15 -0000	1.2
  +++ SupermarketPricingExample.java	2 Dec 2003 17:06:30 -0000	1.3
  @@ -62,7 +62,7 @@
   
   import org.apache.commons.functor.UnaryFunction;
   import org.apache.commons.functor.adapter.IgnoreRightFunction;
  -import org.apache.commons.functor.core.IdentityFunction;
  +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;
  @@ -241,7 +241,7 @@
                       new BinaryFunctionUnaryFunction(
                           new BinaryCompositeBinaryFunction(
                               Subtract.instance(),
  -                            IgnoreRightFunction.adapt(IdentityFunction.instance()),
  +                            IgnoreRightFunction.adapt(Identity.instance()),
                               IgnoreRightFunction.adapt(Divide.by(3)))))));
   
           assertEquals(new Money(0*40),apple.getPrice(0));
  
  
  
  1.11      +5 -5      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java
  
  Index: TestAlgorithms.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestAlgorithms.java	1 Dec 2003 21:51:47 -0000	1.10
  +++ TestAlgorithms.java	2 Dec 2003 17:06:30 -0000	1.11
  @@ -69,7 +69,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.commons.functor.adapter.LeftBoundPredicate;
  -import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.Identity;
   import org.apache.commons.functor.core.IsEqual;
   import org.apache.commons.functor.core.Limit;
   import org.apache.commons.functor.core.Offset;
  @@ -241,7 +241,7 @@
   
       public void testApply2() {
           Set set = new HashSet();
  -        assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(list.iterator(),IdentityFunction.instance())).to(set));
  +        assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(list.iterator(),Identity.instance())).to(set));
           assertEquals(list.size(),set.size());
           for(Iterator iter = list.iterator(); iter.hasNext(); ) {
               assertTrue(set.contains(iter.next()));
  @@ -250,7 +250,7 @@
   
       public void testApply3() {
           Set set = new HashSet();
  -        assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(listWithDuplicates.iterator(),IdentityFunction.instance())).to(set));
  +        assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(listWithDuplicates.iterator(),Identity.instance())).to(set));
           assertTrue(listWithDuplicates.size() > set.size());
           for(Iterator iter = listWithDuplicates.iterator(); iter.hasNext(); ) {
               assertTrue(set.contains(iter.next()));
  
  
  

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


Mime
View raw message