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/example/kata/four DataMunger.java
Date Tue, 02 Dec 2003 16:38:45 GMT
rwaldhoff    2003/12/02 08:38:45

  Modified:    functor/src/test/org/apache/commons/functor/core
                        TestLeftIdentityPredicate.java
                        TestLeftIdentityFunction.java TestAll.java
               functor/src/test/org/apache/commons/functor/adapter
                        TestLeftBoundFunction.java
                        TestRightBoundProcedure.java
                        TestRightBoundPredicate.java
                        TestRightBoundFunction.java
               functor/src/test/org/apache/commons/functor/core/composite
                        TestTransposedPredicate.java
                        TestConditionalBinaryProcedure.java
                        TestConditionalBinaryFunction.java
                        TestBinaryCompositeBinaryFunction.java
                        TestUnaryCompositeBinaryFunction.java
                        TestTransposedFunction.java
               functor/src/java/org/apache/commons/functor/core
                        LeftIdentityPredicate.java
                        LeftIdentityFunction.java
               functor/src/test/org/apache/commons/functor/example/kata/four
                        DataMunger.java
  Added:       functor/src/test/org/apache/commons/functor/core
                        TestLeftIdentity.java
               functor/src/java/org/apache/commons/functor/core
                        LeftIdentity.java
  Log:
  deprecate LeftIdentityPredicate and LeftIdentityFunction in favor of simply LeftIdentity
  
  Revision  Changes    Path
  1.3       +3 -2      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityPredicate.java
  
  Index: TestLeftIdentityPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityPredicate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestLeftIdentityPredicate.java	24 Nov 2003 20:12:15 -0000	1.2
  +++ TestLeftIdentityPredicate.java	2 Dec 2003 16:38:45 -0000	1.3
  @@ -65,6 +65,7 @@
   /**
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated
    */
   public class TestLeftIdentityPredicate extends BaseFunctorTest {
   
  
  
  
  1.4       +3 -2      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityFunction.java
  
  Index: TestLeftIdentityFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestLeftIdentityFunction.java	24 Nov 2003 20:12:15 -0000	1.3
  +++ TestLeftIdentityFunction.java	2 Dec 2003 16:38:45 -0000	1.4
  @@ -65,6 +65,7 @@
   /**
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated
    */
   public class TestLeftIdentityFunction extends BaseFunctorTest {
   
  
  
  
  1.9       +3 -2      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestAll.java	25 Nov 2003 00:22:26 -0000	1.8
  +++ TestAll.java	2 Dec 2003 16:38:45 -0000	1.9
  @@ -76,6 +76,7 @@
           suite.addTest(TestConstantPredicate.suite());
           suite.addTest(TestNoOp.suite());
           suite.addTest(TestIdentityFunction.suite());
  +        suite.addTest(TestLeftIdentity.suite());
           suite.addTest(TestLeftIdentityFunction.suite());
           suite.addTest(TestRightIdentityFunction.suite());
           suite.addTest(TestIsInstanceOf.suite());
  
  
  
  1.1                  jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentity.java
  
  Index: TestLeftIdentity.java
  ===================================================================
  /* 
   * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentity.java,v
1.1 2003/12/02 16:38:45 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived 
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.functor.core;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.functor.BaseFunctorTest;
  import org.apache.commons.functor.BinaryFunction;
  import org.apache.commons.functor.BinaryPredicate;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/12/02 16:38:45 $
   * @author Rodney Waldhoff
   */
  public class TestLeftIdentity extends BaseFunctorTest {
  
      // Conventional
      // ------------------------------------------------------------------------
  
      public TestLeftIdentity(String testName) {
          super(testName);
      }
  
      public static Test suite() {
          return new TestSuite(TestLeftIdentity.class);
      }
  
      // Functor Testing Framework
      // ------------------------------------------------------------------------
  
      protected Object makeFunctor() {
          return new LeftIdentity();
      }
      
      // Lifecycle
      // ------------------------------------------------------------------------
  
      public void setUp() throws Exception {
          super.setUp();
      }
  
      public void tearDown() throws Exception {
          super.tearDown();
      }
  
      // Tests
      // ------------------------------------------------------------------------
      
      public void testEvaluate() throws Exception {
          BinaryFunction f = new LeftIdentity();
          assertNull(f.evaluate(null,null));
          assertNull(f.evaluate(null,"xyzzy"));
          assertEquals("xyzzy",f.evaluate("xyzzy","abcdefg"));
          assertEquals("xyzzy",f.evaluate("xyzzy",null));
          assertEquals(new Integer(3),f.evaluate(new Integer(3),null));
          Object obj = new Long(12345L);
          assertSame(obj,f.evaluate(obj,null));
          assertSame(obj,f.evaluate(obj,obj));
      }
      
      public void testTest() throws Exception {
          BinaryPredicate p = new LeftIdentity();
          assertTrue(p.test(Boolean.TRUE,null));
          assertTrue(!p.test(Boolean.FALSE,null));
          try {
              p.test("true",null);
              fail("Expected ClassCastException");
          } catch(ClassCastException e) {
              // expected
          }
          try {
              p.test(null,null);
              fail("Expected NullPointerException");
          } catch(NullPointerException e) {
              // expected
          }
      }
      
      public void testEquals() throws Exception {
          BinaryFunction f = new LeftIdentity();
          assertEquals(f,f);
          assertObjectsAreEqual(f,new LeftIdentity());
          assertObjectsAreEqual(f,LeftIdentity.instance());
          assertObjectsAreNotEqual(f,new ConstantFunction("abcde"));
          assertObjectsAreNotEqual(f,new ConstantPredicate(true));
      }
      
      public void testConstant() throws Exception {
          assertEquals(LeftIdentity.instance(),LeftIdentity.instance());
          assertSame(LeftIdentity.instance(),LeftIdentity.instance());
      }
  }
  
  
  
  1.4       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestLeftBoundFunction.java
  
  Index: TestLeftBoundFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestLeftBoundFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestLeftBoundFunction.java	4 Mar 2003 23:11:12 -0000	1.3
  +++ TestLeftBoundFunction.java	2 Dec 2003 16:38:45 -0000	1.4
  @@ -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.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.RightIdentityFunction;
   
   /**
  @@ -113,7 +113,7 @@
           assertEquals(f,f);
           assertObjectsAreEqual(f,new LeftBoundFunction(new RightIdentityFunction(),"xyzzy"));
           assertObjectsAreNotEqual(f,new ConstantFunction("xyzzy"));
  -        assertObjectsAreNotEqual(f,new LeftBoundFunction(new LeftIdentityFunction(),"xyzzy"));
  +        assertObjectsAreNotEqual(f,new LeftBoundFunction(new LeftIdentity(),"xyzzy"));
           assertObjectsAreNotEqual(f,new LeftBoundFunction(new RightIdentityFunction(),"bar"));
           assertObjectsAreNotEqual(f,new LeftBoundFunction(null,"xyzzy"));
           assertObjectsAreNotEqual(f,new LeftBoundFunction(new RightIdentityFunction(),null));
  
  
  
  1.5       +5 -5      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestRightBoundProcedure.java
  
  Index: TestRightBoundProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestRightBoundProcedure.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestRightBoundProcedure.java	4 Mar 2003 23:11:12 -0000	1.4
  +++ TestRightBoundProcedure.java	2 Dec 2003 16:38:45 -0000	1.5
  @@ -61,7 +61,7 @@
   
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.UnaryProcedure;
  -import org.apache.commons.functor.core.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.NoOp;
   
   /**
  @@ -103,7 +103,7 @@
       // ------------------------------------------------------------------------    
   
       public void testRun() throws Exception {
  -        UnaryProcedure p = new RightBoundProcedure(new BinaryFunctionBinaryProcedure(new
LeftIdentityFunction()),"foo");
  +        UnaryProcedure p = new RightBoundProcedure(new BinaryFunctionBinaryProcedure(new
LeftIdentity()),"foo");
           p.run(Boolean.TRUE);
           p.run(Boolean.FALSE);
       }
  @@ -113,7 +113,7 @@
           assertEquals(f,f);
           assertObjectsAreEqual(f,new RightBoundProcedure(new NoOp(),"xyzzy"));
           assertObjectsAreNotEqual(f,new NoOp());
  -        assertObjectsAreNotEqual(f,new RightBoundProcedure(new BinaryFunctionBinaryProcedure(new
LeftIdentityFunction()),"xyzzy"));
  +        assertObjectsAreNotEqual(f,new RightBoundProcedure(new BinaryFunctionBinaryProcedure(new
LeftIdentity()),"xyzzy"));
           assertObjectsAreNotEqual(f,new RightBoundProcedure(new NoOp(),"foo"));
           assertObjectsAreNotEqual(f,new RightBoundProcedure(null,"xyzzy"));
           assertObjectsAreNotEqual(f,new RightBoundProcedure(new NoOp(),null));
  
  
  
  1.4       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestRightBoundPredicate.java
  
  Index: TestRightBoundPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestRightBoundPredicate.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestRightBoundPredicate.java	4 Mar 2003 23:11:12 -0000	1.3
  +++ TestRightBoundPredicate.java	2 Dec 2003 16:38:45 -0000	1.4
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.UnaryPredicate;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   
   /**
    * @version $Revision$ $Date$
  @@ -103,7 +103,7 @@
       // ------------------------------------------------------------------------    
   
       public void testTest() throws Exception {
  -        UnaryPredicate f = new RightBoundPredicate(new BinaryFunctionBinaryPredicate(new
LeftIdentityFunction()),"foo");
  +        UnaryPredicate f = new RightBoundPredicate(new BinaryFunctionBinaryPredicate(new
LeftIdentity()),"foo");
           assertEquals(true,f.test(Boolean.TRUE));
           assertEquals(false,f.test(Boolean.FALSE));
       }
  
  
  
  1.4       +11 -11    jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestRightBoundFunction.java
  
  Index: TestRightBoundFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestRightBoundFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestRightBoundFunction.java	4 Mar 2003 23:11:12 -0000	1.3
  +++ TestRightBoundFunction.java	2 Dec 2003 16:38:45 -0000	1.4
  @@ -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.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.RightIdentityFunction;
   
   /**
  @@ -86,7 +86,7 @@
       // ------------------------------------------------------------------------
   
       protected Object makeFunctor() {
  -        return new RightBoundFunction(new LeftIdentityFunction(),"xyzzy");
  +        return new RightBoundFunction(new LeftIdentity(),"xyzzy");
       }
   
       // Lifecycle
  @@ -104,19 +104,19 @@
       // ------------------------------------------------------------------------    
   
       public void testEvaluate() throws Exception {
  -        UnaryFunction f = new RightBoundFunction(new LeftIdentityFunction(),"foo");
  +        UnaryFunction f = new RightBoundFunction(new LeftIdentity(),"foo");
           assertEquals("xyzzy",f.evaluate("xyzzy"));
       }
       
       public void testEquals() throws Exception {
  -        UnaryFunction f = new RightBoundFunction(new LeftIdentityFunction(),"xyzzy");
  +        UnaryFunction f = new RightBoundFunction(new LeftIdentity(),"xyzzy");
           assertEquals(f,f);
  -        assertObjectsAreEqual(f,new RightBoundFunction(new LeftIdentityFunction(),"xyzzy"));
  +        assertObjectsAreEqual(f,new RightBoundFunction(new LeftIdentity(),"xyzzy"));
           assertObjectsAreNotEqual(f,new ConstantFunction("xyzzy"));
           assertObjectsAreNotEqual(f,new RightBoundFunction(new RightIdentityFunction(),"xyzzy"));
  -        assertObjectsAreNotEqual(f,new RightBoundFunction(new LeftIdentityFunction(),"bar"));
  +        assertObjectsAreNotEqual(f,new RightBoundFunction(new LeftIdentity(),"bar"));
           assertObjectsAreNotEqual(f,new RightBoundFunction(null,"xyzzy"));
  -        assertObjectsAreNotEqual(f,new RightBoundFunction(new LeftIdentityFunction(),null));
  +        assertObjectsAreNotEqual(f,new RightBoundFunction(new LeftIdentity(),null));
           assertObjectsAreEqual(new RightBoundFunction(null,null),new RightBoundFunction(null,null));
       }
   
  @@ -125,7 +125,7 @@
       }
   
       public void testAdapt() throws Exception {
  -        assertNotNull(RightBoundFunction.bind(new LeftIdentityFunction(),"xyzzy"));
  -        assertNotNull(RightBoundFunction.bind(new LeftIdentityFunction(),null));
  +        assertNotNull(RightBoundFunction.bind(new LeftIdentity(),"xyzzy"));
  +        assertNotNull(RightBoundFunction.bind(new LeftIdentity(),null));
       }
   }
  
  
  
  1.4       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestTransposedPredicate.java
  
  Index: TestTransposedPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestTransposedPredicate.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestTransposedPredicate.java	24 Nov 2003 20:31:20 -0000	1.3
  +++ TestTransposedPredicate.java	2 Dec 2003 16:38:45 -0000	1.4
  @@ -63,7 +63,7 @@
   import org.apache.commons.functor.BinaryPredicate;
   import org.apache.commons.functor.adapter.BinaryFunctionBinaryPredicate;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   
   /**
    * @version $Revision$ $Date$
  @@ -104,7 +104,7 @@
       // ------------------------------------------------------------------------
       
       public void testEvaluate() throws Exception {
  -        BinaryPredicate p = new TransposedPredicate(BinaryFunctionBinaryPredicate.adapt(new
LeftIdentityFunction()));
  +        BinaryPredicate p = new TransposedPredicate(BinaryFunctionBinaryPredicate.adapt(new
LeftIdentity()));
           assertEquals(true,p.test(Boolean.FALSE,Boolean.TRUE));
           assertEquals(false,p.test(Boolean.TRUE,Boolean.FALSE));
       }
  
  
  
  1.4       +8 -8      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java
  
  Index: TestConditionalBinaryProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestConditionalBinaryProcedure.java	24 Feb 2003 11:48:09 -0000	1.3
  +++ TestConditionalBinaryProcedure.java	2 Dec 2003 16:38:45 -0000	1.4
  @@ -62,7 +62,7 @@
   import org.apache.commons.functor.BaseFunctorTest;
   import org.apache.commons.functor.BinaryProcedure;
   import org.apache.commons.functor.core.ConstantPredicate;
  -import org.apache.commons.functor.core.LeftIdentityPredicate;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.NoOp;
   
   /**
  @@ -110,7 +110,7 @@
           RunCounter left = new RunCounter();
           RunCounter right = new RunCounter();
           ConditionalBinaryProcedure p = new ConditionalBinaryProcedure(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               left,
               right);
           assertEquals(0,left.count);
  @@ -128,12 +128,12 @@
       
       public void testEquals() throws Exception {
           ConditionalBinaryProcedure p = new ConditionalBinaryProcedure(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               new NoOp(),
               new NoOp());
           assertEquals(p,p);
           assertObjectsAreEqual(p,new ConditionalBinaryProcedure(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               new NoOp(),
               new NoOp()));
           assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
  @@ -145,11 +145,11 @@
               new NoOp(),
               new NoOp()));
           assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               null,
               new NoOp()));
           assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               new NoOp(),
               null));
       }
  
  
  
  1.3       +7 -7      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java
  
  Index: TestConditionalBinaryFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestConditionalBinaryFunction.java	29 Jan 2003 23:24:52 -0000	1.2
  +++ TestConditionalBinaryFunction.java	2 Dec 2003 16:38:45 -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.LeftIdentityPredicate;
  +import org.apache.commons.functor.core.LeftIdentity;
   
   /**
    * @version $Revision$ $Date$
  @@ -107,7 +107,7 @@
       
       public void testEvaluate() throws Exception {
           ConditionalBinaryFunction f = new ConditionalBinaryFunction(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new ConstantFunction("right"));
           assertEquals("left",f.evaluate(Boolean.TRUE,null));
  @@ -116,16 +116,16 @@
       
       public void testEquals() throws Exception {
           ConditionalBinaryFunction f = new ConditionalBinaryFunction(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new ConstantFunction("right"));
           assertEquals(f,f);
           assertObjectsAreEqual(f,new ConditionalBinaryFunction(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
  -            new LeftIdentityPredicate(),
  +            new LeftIdentity(),
               new ConstantFunction(null),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
  
  
  
  1.3       +7 -7      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestBinaryCompositeBinaryFunction.java
  
  Index: TestBinaryCompositeBinaryFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestBinaryCompositeBinaryFunction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestBinaryCompositeBinaryFunction.java	4 Mar 2003 23:11:11 -0000	1.2
  +++ TestBinaryCompositeBinaryFunction.java	2 Dec 2003 16:38:45 -0000	1.3
  @@ -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.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.RightIdentityFunction;
   
   /**
  @@ -118,12 +118,12 @@
       
       public void testEquals() throws Exception {
           BinaryFunction f = new BinaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new ConstantFunction("right"));
           assertEquals(f,f);
           assertObjectsAreEqual(f,new BinaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new BinaryCompositeBinaryFunction(
  @@ -131,11 +131,11 @@
               new ConstantFunction("left"),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new BinaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new RightIdentityFunction(),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new BinaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new RightIdentityFunction()));
           assertObjectsAreNotEqual(f,new BinaryCompositeBinaryFunction(null,null,null));
  
  
  
  1.3       +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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestUnaryCompositeBinaryFunction.java	4 Mar 2003 23:11:11 -0000	1.2
  +++ TestUnaryCompositeBinaryFunction.java	2 Dec 2003 16:38:45 -0000	1.3
  @@ -63,7 +63,7 @@
   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.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.RightIdentityFunction;
   
   /**
  @@ -119,12 +119,12 @@
       
       public void testEquals() throws Exception {
           BinaryFunction f = new UnaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new ConstantFunction("right"));
           assertEquals(f,f);
           assertObjectsAreEqual(f,new UnaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
  @@ -132,11 +132,11 @@
               new ConstantFunction("left"),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new IdentityFunction(),
               new ConstantFunction("right")));
           assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(
  -            new LeftIdentityFunction(),
  +            new LeftIdentity(),
               new ConstantFunction("left"),
               new IdentityFunction()));
           assertObjectsAreNotEqual(f,new UnaryCompositeBinaryFunction(null,null,null));
  
  
  
  1.2       +7 -7      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestTransposedFunction.java
  
  Index: TestTransposedFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestTransposedFunction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestTransposedFunction.java	27 Jan 2003 19:33:43 -0000	1.1
  +++ TestTransposedFunction.java	2 Dec 2003 16:38:45 -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.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.RightIdentityFunction;
   
   /**
  @@ -86,7 +86,7 @@
       // ------------------------------------------------------------------------
   
       protected Object makeFunctor() {
  -        return new TransposedFunction(new LeftIdentityFunction());
  +        return new TransposedFunction(new LeftIdentity());
       }
   
       // Lifecycle
  @@ -104,15 +104,15 @@
       // ------------------------------------------------------------------------
       
       public void testEvaluate() throws Exception {
  -        BinaryFunction f = new TransposedFunction(new LeftIdentityFunction());
  +        BinaryFunction f = new TransposedFunction(new LeftIdentity());
           assertEquals("xyzzy",f.evaluate(null,"xyzzy"));
           assertNull(f.evaluate("xyzzy",null));
       }
           
       public void testEquals() throws Exception {
  -        BinaryFunction f = new TransposedFunction(new LeftIdentityFunction());
  +        BinaryFunction f = new TransposedFunction(new LeftIdentity());
           assertEquals(f,f);
  -        assertObjectsAreEqual(f,new TransposedFunction(new LeftIdentityFunction()));
  +        assertObjectsAreEqual(f,new TransposedFunction(new LeftIdentity()));
           assertObjectsAreNotEqual(f,new TransposedFunction(new RightIdentityFunction()));
           assertObjectsAreNotEqual(f,new TransposedFunction(null));
           assertObjectsAreNotEqual(f,new ConstantFunction("y"));
  
  
  
  1.3       +3 -2      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityPredicate.java
  
  Index: LeftIdentityPredicate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityPredicate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LeftIdentityPredicate.java	24 Nov 2003 20:12:16 -0000	1.2
  +++ LeftIdentityPredicate.java	2 Dec 2003 16:38:45 -0000	1.3
  @@ -69,6 +69,7 @@
    * 
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated Use {@link LeftIdentity}
    */
   public final class LeftIdentityPredicate implements BinaryPredicate, Serializable {
       
  
  
  
  1.4       +3 -2      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityFunction.java
  
  Index: LeftIdentityFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LeftIdentityFunction.java	24 Nov 2003 20:12:16 -0000	1.3
  +++ LeftIdentityFunction.java	2 Dec 2003 16:38:45 -0000	1.4
  @@ -65,6 +65,7 @@
    * 
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
  + * @deprecated Use {@link LeftIdentity}
    */
   public final class LeftIdentityFunction implements BinaryFunction, Serializable {
   
  
  
  
  1.1                  jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentity.java
  
  Index: LeftIdentity.java
  ===================================================================
  /* 
   * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentity.java,v
1.1 2003/12/02 16:38:45 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived 
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.functor.core;
  
  import java.io.Serializable;
  
  import org.apache.commons.functor.BinaryFunction;
  import org.apache.commons.functor.BinaryPredicate;
  
  /**
   * {@link #evaluate Evaluates} to its first argument.
   * 
   * {@link #test Tests} to the <code>boolean</code>
   * value of the <code>Boolean</code>-valued first
   * argument. The {@link #test 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 16:38:45 $
   * @author Rodney Waldhoff
   */
  public final class LeftIdentity implements BinaryPredicate, BinaryFunction, Serializable
{
      
      // constructor
      // ------------------------------------------------------------------------
      public LeftIdentity() {
      }
   
      // functor interface
      // ------------------------------------------------------------------------
  
      public Object evaluate(Object left, Object right) {
          return left;
      }
  
      public boolean test(Object left, Object right) {
          return test((Boolean)left);
      }
  
      private boolean test(Boolean bool) {
          return bool.booleanValue();
      }
  
      public boolean equals(Object that) {
          return (that instanceof LeftIdentity);
      }
      
      public int hashCode() {
          return "LeftIdentity".hashCode();
      }
      
      public String toString() {
          return "LeftIdentity";
      }
      
      // static methods
      // ------------------------------------------------------------------------
      public static LeftIdentity instance() {
          return INSTANCE;
      }
      
      // static attributes
      // ------------------------------------------------------------------------
      private static final LeftIdentity INSTANCE = new LeftIdentity();
  }
  
  
  
  1.3       +4 -4      jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/DataMunger.java
  
  Index: DataMunger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/DataMunger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DataMunger.java	2 Dec 2003 16:36:11 -0000	1.2
  +++ DataMunger.java	2 Dec 2003 16:38:45 -0000	1.3
  @@ -71,7 +71,7 @@
   import org.apache.commons.functor.adapter.UnaryFunctionUnaryPredicate;
   import org.apache.commons.functor.adapter.UnaryPredicateUnaryFunction;
   import org.apache.commons.functor.core.IsNull;
  -import org.apache.commons.functor.core.LeftIdentityFunction;
  +import org.apache.commons.functor.core.LeftIdentity;
   import org.apache.commons.functor.core.RightIdentityFunction;
   import org.apache.commons.functor.core.comparator.IsLessThan;
   import org.apache.commons.functor.core.composite.BinaryCompositeBinaryFunction;
  @@ -119,7 +119,7 @@
                           BinaryPredicateBinaryFunction.adapt(IsLessThan.instance()),
                           IgnoreRightFunction.adapt(absSpread(col1,col2)),
                           IgnoreLeftFunction.adapt(absSpread(col1,col2)))),
  -                LeftIdentityFunction.instance(),
  +                LeftIdentity.instance(),
                   RightIdentityFunction.instance()
               )
           );
  
  
  

---------------------------------------------------------------------
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