svn commit: r149326 - jakarta/commons/proper/primitives/trunk/build.xml
Author: rwaldhoff Date: Mon Jan 31 16:14:07 2005 New Revision: 149326 URL: http://svn.apache.org/viewcvs?view=revrev=149326 Log: test svn commit Modified: jakarta/commons/proper/primitives/trunk/build.xml Modified: jakarta/commons/proper/primitives/trunk/build.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/primitives/trunk/build.xml?view=diffr1=149325r2=149326 == --- jakarta/commons/proper/primitives/trunk/build.xml (original) +++ jakarta/commons/proper/primitives/trunk/build.xml Mon Jan 31 16:14:07 2005 @@ -1,5 +1,5 @@ !-- - Copyright 2003-2004 The Apache Software Foundation + Copyright 2003-2005 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ !-- Primitives component of the Jakarta Commons Subproject -$Id: build.xml,v 1.11 2004/07/29 22:30:55 scolebourne Exp $ +$Id$ -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r149328 - jakarta/commons/proper/primitives/trunk/junit1444170519.properties
Author: rwaldhoff Date: Mon Jan 31 16:17:09 2005 New Revision: 149328 URL: http://svn.apache.org/viewcvs?view=revrev=149328 Log: remove file that should never have been checked in Removed: jakarta/commons/proper/primitives/trunk/junit1444170519.properties - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r149329 - jakarta/commons/proper/primitives/trunk/junit1609176495.properties
Author: rwaldhoff Date: Mon Jan 31 16:17:40 2005 New Revision: 149329 URL: http://svn.apache.org/viewcvs?view=revrev=149329 Log: remove file that should never have been checked in Removed: jakarta/commons/proper/primitives/trunk/junit1609176495.properties - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r149332 - in jakarta/commons/proper/primitives/trunk/src: java/org/apache/commons/collections/primitives/ test/org/apache/commons/collections/primitives/
Author: rwaldhoff Date: Mon Jan 31 16:38:33 2005 New Revision: 149332 URL: http://svn.apache.org/viewcvs?view=revrev=149332 Log: add array constructor and tests Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedByteList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedIntList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedShortList.java jakarta/commons/proper/primitives/trunk/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedByteList.java jakarta/commons/proper/primitives/trunk/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedIntList.java jakarta/commons/proper/primitives/trunk/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedShortList.java Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedByteList.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedByteList.java?view=diffr1=149331r2=149332 == --- jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedByteList.java (original) +++ jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedByteList.java Mon Jan 31 16:38:33 2005 @@ -34,7 +34,7 @@ * This implementation supports all optional methods. * * @since Commons Primitives 1.0 - * @version $Revision: 1.5 $ $Date: 2004/02/25 20:46:25 $ + * @version $Revision: 1.5 $ $Date$ * * @author Rodney Waldhoff */ @@ -78,6 +78,20 @@ addAll(that); } +/** + * Constructs a list by copying the specified array. + * + * @param array the array to initialize the collection with + * @throws NullPointerException if the array is codenull/code + */ +public ArrayUnsignedByteList(short[] array) { +this(array.length); +for(int i=0;iarray.length;i++) { +_data[i] = fromShort(array[i]); +} +_size = array.length; +} + // ShortList methods //- Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedIntList.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedIntList.java?view=diffr1=149331r2=149332 == --- jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedIntList.java (original) +++ jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedIntList.java Mon Jan 31 16:38:33 2005 @@ -34,7 +34,7 @@ * This implementation supports all optional methods. * * @since Commons Primitives 1.0 - * @version $Revision: 1.5 $ $Date: 2004/02/25 20:46:25 $ + * @version $Revision: 1.5 $ $Date$ * * @author Rodney Waldhoff */ @@ -78,6 +78,20 @@ addAll(that); } +/** + * Constructs a list by copying the specified array. + * + * @param array the array to initialize the collection with + * @throws NullPointerException if the array is codenull/code + */ +public ArrayUnsignedIntList(long[] array) { +this(array.length); +for(int i=0;iarray.length;i++) { +_data[i] = fromLong(array[i]); +} +_size = array.length; +} + // IntList methods //- Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedShortList.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedShortList.java?view=diffr1=149331r2=149332 == --- jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedShortList.java (original) +++ jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayUnsignedShortList.java Mon Jan 31 16:38:33 2005 @@ -34,7 +34,7 @@ * This implementation supports all optional methods. * * @since Commons Primitives 1.0 - * @version $Revision: 1.5 $ $Date: 2004/02/25 20:46:25 $ + * @version $Revision: 1.5 $ $Date$ * * @author Rodney Waldhoff */ @@ -78,6 +78,20 @@ addAll(that); } +/** + * Constructs a list by copying
svn commit: r149335 - in jakarta/commons/proper/primitives/trunk: src/java/org/apache/commons/collections/primitives/ xdocs/
Author: rwaldhoff Date: Mon Jan 31 16:47:45 2005 New Revision: 149335 URL: http://svn.apache.org/viewcvs?view=revrev=149335 Log: remove unused, note changes to ArrayUnsignedXxxList Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayBooleanList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayByteList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayCharList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayDoubleList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayFloatList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayIntList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayLongList.java jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayShortList.java jakarta/commons/proper/primitives/trunk/xdocs/changes.xml Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayBooleanList.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayBooleanList.java?view=diffr1=149334r2=149335 == --- jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayBooleanList.java (original) +++ jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayBooleanList.java Mon Jan 31 16:47:45 2005 @@ -25,7 +25,7 @@ * This implementation supports all optional methods. * * @since Commons Primitives 1.1 - * @version $Revision: 1.5 $ $Date: 2005/01/03 23:41:04 $ + * @version $Revision: 1.5 $ $Date$ */ public class ArrayBooleanList extends RandomAccessBooleanList implements BooleanList, Serializable { @@ -181,7 +181,6 @@ // Need to move some elements System.arraycopy(_data, index, _data, index + collection.size(), _size - index); } -int ptr = index; for (BooleanIterator it = collection.iterator(); it.hasNext();) { _data[index] = it.next(); index++; Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayByteList.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayByteList.java?view=diffr1=149334r2=149335 == --- jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayByteList.java (original) +++ jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayByteList.java Mon Jan 31 16:47:45 2005 @@ -25,7 +25,7 @@ * This implementation supports all optional methods. * * @since Commons Primitives 1.0 - * @version $Revision: 1.7 $ $Date: 2005/01/03 23:41:04 $ + * @version $Revision: 1.7 $ $Date$ * * @author Rodney Waldhoff */ @@ -184,7 +184,6 @@ // Need to move some elements System.arraycopy(_data, index, _data, index + collection.size(), _size - index); } -int ptr = index; for (ByteIterator it = collection.iterator(); it.hasNext();) { _data[index] = it.next(); index++; Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayCharList.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayCharList.java?view=diffr1=149334r2=149335 == --- jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayCharList.java (original) +++ jakarta/commons/proper/primitives/trunk/src/java/org/apache/commons/collections/primitives/ArrayCharList.java Mon Jan 31 16:47:45 2005 @@ -25,7 +25,7 @@ * This implementation supports all optional methods. * * @since Commons Primitives 1.0 - * @version $Revision: 1.7 $ $Date: 2005/01/03 23:41:04 $ + * @version $Revision: 1.7 $ $Date$ * * @author Rodney Waldhoff */ @@ -184,7 +184,6 @@ // Need to move some elements System.arraycopy(_data, index, _data, index + collection.size(), _size - index); } -int ptr = index; for (CharIterator it = collection.iterator(); it.hasNext();) { _data[index] = it.next(); index++; Modified: jakarta/commons/proper/primitives/trunk/src/java/org/apache
cvs commit: jakarta-commons/primitives/src/conf MANIFEST.MF
rwaldhoff2004/07/12 09:08:00 Modified:primitives/src/conf MANIFEST.MF Log: update version number to 1.1 Revision ChangesPath 1.3 +1 -1 jakarta-commons/primitives/src/conf/MANIFEST.MF Index: MANIFEST.MF === RCS file: /home/cvs/jakarta-commons/primitives/src/conf/MANIFEST.MF,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MANIFEST.MF 16 Oct 2003 20:48:17 - 1.2 +++ MANIFEST.MF 12 Jul 2004 16:08:00 - 1.3 @@ -1,7 +1,7 @@ Extension-Name: @name@ Specification-Title: Jakarta Commons Primitives Specification-Vendor: Apache Software Foundation -Specification-Version: 1.0 +Specification-Version: 1.1 Implementation-Vendor: Apache Software Foundation Implementation-Title: org.apache.commons.primitives Implementation-Version: @version@ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/primitives/xdocs changes.xml
rwaldhoff2004/07/12 09:19:13 Added: primitives/xdocs changes.xml Log: add changes.xml Revision ChangesPath 1.1 jakarta-commons/primitives/xdocs/changes.xml Index: changes.xml === ?xml version=1.0? !-- Copyright 2003-2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- document properties titleCommons Primitives: Changes/title author email=[EMAIL PROTECTED]Commons Documentation Team/author /properties body release version=1.1 date=in CVS action dev=akarasulu type=add Add BooleanXXX collections. /action action dev=rwaldhoff type=add Add convenience methods for constructing adapters in org.apache.commons.collections.primitives.adapters.Adapt, allowing calls like Adapt.toList(primitiveList), etc. /action action dev=rwaldhoff type=update Override clear() in ArrayXXXList for better performance. /action /release release version=1.0 date=2003-11-05 action dev=rwaldhoff type=add Initial release, containing types initially developed (and unofficially released) as part of the Jakarta Commons Collections component. /action /release /body /document - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/primitives/xdocs changes.xml
rwaldhoff2004/07/12 09:30:35 Modified:primitives/xdocs changes.xml Log: note XxxStack additions Revision ChangesPath 1.2 +4 -0 jakarta-commons/primitives/xdocs/changes.xml Index: changes.xml === RCS file: /home/cvs/jakarta-commons/primitives/xdocs/changes.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- changes.xml 12 Jul 2004 16:19:13 - 1.1 +++ changes.xml 12 Jul 2004 16:30:35 - 1.2 @@ -22,6 +22,10 @@ body release version=1.1 date=in CVS + +action dev=akarasulu type=add + Add XXXStack collections. +/action action dev=akarasulu type=add Add BooleanXXX collections. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives TestLongStack.java TestIntStack.java TestFloatStack.java TestByteStack.java TestShortStack.java TestCharStack.java TestDoubleStack.java
rwaldhoff2004/07/12 09:33:47 Modified:primitives/src/test/org/apache/commons/collections/primitives TestLongStack.java TestIntStack.java TestFloatStack.java TestByteStack.java TestShortStack.java TestCharStack.java TestDoubleStack.java Log: hook in stack tests Revision ChangesPath 1.2 +2 -2 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestLongStack.java Index: TestLongStack.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestLongStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestLongStack.java14 Apr 2004 22:42:08 - 1.1 +++ TestLongStack.java12 Jul 2004 16:33:47 - 1.2 @@ -43,7 +43,7 @@ } public static TestSuite suite() { -return new TestSuite(TestBooleanStack.class); +return new TestSuite(TestLongStack.class); } 1.2 +2 -2 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestIntStack.java Index: TestIntStack.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestIntStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestIntStack.java 14 Apr 2004 22:42:07 - 1.1 +++ TestIntStack.java 12 Jul 2004 16:33:47 - 1.2 @@ -43,7 +43,7 @@ } public static TestSuite suite() { -return new TestSuite(TestBooleanStack.class); +return new TestSuite(TestIntStack.class); } 1.2 +2 -2 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestFloatStack.java Index: TestFloatStack.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestFloatStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestFloatStack.java 14 Apr 2004 22:42:08 - 1.1 +++ TestFloatStack.java 12 Jul 2004 16:33:47 - 1.2 @@ -43,7 +43,7 @@ } public static TestSuite suite() { -return new TestSuite(TestBooleanStack.class); +return new TestSuite(TestFloatStack.class); } 1.2 +2 -2 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestByteStack.java Index: TestByteStack.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestByteStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestByteStack.java14 Apr 2004 22:42:08 - 1.1 +++ TestByteStack.java12 Jul 2004 16:33:47 - 1.2 @@ -43,7 +43,7 @@ } public static TestSuite suite() { -return new TestSuite(TestBooleanStack.class); +return new TestSuite(TestByteStack.class); } 1.2 +3 -4 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestShortStack.java Index: TestShortStack.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestShortStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestShortStack.java 14 Apr 2004 22:42:08 - 1.1 +++ TestShortStack.java 12 Jul 2004 16:33:47 - 1.2 @@ -26,9 +26,8 @@ /** * Tests the ShortStack class. * - * @author a href=mailto:[EMAIL PROTECTED] - * Apache Directory Project/a - * @version $Rev: 9968 $ + * @author a href=mailto:[EMAIL PROTECTED]Apache Directory Project/a + * @version $Revision$ $Date$ */ public class TestShortStack extends TestCase { @@ -46,7 +45,7 @@ } public static TestSuite suite() { -return new TestSuite(TestBooleanStack.class); +return new TestSuite(TestShortStack.class); } 1.2 +2 -2 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestCharStack.java Index: TestCharStack.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestCharStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2
cvs commit: jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives ArrayBooleanList.java RandomAccessBooleanList.java
rwaldhoff2004/07/12 11:29:44 Modified:primitives/src/test/org/apache/commons/collections/primitives PackageTestSuite.java primitives/src/java/org/apache/commons/collections/primitives ArrayBooleanList.java RandomAccessBooleanList.java Added: primitives/src/java/org/apache/commons/collections/primitives/adapters ListIteratorBooleanListIterator.java ListBooleanList.java NonSerializableBooleanListList.java NonSerializableListBooleanList.java BooleanListIteratorListIterator.java AbstractBooleanListList.java BooleanListList.java AbstractListBooleanList.java primitives/src/test/org/apache/commons/collections/primitives TestRandomAccessBooleanList.java TestArrayBooleanList.java TestAbstractBooleanCollection.java TestBooleanList.java primitives junit1444170519.properties junit1609176495.properties Log: * add BooleanXxxx tests * add BooleanXxxx adapters * fix BooleanCollection.hashCode Revision ChangesPath 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/ListIteratorBooleanListIterator.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/ListIteratorBooleanListIterator.java?rev=1.1 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/ListBooleanList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/ListBooleanList.java?rev=1.1 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableBooleanListList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableBooleanListList.java?rev=1.1 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableListBooleanList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableListBooleanList.java?rev=1.1 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/BooleanListIteratorListIterator.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/BooleanListIteratorListIterator.java?rev=1.1 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/AbstractBooleanListList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/AbstractBooleanListList.java?rev=1.1 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/BooleanListList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/BooleanListList.java?rev=1.1 1.1 jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/AbstractListBooleanList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters/AbstractListBooleanList.java?rev=1.1 1.11 +4 -1 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/PackageTestSuite.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/PackageTestSuite.java.diff?r1=1.10r2=1.11 1.1 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestRandomAccessBooleanList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestRandomAccessBooleanList.java?rev=1.1 1.1 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestArrayBooleanList.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestArrayBooleanList.java?rev=1.1 1.1 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestAbstractBooleanCollection.java http://cvs.apache.org/viewcvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/TestAbstractBooleanCollection.java?rev=1.1 1.1
cvs commit: jakarta-commons/primitives/xdocs changes.xml
rwaldhoff2004/07/12 11:32:26 Modified:primitives/xdocs changes.xml Log: note addition of boolean adapters Revision ChangesPath 1.3 +7 -3 jakarta-commons/primitives/xdocs/changes.xml Index: changes.xml === RCS file: /home/cvs/jakarta-commons/primitives/xdocs/changes.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- changes.xml 12 Jul 2004 16:30:35 - 1.2 +++ changes.xml 12 Jul 2004 18:32:26 - 1.3 @@ -23,12 +23,16 @@ release version=1.1 date=in CVS +action dev=rwaldhoff type=add + Add BooleanXxx adapters. +/action + action dev=akarasulu type=add - Add XXXStack collections. + Add XxxStack collections. /action action dev=akarasulu type=add - Add BooleanXXX collections. + Add BooleanXxx collections. /action action dev=rwaldhoff type=add @@ -38,7 +42,7 @@ /action action dev=rwaldhoff type=update - Override clear() in ArrayXXXList for better performance. + Override clear() in ArrayXxxList for better performance. /action /release - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/xdocs examples.xml
rwaldhoff2004/06/28 12:36:53 Modified:functor/xdocs examples.xml Log: update links now that src/test xref isn't published Revision ChangesPath 1.8 +13 -13jakarta-commons-sandbox/functor/xdocs/examples.xml Index: examples.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/xdocs/examples.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- examples.xml 28 Feb 2004 17:12:07 - 1.7 +++ examples.xml 28 Jun 2004 19:36:53 - 1.8 @@ -81,34 +81,34 @@ Commons-Functor library. /p dl - dta href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/one/package-summary.html;Kata One: Supermarket Pricing/a/dt + dta href=http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one/;Kata One: Supermarket Pricing/a/dt dd Dave's a href=http://pragprog.com/pragdave/Practices/Kata/KataOne.rdoc,v;Kata One/a asks how one might implement supermarket pricing rules, like three for a dollar or buy two get one free. By encapsulating tiny bits of logic, functors provide a useful solution to this problem, as illustrated in the -a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.html;SupermarketPricingExample/a. +a href=http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java;SupermarketPricingExample/a. /dd - dta href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/two/package-summary.html;Kata Two: Binary Chop/a/dt + dta href=http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/;Kata Two: Binary Chop/a/dt dd a href=http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v;Kata Two/a asks us to create several different implemenations of the binary search algorithm, which once you get past three or four implemenations, is more difficult that it sounds. -a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/two/TestBinaryChop.html;TestBinaryChop/a +a href=http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java;TestBinaryChop/a presents several implementations, with functor and non-functor variations. /dd - dta href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/package-summary.html;Kata Four: Data Munging/a/dt + dta href=http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/;Kata Four: Data Munging/a/dt dd a href=http://pragprog.com/pragdave/Practices/Kata/KataFour.doc,v;Kata Four/a asks us to explore extreme reuse. Our -a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/DataMunger.html;DataMunger/a +a href=http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/DataMunger.java;DataMunger/a allows for very small implementations of the -a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/TestWeather.html;weather/a +a href=http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestWeather.java;weather/a and -a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/TestSoccer.html;soccer (football)/a +a href=http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestSoccer.java;soccer (football)/a parsers. /dd @@ -117,7 +117,7 @@ subsection name=Generators p - The a href=xref-test/org/apache/commons/functor/example/lines/package-summary.htmllines/a + The a href=http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor
cvs commit: jakarta-commons-sandbox/functor LICENSE.txt
rwaldhoff2004/01/05 07:57:38 Modified:functor LICENSE.txt Log: update copyright year, remove $Header$ Revision ChangesPath 1.2 +1 -3 jakarta-commons-sandbox/functor/LICENSE.txt Index: LICENSE.txt === RCS file: /home/cvs/jakarta-commons-sandbox/functor/LICENSE.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LICENSE.txt 27 Jan 2003 19:33:37 - 1.1 +++ LICENSE.txt 5 Jan 2004 15:57:38 - 1.2 @@ -1,9 +1,7 @@ /* - * $Header$ - * * The Apache Software License, Version 1.1 * - * Copyright (c) 2003 The Apache Software Foundation. All rights + * Copyright (c) 2003-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor project.xml
rwaldhoff2004/01/05 08:45:46 Modified:functor project.xml Log: ensure resource files are availble in the classpath Revision ChangesPath 1.6 +6 -0 jakarta-commons-sandbox/functor/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/project.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- project.xml 12 Nov 2003 00:14:23 - 1.5 +++ project.xml 5 Jan 2004 16:45:46 - 1.6 @@ -92,6 +92,12 @@ includes includeorg/apache/commons/functor/TestAll.java/include /includes + resources +resource + directorysrc/test/directory + include**/*.txt/include +/resource + /resources /unitTest /build /project - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util CollectionTransformer.java
rwaldhoff2004/01/05 10:11:36 Modified:functor/src/java/org/apache/commons/functor/generator BaseTransformer.java Transformer.java Generator.java BaseGenerator.java functor/src/test/org/apache/commons/functor/generator TestBaseTransformer.java functor/src/java/org/apache/commons/functor/generator/util CollectionTransformer.java Log: deprecate Transformer, to be replaced by UnaryFunction Revision ChangesPath 1.2 +4 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseTransformer.java Index: BaseTransformer.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseTransformer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BaseTransformer.java 25 Nov 2003 19:55:02 - 1.1 +++ BaseTransformer.java 5 Jan 2004 18:11:36 - 1.2 @@ -3,7 +3,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 2003 The Apache Software Foundation. All rights + * Copyright (c) 2003-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +61,7 @@ * @since 1.0 * @version $Revision$ $Date$ * @author Rodney Waldhoff + * @deprecated To be removed. */ public abstract class BaseTransformer implements Transformer { public abstract Object transform(Generator gen); 1.3 +4 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Transformer.java Index: Transformer.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Transformer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Transformer.java 25 Nov 2003 19:55:02 - 1.2 +++ Transformer.java 5 Jan 2004 18:11:36 - 1.3 @@ -3,7 +3,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 2003 The Apache Software Foundation. All rights + * Copyright (c) 2003-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,6 +66,7 @@ * @since 1.0 * @version $Revision$ $Date$ * @author Jason Horman ([EMAIL PROTECTED]) + * @deprecated Simply use UnaryFunction. */ public interface Transformer extends UnaryFunction { 1.9 +5 -5 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Generator.java2 Dec 2003 01:01:59 - 1.8 +++ Generator.java5 Jan 2004 18:11:36 - 1.9 @@ -3,7 +3,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 2003 The Apache Software Foundation. All rights + * Copyright (c) 2003-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,11 +96,11 @@ /** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#until}. */ public abstract Generator until(UnaryPredicate pred); /** - * [EMAIL PROTECTED] Transformer Transforms} this generator using the passed in + * Transforms this generator using the passed in * transformer. An example transformer might turn the contents of the * generator into a [EMAIL PROTECTED] Collection} of elements. */ -public abstract Object to(Transformer transformer); +public abstract Object to(UnaryFunction transformer); /** Same as to(new CollectionTransformer(collection)). */ public abstract Collection to(Collection collection); /** Same as to(new CollectionTransformer()). */ 1.6 +5 -5 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseGenerator.java Index: BaseGenerator.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseGenerator.java,v retrieving revision 1.5
cvs commit: jakarta-commons-sandbox/functor build.xml
rwaldhoff2003/12/17 12:52:30 Modified:functor build.xml Log: add test.home to test.classpath, so that the resource files can be found Revision ChangesPath 1.12 +2 -1 jakarta-commons-sandbox/functor/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- build.xml 2 Apr 2003 00:07:41 - 1.11 +++ build.xml 17 Dec 2003 20:52:30 - 1.12 @@ -88,6 +88,7 @@ path id=test.classpath pathelement location=${build.home}/classes/ pathelement location=${build.home}/test-classes/ +pathelement location=${test.home}/ pathelement location=${junit.jar}/ /path - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core ConstantPredicate.java ConstantFunction.java LeftIdentityPredicate.java IdentityFunction.java IdentityPredicate.java RightIdentityFunction.java LeftIdentityFunction.java RightIdentityPredicate.java
rwaldhoff2003/12/17 13:02:49 Modified:functor/src/test/org/apache/commons/functor/core TestAll.java Removed: functor/src/test/org/apache/commons/functor/core TestConstantFunction.java TestRightIdentityFunction.java TestLeftIdentityPredicate.java TestLeftIdentityFunction.java TestIdentityFunction.java TestRightIdentityPredicate.java TestIdentityPredicate.java TestConstantPredicate.java functor/src/java/org/apache/commons/functor/core ConstantPredicate.java ConstantFunction.java LeftIdentityPredicate.java IdentityFunction.java IdentityPredicate.java RightIdentityFunction.java LeftIdentityFunction.java RightIdentityPredicate.java Log: remove some deprecated types Revision ChangesPath 1.13 +2 -11 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.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- TestAll.java 2 Dec 2003 17:43:10 - 1.12 +++ TestAll.java 17 Dec 2003 21:02:49 - 1.13 @@ -78,15 +78,6 @@ suite.addTest(TestLeftIdentity.suite()); suite.addTest(TestRightIdentity.suite()); -suite.addTest(TestConstantFunction.suite()); -suite.addTest(TestConstantPredicate.suite()); -suite.addTest(TestIdentityFunction.suite()); -suite.addTest(TestLeftIdentityFunction.suite()); -suite.addTest(TestRightIdentityFunction.suite()); -suite.addTest(TestIdentityPredicate.suite()); -suite.addTest(TestLeftIdentityPredicate.suite()); -suite.addTest(TestRightIdentityPredicate.suite()); - suite.addTest(TestIsInstanceOf.suite()); suite.addTest(TestIsNull.suite()); suite.addTest(TestIsNotNull.suite()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor Algorithms.java
rwaldhoff2003/12/17 13:03:17 Modified:functor/src/java/org/apache/commons/functor Algorithms.java Log: fix javadoc warning Revision ChangesPath 1.17 +3 -5 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java Index: Algorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- Algorithms.java 1 Dec 2003 20:27:20 - 1.16 +++ Algorithms.java 17 Dec 2003 21:03:17 - 1.17 @@ -384,9 +384,7 @@ * Tail recursion for [EMAIL PROTECTED] Function functions}. If the [EMAIL PROTECTED] Function} * returns another function of the same type as the original, that function * is executed. Functions are executed until a non function value or a - * function of a different type is returned. See [EMAIL PROTECTED] - * org.apache.commons.functor.util.BinarySearch} for an example of how might - * be used. + * function of a different type is returned. */ public static final Object recurse(Function function) { Object result = null; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four DataMunger.java
rwaldhoff2003/12/17 14:05:26 Modified:functor/src/test/org/apache/commons/functor/example/kata/four DataMunger.java Log: add a bit of whitespace Revision ChangesPath 1.6 +7 -7 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- DataMunger.java 3 Dec 2003 01:04:12 - 1.5 +++ DataMunger.java 17 Dec 2003 22:05:26 - 1.6 @@ -103,14 +103,14 @@ private static final BinaryFunction lesserSpread(final int col1, final int col2) { return new ConditionalBinaryFunction( IsNull.left(), // if left is null -RightIdentity.instance(), // return right -Conditional.function( // else the parameter with the least spread -Composite.predicate( // if left is less than right +RightIdentity.instance(), // return right +Conditional.function( // else return the parameter with the least spread +Composite.predicate( // if left is less than right IsLessThan.instance(), absSpread(col1,col2), absSpread(col1,col2)), -LeftIdentity.instance(), // return left -RightIdentity.instance() // else return right +LeftIdentity.instance(), // return left +RightIdentity.instance() // else return right ) ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four ToInteger.java TestSoccer.java IsInteger.java Abs.java TestWeather.java NthColumn.java DataMunger.java
rwaldhoff2003/12/17 14:13:52 Modified:functor/src/test/org/apache/commons/functor/example/kata/four ToInteger.java TestSoccer.java IsInteger.java Abs.java TestWeather.java NthColumn.java DataMunger.java Log: add comments Revision ChangesPath 1.2 +8 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/ToInteger.java Index: ToInteger.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/ToInteger.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ToInteger.java2 Dec 2003 16:36:11 - 1.1 +++ ToInteger.java17 Dec 2003 22:13:51 - 1.2 @@ -59,6 +59,12 @@ import org.apache.commons.functor.UnaryFunction; /** + * Converts a String value to an Integer, throwing + * an exception if no such conversion can be made. + * + * Trailing, [EMAIL PROTECTED] Character#isDigit digit} characters + * are ignored. + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ 1.4 +4 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestSoccer.java Index: TestSoccer.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestSoccer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestSoccer.java 3 Dec 2003 01:04:12 - 1.3 +++ TestSoccer.java 17 Dec 2003 22:13:51 - 1.4 @@ -77,6 +77,8 @@ } public void testProcess() { + // for our soccer example, we want to select the second column of the + // line with the minimal difference between the seventh and ninth columns. assertEquals( Aston_Villa, DataMunger.process(getClass().getResourceAsStream(soccer.txt),1,6,8)); 1.2 +5 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/IsInteger.java Index: IsInteger.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/IsInteger.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- IsInteger.java2 Dec 2003 16:36:11 - 1.1 +++ IsInteger.java17 Dec 2003 22:13:51 - 1.2 @@ -59,6 +59,9 @@ import org.apache.commons.functor.UnaryPredicate; /** + * Tests to true iff the input object can be converted to + * an Integer by [EMAIL PROTECTED] ToInteger}. + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ 1.2 +5 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/Abs.java Index: Abs.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/Abs.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Abs.java 2 Dec 2003 16:36:11 - 1.1 +++ Abs.java 17 Dec 2003 22:13:51 - 1.2 @@ -59,6 +59,9 @@ import org.apache.commons.functor.UnaryFunction; /** + * Evaluates to the absolute Integer value of the Number-valued + * input parameter. + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ 1.4 +4 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestWeather.java Index: TestWeather.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestWeather.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestWeather.java 3 Dec 2003 01:04:12 - 1.3 +++ TestWeather.java 17 Dec 2003 22:13:51 - 1.4 @@ -77,6 +77,8 @@ } public void testProcess() { + // for our soccer example, we want to select the first column of the + // line with the minimal difference between the second and third columns. assertEquals( 14, DataMunger.process(getClass().getResourceAsStream(weather.txt),0,1,2)); 1.2 +5 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/NthColumn.java Index: NthColumn.java === RCS file: /home/cvs/jakarta-commons
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four DataMunger.java
rwaldhoff2003/12/17 14:15:11 Modified:functor/src/test/org/apache/commons/functor/example/kata/four DataMunger.java Log: add comments Revision ChangesPath 1.8 +3 -3 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- DataMunger.java 17 Dec 2003 22:13:51 - 1.7 +++ DataMunger.java 17 Dec 2003 22:15:11 - 1.8 @@ -91,7 +91,7 @@ /** * Processes each line of the given Reader, returning the iselected/i column for the * line where the absolute difference between the integer value of icol1/i and icol2/i - * is least. + * is least. Note that lines that don't begin with an Integer are ignored. */ public static final Object process(final Reader file, final int selected, final int col1, final int col2) { return NthColumn.instance(selected).evaluate( - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters Adapt.java
rwaldhoff2003/12/04 14:57:19 Modified:primitives project.xml build.xml primitives/src/test/org/apache/commons/collections/primitives/adapters PackageTestSuite.java Added: primitives/src/test/org/apache/commons/collections/primitives/adapters TestAdapt.java primitives/src/java/org/apache/commons/collections/primitives/adapters Adapt.java Log: * add util method container Adapt, and tests * set version numbers to 1.1-dev (instead of 2.0-dev) Revision ChangesPath 1.11 +1 -1 jakarta-commons/primitives/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/primitives/project.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- project.xml 6 Nov 2003 01:06:58 - 1.10 +++ project.xml 4 Dec 2003 22:57:19 - 1.11 @@ -3,7 +3,7 @@ extend../xdocs/maven/project-base.xml/extend idcommons-primitives/id nameCommons Primitives/name - currentVersion2.0-dev/currentVersion + currentVersion1.1-dev/currentVersion inceptionYear2002/inceptionYear packageorg.apache.commons.collections.primitives/package 1.9 +2 -2 jakarta-commons/primitives/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-commons/primitives/build.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- build.xml 6 Nov 2003 01:06:58 - 1.8 +++ build.xml 4 Dec 2003 22:57:19 - 1.9 @@ -43,7 +43,7 @@ property name=component.title value=Primitive type utilities/ !-- The current version number of this component -- - property name=component.version value=2.0-dev/ + property name=component.version value=1.1-dev/ !-- The final name of the component -- property name=final.name value=commons-${component.name}-${component.version}/ 1.2 +4 -2 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/adapters/PackageTestSuite.java Index: PackageTestSuite.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/adapters/PackageTestSuite.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PackageTestSuite.java 13 Oct 2003 22:46:54 - 1.1 +++ PackageTestSuite.java 4 Dec 2003 22:57:19 - 1.2 @@ -78,6 +78,8 @@ public static Test suite() { TestSuite suite = new TestSuite(); + +suite.addTest(TestAdapt.suite()); suite.addTest(TestCollectionByteCollection.suite()); suite.addTest(TestByteCollectionCollection.suite()); 1.1 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/adapters/TestAdapt.java Index: TestAdapt.java === /* * $Header: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/adapters/TestAdapt.java,v 1.1 2003/12/04 22:57:19 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 acknowledgement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowledgement may appear in the software itself, *if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear
cvs commit: jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/adapters Adapt.java
rwaldhoff2003/12/04 15:19:23 Modified:primitives/src/test/org/apache/commons/collections/primitives/adapters TestAdapt.java primitives/src/java/org/apache/commons/collections/primitives/adapters Adapt.java Log: add Adapt methods and tests Revision ChangesPath 1.2 +139 -2 jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/adapters/TestAdapt.java Index: TestAdapt.java === RCS file: /home/cvs/jakarta-commons/primitives/src/test/org/apache/commons/collections/primitives/adapters/TestAdapt.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestAdapt.java4 Dec 2003 22:57:19 - 1.1 +++ TestAdapt.java4 Dec 2003 23:19:22 - 1.2 @@ -57,6 +57,7 @@ package org.apache.commons.collections.primitives.adapters; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -73,19 +74,33 @@ import org.apache.commons.collections.primitives.ArrayIntList; import org.apache.commons.collections.primitives.ArrayLongList; import org.apache.commons.collections.primitives.ArrayShortList; +import org.apache.commons.collections.primitives.ByteCollection; import org.apache.commons.collections.primitives.ByteIterator; +import org.apache.commons.collections.primitives.ByteList; import org.apache.commons.collections.primitives.ByteListIterator; +import org.apache.commons.collections.primitives.CharCollection; import org.apache.commons.collections.primitives.CharIterator; +import org.apache.commons.collections.primitives.CharList; import org.apache.commons.collections.primitives.CharListIterator; +import org.apache.commons.collections.primitives.DoubleCollection; import org.apache.commons.collections.primitives.DoubleIterator; +import org.apache.commons.collections.primitives.DoubleList; import org.apache.commons.collections.primitives.DoubleListIterator; +import org.apache.commons.collections.primitives.FloatCollection; import org.apache.commons.collections.primitives.FloatIterator; +import org.apache.commons.collections.primitives.FloatList; import org.apache.commons.collections.primitives.FloatListIterator; +import org.apache.commons.collections.primitives.IntCollection; import org.apache.commons.collections.primitives.IntIterator; +import org.apache.commons.collections.primitives.IntList; import org.apache.commons.collections.primitives.IntListIterator; +import org.apache.commons.collections.primitives.LongCollection; import org.apache.commons.collections.primitives.LongIterator; +import org.apache.commons.collections.primitives.LongList; import org.apache.commons.collections.primitives.LongListIterator; +import org.apache.commons.collections.primitives.ShortCollection; import org.apache.commons.collections.primitives.ShortIterator; +import org.apache.commons.collections.primitives.ShortList; import org.apache.commons.collections.primitives.ShortListIterator; /** @@ -112,6 +127,9 @@ assertNotNull(new Adapt()); } +// to object based +//--- + public void testToCollection() { assertNull(Adapt.toCollection((ArrayByteList)null)); assertTrue(Adapt.toCollection(new ArrayByteList()) instanceof Collection); @@ -178,5 +196,124 @@ assertTrue(Adapt.toListIterator(new ArrayLongList().listIterator()) instanceof ListIterator); assertNull(Adapt.toListIterator((ShortListIterator)null)); assertTrue(Adapt.toListIterator(new ArrayShortList().listIterator()) instanceof ListIterator); +} + +// to byte based +//--- + +public void testToByteType() { +assertTrue(Adapt.toByteCollection(new ArrayList()) instanceof ByteCollection); +assertTrue(Adapt.toByteList(new ArrayList()) instanceof ByteList); +assertTrue(Adapt.toByteIterator(new ArrayList().iterator()) instanceof ByteIterator); +assertTrue(Adapt.toByteListIterator(new ArrayList().listIterator()) instanceof ByteListIterator); +} + +public void testToByteTypeFromNull() { +assertNull(Adapt.toByteCollection(null)); +assertNull(Adapt.toByteList(null)); +assertNull(Adapt.toByteIterator(null)); +assertNull(Adapt.toByteListIterator(null)); +} + +// to char based +//--- + +public void testToCharType() { +assertTrue(Adapt.toCharCollection(new ArrayList()) instanceof CharCollection); +assertTrue(Adapt.toCharList(new ArrayList
cvs commit: jakarta-commons/primitives/xdocs navigation.xml
rwaldhoff2003/12/04 15:31:42 Modified:primitives/xdocs navigation.xml Added: primitives STATUS.txt Removed: primitives STATUS.html Log: replace STATUS.html with STATUS.txt, update STATUS.txt, link to it Revision ChangesPath 1.1 jakarta-commons/primitives/STATUS.txt Index: STATUS.txt === Commons Primitives Status $Revision: 1.1 $ $Date: 2003/12/04 23:31:42 $ http://jakarta.apache.org/commons/primitives/ Summary: Commons Primitives is a set of collection and utility classes for primitive types. The Java language has a clear distinction between Object and primitive types. A lot of functionality is provided for Object types, including the Java Collection Framework. Relatively little functionality is provided by the JDK for primitives. This package addresses this by providing a set of utility and collection classes for primitives. Commons Primitives is a component developed by Jakarta Commons, a subproject of the Apache Jakarta project. Releases: Stable: 1.0. CVS Tag: PRIMITIVES_1_0 Binaries: http://jakarta.apache.org/site/binindex.cgi#commons-primitives Source: http://jakarta.apache.org/site/sourceindex.cgi#commons-primitives Development: 1.1-dev CVS Tag: HEAD Binaries: http://cvs.apache.org/builds/jakarta-commons/nightly/commons-primitives/ Source: http://cvs.apache.org/builds/jakarta-commons/nightly/commons-primitives/ Assets: Web site: http://jakarta.apache.org/commons/primitives Mailing lists:[EMAIL PROTECTED] (developers) [EMAIL PROTECTED] (users) Repositories: jakarta-commons/primitives http://cvs.apache.org/viewcvs.cgi/jakarta-commons/primitives/ Also see http://jakarta.apache.org/commons/primitives/cvs-usage.html Committers: Stephen Colebourne (scolebourne AT apache DOT org) [PMC] Matthew Hawthorne (matth AT apache DOT org) Rodney Waldhoff (rwaldhoff AT apache DOT org) [PMC] Contributors: Currently no non-committers. Pending Issues: None. Resolved Issues: None. 1.4 +1 -0 jakarta-commons/primitives/xdocs/navigation.xml Index: navigation.xml === RCS file: /home/cvs/jakarta-commons/primitives/xdocs/navigation.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- navigation.xml17 Nov 2003 21:00:44 - 1.3 +++ navigation.xml4 Dec 2003 23:31:42 - 1.4 @@ -9,6 +9,7 @@ menu name=Commons Primitives item name=Overview href=/index.html/ item name=FAQ href=/faq.html/ + item name=Status#xA0;File href=http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons/primitives/STATUS.txt/ /menu commons-nav; /body - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite TestCompositeUnaryProcedure.java TestCompositeUnaryPredicate.java
rwaldhoff2003/12/03 07:24:46 Modified:functor/src/test/org/apache/commons/functor/core/composite TestCompositeUnaryProcedure.java TestCompositeUnaryPredicate.java Log: add tests Revision ChangesPath 1.3 +8 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java Index: TestCompositeUnaryProcedure.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestCompositeUnaryProcedure.java 3 Dec 2003 01:07:36 - 1.2 +++ TestCompositeUnaryProcedure.java 3 Dec 2003 15:24:46 - 1.3 @@ -114,6 +114,12 @@ // expected } try { +new CompositeUnaryProcedure(null,null); +fail(Expected NullPointerException); +} catch(NullPointerException e) { +// expected +} +try { new CompositeUnaryProcedure(NoOp.instance(),null); fail(Expected NullPointerException); } catch(NullPointerException e) { 1.3 +8 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java Index: TestCompositeUnaryPredicate.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestCompositeUnaryPredicate.java 3 Dec 2003 01:07:36 - 1.2 +++ TestCompositeUnaryPredicate.java 3 Dec 2003 15:24:46 - 1.3 @@ -115,6 +115,12 @@ // expected } try { +new CompositeUnaryPredicate(null,null); +fail(Expected NullPointerException); +} catch(NullPointerException e) { +// expected +} +try { new CompositeUnaryPredicate(Constant.truePredicate(),null); fail(Expected NullPointerException); } catch(NullPointerException e) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor STATUS.txt
rwaldhoff2003/12/03 10:22:11 Modified:functor/xdocs examples.xml download.xml building.xml index.xml functor/xdocs/stylesheets project.xml Added: functor STATUS.txt Log: add STATUS.txt update xdocs Revision ChangesPath 1.6 +53 -2 jakarta-commons-sandbox/functor/xdocs/examples.xml Index: examples.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/xdocs/examples.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- examples.xml 26 Nov 2003 01:28:36 - 1.5 +++ examples.xml 3 Dec 2003 18:22:10 - 1.6 @@ -46,16 +46,67 @@ por/p premaven -Dtestcase=org.apache.commons.functor.example.TestAll test:single/pre p - Each example is written in something like a literate programming style. - In other words, with descriptive prose mixed right in with the source, as + Each example is has descriptive prose mixed right in with the source, as code/* C++ style *//code comments. /p + subsection name=Code Katas +p + Pragmatic Dave Thomas has been + a href=http://pragprog.com/pragdave/;blogging/a + a series of programming exercises he calls + a href=http://pragprog.com/pragdave/Practices/Kata;Code Katas/a. + These exercises are intended to provide practice sesssions that allow + programmers to hone their craft. The notion is borrowed from the + practice of Karate, where, in Dave's words + a kata is an exercise where you repeat a form many, many times, + making little improvements in each. +/p +p + Here we use several of Dave's Code Katas to explore the + Commons-Functor library. +/p +dl + dta href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/one/package-summary.html;Kata One: Supermarket Pricing/a/dt + dd +Dave's a href=http://pragprog.com/pragdave/Practices/Kata/KataOne.rdoc,v;Kata One/a asks how +one might implement supermarket pricing rules, like three for a dollar or buy two get one free. +By encapsulating tiny bits of logic, functors provide a useful solution to this problem, as +illustrated in the +a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.html;SupermarketPricingExample/a. + /dd + + dta href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/two/package-summary.html;Kata Two: Binary Chop/a/dt + dd +a href=http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v;Kata Two/a asks us +to create several different implemenations of the binary search algorithm, which once you +get past three or four implemenations, is more difficult that it sounds. +a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/two/TestBinaryChop.html;TestBinaryChop/a +presents several implementations, with functor and non-functor variations. + /dd + + + dta href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/package-summary.html;Kata Four: Data Munging/a/dt + dd +a href=http://pragprog.com/pragdave/Practices/Kata/KataFour.doc,v;Kata Four/a asks us +to explore extreme reuse. Our +a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/DataMunger.html;DataMunger/a +allows for very small implementations of the +a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/TestWeather.html;weather/a +and +a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/kata/four/TestSoccer.html;soccer (football)/a +parsers. + /dd + +/dl + /subsection + subsection name=Generators p The a href=xref-test/org/apache/commons/functor/example/lines/package-summary.htmllines/a package demonstrates a functional approach to IO using Generators and the Algorithms class. /p /subsection + subsection name=Reuse Through Composition p The Functor package, and more generally, a functional
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite CompositeUnaryProcedure.java CompositeUnaryPredicate.java
rwaldhoff2003/12/02 17:07:36 Modified:functor/src/test/org/apache/commons/functor/core/composite TestCompositeUnaryProcedure.java TestCompositeUnaryPredicate.java functor/src/java/org/apache/commons/functor/core/composite CompositeUnaryProcedure.java CompositeUnaryPredicate.java Log: add tests, remove unused Revision ChangesPath 1.2 +16 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java Index: TestCompositeUnaryProcedure.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestCompositeUnaryProcedure.java 3 Dec 2003 01:04:11 - 1.1 +++ TestCompositeUnaryProcedure.java 3 Dec 2003 01:07:36 - 1.2 @@ -106,6 +106,20 @@ new CompositeUnaryProcedure(new NoOp(),new Identity()).run(null); } +public void testNullNotAllowed() throws Exception { +try { +new CompositeUnaryProcedure(null); +fail(Expected NullPointerException); +} catch(NullPointerException e) { +// expected +} +try { +new CompositeUnaryProcedure(NoOp.instance(),null); +fail(Expected NullPointerException); +} catch(NullPointerException e) { +// expected +} +} public void testOf() throws Exception { new CompositeUnaryProcedure(new NoOp()).of(new Identity()).run(null); } 1.2 +20 -6 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java Index: TestCompositeUnaryPredicate.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestCompositeUnaryPredicate.java 3 Dec 2003 01:04:11 - 1.1 +++ TestCompositeUnaryPredicate.java 3 Dec 2003 01:07:36 - 1.2 @@ -101,13 +101,27 @@ // Tests // -public void testEvaluate() throws Exception { -assertEquals(true,(new CompositeUnaryPredicate(new Constant(true))).test(null)); - +public void testTest() throws Exception { +assertEquals(true,(new CompositeUnaryPredicate(new Constant(true))).test(null)); assertEquals(true,(new CompositeUnaryPredicate(new Constant(true),new Constant(new Integer(3.test(xyzzy)); assertEquals(false,(new CompositeUnaryPredicate(new Constant(false),new Constant(new Integer(4.test(xyzzy)); } - + +public void testNullNotAllowed() throws Exception { +try { +new CompositeUnaryPredicate(null); +fail(Expected NullPointerException); +} catch(NullPointerException e) { +// expected +} +try { +new CompositeUnaryPredicate(Constant.truePredicate(),null); +fail(Expected NullPointerException); +} catch(NullPointerException e) { +// expected +} +} + public void testOf() throws Exception { CompositeUnaryPredicate f = new CompositeUnaryPredicate(new Constant(true)); assertTrue(f.test(null)); 1.2 +2 -10 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java Index: CompositeUnaryProcedure.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CompositeUnaryProcedure.java 3 Dec 2003 01:04:12 - 1.1 +++ CompositeUnaryProcedure.java 3 Dec 2003 01:07:36 - 1.2 @@ -101,14 +101,6 @@ this.function = new CompositeUnaryFunction(f); } -public CompositeUnaryProcedure(UnaryProcedure p, UnaryFunction f, UnaryFunction g) { -if(null == p) { throw new NullPointerException(); } -if(null == f) { throw new NullPointerException(); } -if(null == g) { throw new NullPointerException(); } -this.procedure = p; -this.function = new CompositeUnaryFunction(f).of(g); -} - // modifiers
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util BinarySearch.java
rwaldhoff2003/11/30 23:19:56 Modified:functor/src/test/org/apache/commons/functor/util TestBinarySearch.java functor/src/java/org/apache/commons/functor/util BinarySearch.java Log: fix bug, add test, add todo Revision ChangesPath 1.3 +6 -1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/util/TestBinarySearch.java Index: TestBinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/util/TestBinarySearch.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestBinarySearch.java 24 Jun 2003 15:21:02 - 1.2 +++ TestBinarySearch.java 1 Dec 2003 07:19:56 - 1.3 @@ -66,6 +66,7 @@ /** * @author Jason Horman ([EMAIL PROTECTED]) + * @author Rodney Waldhoff */ public class TestBinarySearch extends TestCase { @@ -101,5 +102,9 @@ position = BinarySearch.execute(list, new Integer(86)); assertEquals(new Integer(86), position); + +position = (Integer)new BinarySearch(new ArrayList(), new Integer(10)).recurse(); +assertEquals(new Integer(-1), position); + } } 1.2 +10 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java Index: BinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BinarySearch.java 24 Jun 2003 15:17:01 - 1.1 +++ BinarySearch.java 1 Dec 2003 07:19:56 - 1.2 @@ -69,6 +69,7 @@ * search. * * @author Jason Horman ([EMAIL PROTECTED]) + * @author Rodney Waldhoff */ public class BinarySearch extends RecursiveFunction { @@ -105,8 +106,15 @@ * when it is found. If the item is not found -1 (as Integer) is returned. */ public Object evaluate() { +// TODO: should be using compareTo instead of equals if (lower == upper) { -return list.get(upper).equals(item) ? new Integer(upper) : new Integer(-1); +if(upper = list.size()) { +return new Integer(-1); +} else if(list.get(upper).equals(item)) { +return new Integer(upper); +} else { +return new Integer(-1); +} } else { int middle = (lower + upper) / 2; if (item.compareTo(list.get(middle)) 0) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util BinarySearch.java
rwaldhoff2003/11/30 23:26:50 Modified:functor/src/test/org/apache/commons/functor/util TestBinarySearch.java functor/src/java/org/apache/commons/functor/util BinarySearch.java Log: return int instead of Integer Revision ChangesPath 1.4 +3 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/util/TestBinarySearch.java Index: TestBinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/util/TestBinarySearch.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestBinarySearch.java 1 Dec 2003 07:19:56 - 1.3 +++ TestBinarySearch.java 1 Dec 2003 07:26:50 - 1.4 @@ -97,11 +97,10 @@ position = (Integer)new BinarySearch(list, new Integer(86)).recurse(); assertEquals(new Integer(86), position); -position = (Integer)new BinarySearch(list, new Integer(-1)).recurse(); +position = (Integer)new BinarySearch(list, new Integer(101)).recurse(); assertEquals(new Integer(-1), position); -position = BinarySearch.execute(list, new Integer(86)); -assertEquals(new Integer(86), position); +assertEquals(86, BinarySearch.execute(list, new Integer(86))); position = (Integer)new BinarySearch(new ArrayList(), new Integer(10)).recurse(); assertEquals(new Integer(-1), position); 1.3 +4 -5 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java Index: BinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BinarySearch.java 1 Dec 2003 07:19:56 - 1.2 +++ BinarySearch.java 1 Dec 2003 07:26:50 - 1.3 @@ -71,9 +71,8 @@ * @author Jason Horman ([EMAIL PROTECTED]) * @author Rodney Waldhoff */ - public class BinarySearch extends RecursiveFunction { - +// TODO: should have explict null strategy /*** * Instance variables ***/ @@ -129,7 +128,7 @@ * Class methods ***/ -public static Integer execute(List list, Comparable item) { -return (Integer)(new BinarySearch(list, item)).recurse(); +public static int execute(List list, Comparable item) { +return ((Number)(new BinarySearch(list, item)).recurse()).intValue(); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two - New directory
rwaldhoff2003/11/30 23:30:11 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata TestAll.java
rwaldhoff2003/11/30 23:30:24 Modified:functor/src/test/org/apache/commons/functor/example/kata TestAll.java Added: functor/src/test/org/apache/commons/functor/example/kata/two FunctoredChop.java BinaryChop.java BaseBinaryChop.java TestBinaryChop.java TestAll.java Log: add kata two examples Revision ChangesPath 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/FunctoredChop.java Index: FunctoredChop.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/FunctoredChop.java,v 1.1 2003/12/01 07:30:24 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 [EMAIL PROTECTED] * * 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.example.kata.two; import java.util.List; import org.apache.commons.functor.BinaryFunction; public class FunctoredChop extends BaseBinaryChop { public FunctoredChop(BinaryFunction function) { this.function = function; } public int find(Object seeking, List list) { return ((Number)function.evaluate(seeking,list)).intValue(); } private BinaryFunction function; } 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/BinaryChop.java Index: BinaryChop.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/BinaryChop.java,v 1.1 2003/12/01 07:30:24 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
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util BinarySearch.java
rwaldhoff2003/11/30 23:32:18 Modified:functor/src/java/org/apache/commons/functor/util BinarySearch.java Log: cleanup Revision ChangesPath 1.4 +15 -17 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java Index: BinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- BinarySearch.java 1 Dec 2003 07:26:50 - 1.3 +++ BinarySearch.java 1 Dec 2003 07:32:18 - 1.4 @@ -73,18 +73,10 @@ */ public class BinarySearch extends RecursiveFunction { // TODO: should have explict null strategy -/*** - * Instance variables - ***/ -private List list = null; -private Comparable item = null; -private int lower = 0; -private int upper = 0; -/*** - * Constructors - ***/ + // constructors + //--- public BinarySearch(List list, Comparable item) { this.list = list; this.item = item; @@ -96,9 +88,8 @@ this.lower = lower; this.upper = upper; } -/*** - * Instance methods - ***/ +// instance methods variables +//--- /** * Either returns the next BinarySearch function or position of the item @@ -124,11 +115,18 @@ } } -/*** - * Class methods - ***/ +// class methods +//--- public static int execute(List list, Comparable item) { return ((Number)(new BinarySearch(list, item)).recurse()).intValue(); } + +// private variables +//--- + +private List list = null; +private Comparable item = null; +private int lower = 0; +private int upper = 0; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util BinarySearch.java
rwaldhoff2003/11/30 23:32:54 Modified:functor/src/java/org/apache/commons/functor/util BinarySearch.java Log: cleanup Revision ChangesPath 1.5 +2 -1 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java Index: BinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- BinarySearch.java 1 Dec 2003 07:32:18 - 1.4 +++ BinarySearch.java 1 Dec 2003 07:32:54 - 1.5 @@ -68,6 +68,7 @@ * the [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#recurse} call to execute the * search. * + * @version $Revision$ $Date$ * @author Jason Horman ([EMAIL PROTECTED]) * @author Rodney Waldhoff */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util BinarySearch.java
rwaldhoff2003/11/30 23:33:48 Modified:functor/src/java/org/apache/commons/functor/util BinarySearch.java Log: resuse constructor Revision ChangesPath 1.6 +7 -6 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java Index: BinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- BinarySearch.java 1 Dec 2003 07:32:54 - 1.5 +++ BinarySearch.java 1 Dec 2003 07:33:47 - 1.6 @@ -80,13 +80,14 @@ //--- public BinarySearch(List list, Comparable item) { -this.list = list; this.item = item; -this.lower = 0; this.upper = list.size(); +this(list,item,0,list.size()); } public BinarySearch(List list, Comparable item, int lower, int upper) { -this.list = list; this.item = item; -this.lower = lower; this.upper = upper; +this.list = list; +this.item = item; +this.lower = lower; +this.upper = upper; } // instance methods variables - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util BinarySearch.java
rwaldhoff2003/11/30 23:43:41 Modified:functor/src/java/org/apache/commons/functor/util BinarySearch.java Log: cleanup Revision ChangesPath 1.7 +13 -9 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java Index: BinarySearch.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/util/BinarySearch.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- BinarySearch.java 1 Dec 2003 07:33:47 - 1.6 +++ BinarySearch.java 1 Dec 2003 07:43:41 - 1.7 @@ -83,7 +83,7 @@ this(list,item,0,list.size()); } -public BinarySearch(List list, Comparable item, int lower, int upper) { +private BinarySearch(List list, Comparable item, int lower, int upper) { this.list = list; this.item = item; this.lower = lower; @@ -98,18 +98,20 @@ * when it is found. If the item is not found -1 (as Integer) is returned. */ public Object evaluate() { -// TODO: should be using compareTo instead of equals -if (lower == upper) { +if (lower = upper) { if(upper = list.size()) { -return new Integer(-1); -} else if(list.get(upper).equals(item)) { +return NEGATIVE_ONE; +} else if(item.compareTo(list.get(upper)) == 0) { return new Integer(upper); } else { -return new Integer(-1); +return NEGATIVE_ONE; } } else { int middle = (lower + upper) / 2; -if (item.compareTo(list.get(middle)) 0) { +int compare = item.compareTo(list.get(middle)); +if(compare == 0) { +return new Integer(middle); +} else if(compare 0) { return new BinarySearch(list, item, middle+1, upper); } else { return new BinarySearch(list, item, lower, middle); @@ -131,4 +133,6 @@ private Comparable item = null; private int lower = 0; private int upper = 0; + +private static final Integer NEGATIVE_ONE = new Integer(-1); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two TestBinaryChop.java
rwaldhoff2003/11/30 23:46:13 Modified:functor/src/test/org/apache/commons/functor/example/kata/two TestBinaryChop.java Log: don't assume compareTo returns -1 or 1 Revision ChangesPath 1.2 +17 -22 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java Index: TestBinaryChop.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestBinaryChop.java 1 Dec 2003 07:30:24 - 1.1 +++ TestBinaryChop.java 1 Dec 2003 07:46:13 - 1.2 @@ -121,16 +121,14 @@ int cur = 0; while(low high) { cur = (high+low)/2; -switch(((Comparable)(list.get(cur))).compareTo(seeking)) { -case 0: // equal -return cur; -case 1: -high = cur; -break; -case -1: -if(low == cur) { cur++; } -low = cur; -break; +int comp = ((Comparable)(list.get(cur))).compareTo(seeking); +if(comp == 0) { +return cur; +} else if(comp 0) { +high = cur; +} else { +if(low == cur) { cur++; } +low = cur; } } return -1; @@ -147,16 +145,13 @@ } else { int pivot = list.size()/2; int offset = 0; -int comp = ((Comparable)(list.get(pivot))).compareTo(seeking); -switch(comp) { -case 0: -return pivot; -case -1: -offset = find(seeking,list.subList(Math.max(pivot,1),list.size())); -break; -case 1: -offset = find(seeking,list.subList(0,pivot)); -break; +int comp = ((Comparable)(list.get(pivot))).compareTo(seeking); +if(comp == 0) { +return pivot; +} else if(comp 0) { +offset = find(seeking,list.subList(Math.max(pivot,1),list.size())); +} else { +offset = find(seeking,list.subList(0,pivot)); } return -1 == offset ? -1 : (comp == 1) ? offset : pivot+offset; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two TestBinaryChop.java
rwaldhoff2003/12/01 00:27:54 Modified:functor/src/test/org/apache/commons/functor/example/kata/two TestBinaryChop.java Log: more examples, more tests Revision ChangesPath 1.3 +72 -6 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java Index: TestBinaryChop.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestBinaryChop.java 1 Dec 2003 07:46:13 - 1.2 +++ TestBinaryChop.java 1 Dec 2003 08:27:54 - 1.3 @@ -62,6 +62,9 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.functor.Algorithms; +import org.apache.commons.functor.Function; +import org.apache.commons.functor.generator.util.IntegerRange; import org.apache.commons.functor.util.BinarySearch; /** @@ -110,6 +113,13 @@ assertEquals(-1, chopper.find(4, new int[] { 1, 3, 5, 7 })); assertEquals(-1, chopper.find(6, new int[] { 1, 3, 5, 7 })); assertEquals(-1, chopper.find(8, new int[] { 1, 3, 5, 7 })); + +List largeList = (List)(new IntegerRange(0,11).toCollection()); +assertEquals(-1, chopper.find(new Integer(-5),largeList)); +assertEquals(10, chopper.find(new Integer(10),largeList)); +assertEquals(0, chopper.find(new Integer(0),largeList)); +assertEquals(5, chopper.find(new Integer(5),largeList)); + } public void testIterative() { @@ -124,11 +134,11 @@ int comp = ((Comparable)(list.get(cur))).compareTo(seeking); if(comp == 0) { return cur; -} else if(comp 0) { -high = cur; -} else { +} else if(comp 0) { if(low == cur) { cur++; } low = cur; +} else { +high = cur; } } return -1; @@ -158,8 +168,64 @@ } }); } + +public void testRecursive2() { +chopTest( +new BaseBinaryChop() { +public int find(Object seeking, List list) { +return find(seeking,list,0,list.size()); +} + +private int find(Object seeking, List list, int low, int high) { +if(low = high) { +return -1; +} else { +int cur = (high+low)/2; +int comp = ((Comparable)(list.get(cur))).compareTo(seeking); +if(comp == 0) { +return cur; +} else if(comp 0) { +if(low == cur) { cur++; } +return find(seeking,list,cur,high); +} else { +return find(seeking,list,low,cur); +} +} +} +}); +} +public void testExplicitTailRecursive() { +chopTest( +new BaseBinaryChop() { +public int find(final Object seeking, final List list) { +return ((Number)Algorithms.recurse( +new Function() { +public Object evaluate() { +if(low high) { +int mid = (high+low)/2; +int comp = ((Comparable)(list.get(mid))).compareTo(seeking); +if(comp == 0) { +return new Integer(mid); +} else if(comp 0) { +if(mid == low) { mid++; } +low = mid; +return this; +} else { +high = mid; +return this; +} +} else { +return new Integer(-1
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAll.java
rwaldhoff2003/12/01 08:40:11 Modified:functor/src/test/org/apache/commons/functor/example/kata/two TestBinaryChop.java functor/src/test/org/apache/commons/functor TestAll.java Removed: functor/src/java/org/apache/commons/functor/util BinarySearch.java functor/src/test/org/apache/commons/functor/util TestBinarySearch.java TestAll.java Log: removing BinarySearch because: * the functionality is readily available in Collections.binarySearch and Arrays.binarySearch * as a O(log2(N)) algorithm, it's not a strong candidate for a tail recusive implemenation anyway * the current implemenation trades a small stack size for a small number of newly allocated Objects, so it's not clear that there is a space savings anyway * since I fixed an obtrusive bug yesterday, I assume it's not really being used * as evidenced by being the only class in the util package, it seems out of place for the functor library Revision ChangesPath 1.4 +4 -15 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java Index: TestBinaryChop.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestBinaryChop.java 1 Dec 2003 08:27:54 - 1.3 +++ TestBinaryChop.java 1 Dec 2003 16:40:11 - 1.4 @@ -65,7 +65,6 @@ import org.apache.commons.functor.Algorithms; import org.apache.commons.functor.Function; import org.apache.commons.functor.generator.util.IntegerRange; -import org.apache.commons.functor.util.BinarySearch; /** * See http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v @@ -194,7 +193,7 @@ } }); } -public void testExplicitTailRecursive() { +public void testTailRecursive() { chopTest( new BaseBinaryChop() { public int find(final Object seeking, final List list) { @@ -223,15 +222,5 @@ })).intValue(); } }); -} - -public void testImplicitTailRecursive() { -chopTest( -new BaseBinaryChop() { -public int find(Object seeking, List list) { -return BinarySearch.execute(list,(Comparable)seeking); -} -}); -} - +} } 1.6 +2 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAll.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestAll.java 30 Jun 2003 22:40:08 - 1.5 +++ TestAll.java 1 Dec 2003 16:40:11 - 1.6 @@ -78,7 +78,6 @@ // sub-packages suite.addTest(org.apache.commons.functor.adapter.TestAll.suite()); suite.addTest(org.apache.commons.functor.core.TestAll.suite()); -suite.addTest(org.apache.commons.functor.util.TestAll.suite()); suite.addTest(org.apache.commons.functor.generator.TestAll.suite()); suite.addTest(org.apache.commons.functor.example.TestAll.suite()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor RecursiveFunction.java
rwaldhoff2003/12/01 08:43:12 Removed: functor/src/java/org/apache/commons/functor RecursiveFunction.java Log: removing abstract base class RecursiveFunction, it's not used here, it only adds a convience method for Algorithms.recurse, and adds conceptual weight to the core functor package - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two FunctoredChop.java
rwaldhoff2003/12/01 08:44:22 Removed: functor/src/test/org/apache/commons/functor/example/kata/two FunctoredChop.java Log: remove unused FunctoredChop - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two EiffelStyleLoop.java TestBinaryChop.java
rwaldhoff2003/12/01 13:14:47 Modified:functor/src/test/org/apache/commons/functor/example/kata/two TestBinaryChop.java Added: functor/src/test/org/apache/commons/functor/example/kata/two EiffelStyleLoop.java Log: more kata two examples Revision ChangesPath 1.7 +94 -11 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java Index: TestBinaryChop.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/two/TestBinaryChop.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestBinaryChop.java 1 Dec 2003 20:27:20 - 1.6 +++ TestBinaryChop.java 1 Dec 2003 21:14:46 - 1.7 @@ -240,7 +240,7 @@ * assert(INV.test()); * is valid, then so is: * assert(INV.test()); - * do { BODY.run(); } while(! TERM.test() ); + * while(! TERM.test() ) { BODY.run(); } * assert(INV.test()); * assert(TERM.test()); * @@ -316,7 +316,7 @@ * Now we can use the Algorithms.dountil method to * execute that loop: */ -public void testIterative2() { +public void testIterativeWithInvariants() { chopTest(new BaseBinaryChop() { public int find(final Object seeking, final List list) { @@ -331,13 +331,11 @@ /** Our loop body. */ public void run() { -{ -int mid = (high + low) / 2; -if(greaterThan(list,mid,seeking)) { -high = mid; -} else { -low = mid; -} +int mid = (high + low) / 2; +if(greaterThan(list,mid,seeking)) { +high = mid; +} else { +low = mid; } } @@ -359,6 +357,91 @@ }); } +/* + * Jim Weirich notes how Eiffel is very explict about loop invariants: + * + * from + * low := list.lower + * high := list.upper + 1 + * invariant + * lower_limit: -- low = result (this is just a comment) + * upper_limit: -- high result (this is just a comment) + * variant + * high - low + * until + * (high - low) = 1 + * loop + * mid := (high + low) // 2 + * if list.at(mid) seeking then + * high := mid + * else + * low := mid + * end + * end + * + * We can do that too, see EiffelStyleLoop. + */ +class BinarySearchLoop extends EiffelStyleLoop { +BinarySearchLoop(Object aSeeking, List aList) { +seeking = aSeeking; +list = aList; + +from(new Procedure() { +public void run() { +low = 0; +high = list.size(); +} +}); + +invariant(new Predicate() { +public boolean test() { +return high == 0 || low high; +} +}); + +variant(new Function() { +public Object evaluate() { +return new Integer(high - low); +} +}); + +until(new Predicate() { +public boolean test() { +return high - low = 1; +} +}); + +loop(new Procedure() { +public void run() { +int mid = (high + low) / 2; +if(BaseBinaryChop.greaterThan(list,mid,seeking)) { +high = mid; +} else { +low = mid; +} +} +}); +} + +int getResult() { +return list.isEmpty() ? -1 : BaseBinaryChop.equals(list,low,seeking) ? low : -1; +} + +private int high; +private int low; +private final Object seeking; +private final List list; +} + +public void testIterativeWithInvariantsAndAssertions() { +chopTest(new BaseBinaryChop() { +public int find(Object seeking, List list) { +BinarySearchLoop loop = new BinarySearchLoop(seeking,list
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
rwaldhoff2003/12/01 13:51:47 Modified:functor/src/test/org/apache/commons/functor/core/comparator TestIsGreaterThan.java TestIsEquivalent.java TestIsNotEquivalent.java TestIsLessThanOrEqual.java TestIsLessThan.java TestIsGreaterThanOrEqual.java functor/src/test/org/apache/commons/functor/example/kata/two TestBinaryChop.java functor/src/test/org/apache/commons/functor TestAlgorithms.java Log: add tests Revision ChangesPath 1.5 +7 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java Index: TestIsGreaterThan.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestIsGreaterThan.java24 Nov 2003 20:12:16 - 1.4 +++ TestIsGreaterThan.java1 Dec 2003 21:51:47 - 1.5 @@ -108,6 +108,11 @@ assertTrue(p.test(new Integer(6),new Integer(4))); } +public void testInstance() { +assertTrue(IsGreaterThan.instance(new Integer(7)).test(new Integer(8))); +assertTrue(! IsGreaterThan.instance(new Integer(7)).test(new Integer(6))); +} + public void testEquals() throws Exception { IsGreaterThan p = new IsGreaterThan(); assertEquals(p,p); 1.5 +7 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsEquivalent.java Index: TestIsEquivalent.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsEquivalent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestIsEquivalent.java 24 Nov 2003 20:12:16 - 1.4 +++ TestIsEquivalent.java 1 Dec 2003 21:51:47 - 1.5 @@ -108,6 +108,11 @@ assertTrue(!p.test(new Integer(6),new Integer(4))); } +public void testInstance() { +assertTrue(IsEquivalent.instance(Xyzzy).test(Xyzzy)); +assertTrue(!IsEquivalent.instance(Xyzzy).test(z)); +} + public void testEquals() throws Exception { IsEquivalent p = new IsEquivalent(); assertEquals(p,p); 1.5 +7 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java Index: TestIsNotEquivalent.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestIsNotEquivalent.java 1 Dec 2003 05:16:24 - 1.4 +++ TestIsNotEquivalent.java 1 Dec 2003 21:51:47 - 1.5 @@ -108,6 +108,11 @@ assertTrue(p.test(new Integer(6),new Integer(4))); } +public void testInstance() { +assertTrue(! IsNotEquivalent.instance(new Integer(7)).test(new Integer(7))); +assertTrue(IsNotEquivalent.instance(new Integer(7)).test(new Integer(8))); +} + public void testEquals() throws Exception { IsNotEquivalent p = new IsNotEquivalent(); assertEquals(p,p); 1.5 +7 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java Index: TestIsLessThanOrEqual.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestIsLessThanOrEqual.java1 Dec 2003 05:16:24 - 1.4 +++ TestIsLessThanOrEqual.java1 Dec 2003 21:51:47 - 1.5 @@ -108,6 +108,11 @@ assertTrue(!p.test(new Integer(6),new Integer(4))); } +public void testInstance() { +assertTrue(! IsLessThanOrEqual.instance(new Integer(7)).test(new Integer(8))); +assertTrue(IsLessThanOrEqual.instance(new Integer(7)).test(new Integer(6))); +} + public void testEquals() throws Exception { IsLessThanOrEqual p = new IsLessThanOrEqual(); assertEquals(p,p); 1.5 +7 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsLessThan.java Index: TestIsLessThan.java
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one SupermarketPricingExample.java
rwaldhoff2003/12/01 14:01:15 Modified:functor/src/test/org/apache/commons/functor/example/kata/one SupermarketPricingExample.java Log: add comments Revision ChangesPath 1.2 +18 -2 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.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SupermarketPricingExample.java1 Dec 2003 05:29:08 - 1.1 +++ SupermarketPricingExample.java1 Dec 2003 22:01:15 - 1.2 @@ -69,6 +69,22 @@ import org.apache.commons.functor.core.composite.ConditionalUnaryFunction; /** + * Dave Thomas's Kata One asks us to think about how one might + * implement pricing rules: + * + * Some things in supermarkets have simple prices: this can of + * beans costs $0.65. Other things have more complex prices. + * For example: + * + * o three for a dollar (so what?s the price if I buy 4, or 5?) + * + * o $1.99/pound (so what does 4 ounces cost?) + * + * o buy two, get one free (so does the third item have a price?) + * + * Functors provide one approach to this sort of problem, and in + * this example we'll demonstrate some simple cases. + * * See http://pragprog.com/pragdave/Practices/Kata/KataOne.rdoc,v * for more information on this Kata. * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four - New directory
rwaldhoff2003/12/01 17:01:57 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata TestAll.java
rwaldhoff2003/12/01 17:01:59 Modified:functor/src/java/org/apache/commons/functor/generator Generator.java BaseGenerator.java functor/src/test/org/apache/commons/functor/example/kata TestAll.java Added: functor/src/test/org/apache/commons/functor/example/kata/four weather.txt TestSoccer.java Weather.java soccer.txt TestAll.java BaseDataMunger.java TestWeather.java Soccer.java Log: kata four examples Revision ChangesPath 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/weather.txt Index: weather.txt === Daily Climate Data (Morristown, NJ) (Unofficial, Preliminary Data). Source: http://www.erh.noaa.gov/er/box/dailystns.html MMU June 2002 Dy MxT MnT AvT HDDay AvDP 1HrP TPcpn WxType PDir AvSp Dir MxS SkyC MxR MnR AvSLP 1 885974 53.8 0.00 F 280 9.6 270 17 1.6 93 23 1004.5 2 796371 46.5 0.00 330 8.7 340 23 3.3 70 28 1004.5 3 775566 39.6 0.00 350 5.0 350 9 2.8 59 24 1016.8 4 775968 51.1 0.00 110 9.1 130 12 8.6 62 40 1021.1 5 906678 68.3 0.00 TFH 220 8.3 260 12 6.9 84 55 1014.4 6 816171 63.7 0.00 RFH 030 6.2 030 13 9.7 93 60 1012.7 7 735765 53.0 0.00 RF 050 9.5 050 17 5.3 90 48 1021.8 8 755465 50.0 0.00 FH 160 4.2 150 10 2.6 93 41 1026.3 9 8632* 59 6 61.5 0.00 240 7.6 220 12 6.0 78 46 1018.6 10 846474 57.5 0.00 F 210 6.6 050 9 3.4 84 40 1019.0 11 915975 66.3 0.00 H 250 7.1 230 12 2.5 93 45 1012.6 12 887381 68.7 0.00 RTH 250 8.1 270 21 7.9 94 51 1007.0 13 705965 55.0 0.00 H 150 3.0 150 8 10.0 83 59 1012.6 14 615960 5 55.9 0.00 RF 060 6.7 080 9 10.0 93 87 1008.6 15 645560 5 54.9 0.00 F 040 4.3 200 7 9.6 96 70 1006.1 16 795969 56.7 0.00 F 250 7.6 240 21 7.8 87 44 1007.0 17 815769 51.7 0.00 T 260 9.1 270 29* 5.2 90 34 1012.5 18 825267 52.6 0.00 230 4.0 190 12 5.0 93 34 1021.3 19 816171 58.9 0.00 H 250 5.2 230 12 5.3 87 44 1028.5 20 845771 58.9 0.00 FH 150 6.3 160 13 3.6 90 43 1032.5 21 865973 57.7 0.00 F 240 6.1 250 12 1.0 87 35 1030.7 22 906477 61.1 0.00 H 250 6.4 230 9 0.2 78 38 1026.4 23 906879 63.1 0.00 H 240 8.3 230 12 0.2 68 42 1021.3 24 907784 67.5 0.00 H 350 8.5 010 14 6.9 74 48 1018.2 25 907281 61.3 0.00 190 4.9 230 9 5.6 81 29 1019.6 26 97* 6481 70.4 0.00 H 050 5.1 200 12 4.0 107 45 1014.9 27 917282 69.7 0.00 RTH 250 12.1 230 17 7.1 90 47 1009.0 28 846876 65.6 0.00 RTFH280 7.6 340 16 7.0 100 51 1011.0 29 886677 59.7 0.00 040 5.4 020 9 5.3 84 33 1020.6 30 904568 63.6 0.00 H 240 6.0 220 17 4.8 200 41 1022.7 mo 82.9 60.5 71.716 58.8 0.00 6.9 5.3 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestSoccer.java Index: TestSoccer.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestSoccer.java,v 1.1 2003/12/02 01:01:59 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
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four BaseDataMunger.java
rwaldhoff2003/12/01 17:03:23 Modified:functor/src/test/org/apache/commons/functor/example/kata/four BaseDataMunger.java Log: simplify slightly Revision ChangesPath 1.2 +3 -7 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/BaseDataMunger.java Index: BaseDataMunger.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/BaseDataMunger.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BaseDataMunger.java 2 Dec 2003 01:01:59 - 1.1 +++ BaseDataMunger.java 2 Dec 2003 01:03:23 - 1.2 @@ -80,11 +80,7 @@ Algorithms.inject( Lines.from(resource(obj)).where(nthColumnIsInteger(0)), null, -new BinaryFunction() { -public Object evaluate(Object left, Object right) { -return lesserSpread(col1,col2).evaluate(left,right); -} -})); +lesserSpread(col1,col2))); } }; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four DataMunger.java TestSoccer.java TestWeather.java Weather.java BaseDataMunger.java Soccer.java
rwaldhoff2003/12/01 17:12:07 Modified:functor/src/test/org/apache/commons/functor/example/kata/four TestSoccer.java TestWeather.java Added: functor/src/test/org/apache/commons/functor/example/kata/four DataMunger.java Removed: functor/src/test/org/apache/commons/functor/example/kata/four Weather.java BaseDataMunger.java Soccer.java Log: simplify Revision ChangesPath 1.2 +5 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestSoccer.java Index: TestSoccer.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestSoccer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestSoccer.java 2 Dec 2003 01:01:59 - 1.1 +++ TestSoccer.java 2 Dec 2003 01:12:07 - 1.2 @@ -77,7 +77,9 @@ } public void test() throws Exception { -assertEquals(Aston_Villa,new Soccer().evaluate(soccer.txt)); +assertEquals( +Aston_Villa, + DataMunger.process(getClass().getResourceAsStream(soccer.txt),1,6,8)); } } 1.2 +5 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestWeather.java Index: TestWeather.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/TestWeather.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestWeather.java 2 Dec 2003 01:01:59 - 1.1 +++ TestWeather.java 2 Dec 2003 01:12:07 - 1.2 @@ -77,7 +77,9 @@ } public void test() throws Exception { -assertEquals(14,new Weather().evaluate(weather.txt)); +assertEquals( +14, + DataMunger.process(getClass().getResourceAsStream(weather.txt),0,1,2)); } } 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/DataMunger.java Index: DataMunger.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/four/DataMunger.java,v 1.1 2003/12/02 01:12:07 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 [EMAIL PROTECTED] * * 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
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example QuicksortExample.java
rwaldhoff2003/11/30 21:16:24 Modified:functor/src/test/org/apache/commons/functor/core/comparator TestIsNotEquivalent.java TestIsLessThan.java TestIsLessThanOrEqual.java functor/src/java/org/apache/commons/functor/core/comparator IsGreaterThan.java IsNotEquivalent.java IsLessThan.java IsEquivalent.java IsLessThanOrEqual.java IsGreaterThanOrEqual.java functor/src/test/org/apache/commons/functor/example QuicksortExample.java Log: * rename singleton accessor methods to instance() * add instance(Comparable) method Revision ChangesPath 1.4 +4 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java Index: TestIsNotEquivalent.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestIsNotEquivalent.java 4 Mar 2003 23:05:25 - 1.3 +++ TestIsNotEquivalent.java 1 Dec 2003 05:16:24 - 1.4 @@ -115,8 +115,8 @@ assertObjectsAreEqual(p,new IsNotEquivalent()); assertObjectsAreEqual(p,new IsNotEquivalent(null)); assertObjectsAreEqual(p,new IsNotEquivalent(new ComparableComparator())); -assertObjectsAreEqual(p,IsNotEquivalent.getIsNotEquivalent()); - assertSame(IsNotEquivalent.getIsNotEquivalent(),IsNotEquivalent.getIsNotEquivalent()); +assertObjectsAreEqual(p,IsNotEquivalent.instance()); +assertSame(IsNotEquivalent.instance(),IsNotEquivalent.instance()); assertObjectsAreNotEqual(p,new ConstantPredicate(false)); } 1.4 +4 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsLessThan.java Index: TestIsLessThan.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsLessThan.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestIsLessThan.java 4 Mar 2003 23:11:13 - 1.3 +++ TestIsLessThan.java 1 Dec 2003 05:16:24 - 1.4 @@ -115,8 +115,8 @@ assertObjectsAreEqual(p,new IsLessThan()); assertObjectsAreEqual(p,new IsLessThan(null)); assertObjectsAreEqual(p,new IsLessThan(new ComparableComparator())); -assertObjectsAreEqual(p,IsLessThan.getIsLessThan()); -assertSame(IsLessThan.getIsLessThan(),IsLessThan.getIsLessThan()); +assertObjectsAreEqual(p,IsLessThan.instance()); +assertSame(IsLessThan.instance(),IsLessThan.instance()); assertObjectsAreNotEqual(p,new ConstantPredicate(false)); } 1.4 +4 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java Index: TestIsLessThanOrEqual.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestIsLessThanOrEqual.java4 Mar 2003 23:11:13 - 1.3 +++ TestIsLessThanOrEqual.java1 Dec 2003 05:16:24 - 1.4 @@ -115,8 +115,8 @@ assertObjectsAreEqual(p,new IsLessThanOrEqual()); assertObjectsAreEqual(p,new IsLessThanOrEqual(null)); assertObjectsAreEqual(p,new IsLessThanOrEqual(new ComparableComparator())); -assertObjectsAreEqual(p,IsLessThanOrEqual.getIsLessThanOrEqual()); - assertSame(IsLessThanOrEqual.getIsLessThanOrEqual(),IsLessThanOrEqual.getIsLessThanOrEqual()); +assertObjectsAreEqual(p,IsLessThanOrEqual.instance()); +assertSame(IsLessThanOrEqual.instance(),IsLessThanOrEqual.instance()); assertObjectsAreNotEqual(p,new ConstantPredicate(false)); } 1.5 +8 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java Index: IsGreaterThan.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IsGreaterThan.java24 Nov 2003 20:12:17 - 1.4 +++ IsGreaterThan.java1 Dec 2003 05:16:24 - 1.5 @@ -60,6 +60,8 @@ import java.util.Comparator
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata - New directory
rwaldhoff2003/11/30 21:28:42 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one - New directory
rwaldhoff2003/11/30 21:28:42 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one TestAll.java
rwaldhoff2003/11/30 21:32:43 Modified:functor/src/test/org/apache/commons/functor/example/kata/one TestAll.java Log: enable tests Revision ChangesPath 1.2 +3 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/kata/one/TestAll.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestAll.java 1 Dec 2003 05:29:08 - 1.1 +++ TestAll.java 1 Dec 2003 05:32:43 - 1.2 @@ -74,9 +74,7 @@ public static Test suite() { TestSuite suite = new TestSuite(); - - //suite.addTest(org.apache.commons.functor.example.kata.one.TestAll.suite()); - +suite.addTest(SupermarketPricingExample.suite()); return suite; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
rwaldhoff2003/11/25 09:49:35 Modified:functor/src/java/org/apache/commons/functor/generator/util MaxIterations.java functor/src/java/org/apache/commons/functor Algorithms.java functor/src/test/org/apache/commons/functor/generator TestGenerator.java functor/src/test/org/apache/commons/functor/generator/util TestEachElement.java functor/src/test/org/apache/commons/functor TestAlgorithms.java Log: using Offset instead of MaxIterations Revision ChangesPath 1.3 +2 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java Index: MaxIterations.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MaxIterations.java25 Nov 2003 00:23:14 - 1.2 +++ MaxIterations.java25 Nov 2003 17:49:35 - 1.3 @@ -73,7 +73,6 @@ * @version $Revision$ $Date$ * @author Jason Horman ([EMAIL PROTECTED]) */ - public class MaxIterations implements UnaryPredicate { /*** 1.7 +4 -5 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java Index: Algorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Algorithms.java 12 Nov 2003 00:50:44 - 1.6 +++ Algorithms.java 25 Nov 2003 17:49:35 - 1.7 @@ -81,9 +81,8 @@ * * @since 1.0 * @version $Revision$ $Date$ - * @author Jason Horman ([EMAIL PROTECTED]) + * @author Jason Horman ([EMAIL PROTECTED]) */ - public class Algorithms { /** @@ -320,7 +319,7 @@ * true. This is useful for imposing [EMAIL PROTECTED] Generator} limits. For example: * * pre - * EachLine.open(file).until(new MaxIterations(1)); + * EachLine.open(file).until(new Offset(1)); * /pre * * Would only generate 1 line from the file before [EMAIL PROTECTED] Generator#stop 1.6 +19 -9 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java Index: TestGenerator.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestGenerator.java24 Nov 2003 20:12:17 - 1.5 +++ TestGenerator.java25 Nov 2003 17:49:35 - 1.6 @@ -57,18 +57,28 @@ package org.apache.commons.functor.generator; -import junit.framework.TestCase; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Set; + import junit.framework.Test; +import junit.framework.TestCase; import junit.framework.TestSuite; -import org.apache.commons.functor.*; -import org.apache.commons.functor.core.IsEqual; -import org.apache.commons.functor.core.IdentityFunction; + +import org.apache.commons.functor.BinaryFunction; +import org.apache.commons.functor.UnaryPredicate; +import org.apache.commons.functor.UnaryProcedure; import org.apache.commons.functor.adapter.LeftBoundPredicate; +import org.apache.commons.functor.core.IdentityFunction; +import org.apache.commons.functor.core.IsEqual; +import org.apache.commons.functor.core.Offset; import org.apache.commons.functor.generator.util.CollectionTransformer; import org.apache.commons.functor.generator.util.EachElement; -import org.apache.commons.functor.generator.util.MaxIterations; - -import java.util.*; /** * Tests the Base Generator class. @@ -289,7 +299,7 @@ } public void testLimit() { -Collection col = simpleGenerator.until(new MaxIterations(2)).toCollection(); +Collection col = simpleGenerator.until(new Offset(2)).toCollection(); assertEquals([0, 1], col.toString()); } 1.3 +3 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestEachElement.java Index: TestEachElement.java === RCS file: /home/cvs/jakarta-commons-sandbox
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor BaseFunctorTest.java
rwaldhoff2003/11/25 10:22:50 Modified:functor/src/java/org/apache/commons/functor Algorithms.java functor/src/test/org/apache/commons/functor/generator TestAll.java functor/src/java/org/apache/commons/functor/generator IteratorToGeneratorAdapter.java functor/src/test/org/apache/commons/functor BaseFunctorTest.java Added: functor/src/test/org/apache/commons/functor/generator TestIteratorToGeneratorAdapter.java Log: * add functionality and tests to IteratorToGeneratorAdapater * add javadocs to Algorithms Revision ChangesPath 1.8 +11 -11 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java Index: Algorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Algorithms.java 25 Nov 2003 17:49:35 - 1.7 +++ Algorithms.java 25 Nov 2003 18:22:50 - 1.8 @@ -86,7 +86,7 @@ public class Algorithms { /** - * apply(new IteratorToGeneratorAdapater(iter),func); + * Equivalent to code[EMAIL PROTECTED] #apply(Generator,UnaryFunction) apply}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),func)/code. */ public static final Generator apply(Iterator iter, UnaryFunction func) { return apply(new IteratorToGeneratorAdapter(iter),func); @@ -109,7 +109,7 @@ } /** - * contains(new IteratorToGeneratorAdapater(iter),pred); + * Equivalent to code[EMAIL PROTECTED] #contains(Generator,UnaryPredicate) contains}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)/code. */ public static final boolean contains(Iterator iter, UnaryPredicate pred) { return contains(new IteratorToGeneratorAdapter(iter),pred); @@ -139,14 +139,14 @@ } /** - * detect(new IteratorToGeneratorAdapater(iter), pred); + * Equivalent to code[EMAIL PROTECTED] #detect(Generator,UnaryPredicate) detect}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)/code. */ public static final Object detect(Iterator iter, UnaryPredicate pred) { return detect(new IteratorToGeneratorAdapter(iter), pred); } /** - * detect(new IteratorToGeneratorAdapater(iter), pred, ifNone); + * Equivalent to code[EMAIL PROTECTED] #detect(Generator,UnaryPredicate,Object) detect}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred,ifNone)/code. */ public static final Object detect(Iterator iter, UnaryPredicate pred, Object ifNone) { return detect(new IteratorToGeneratorAdapter(iter), pred, ifNone); @@ -206,7 +206,7 @@ } /** - * foreach(new IteratorToGeneratorAdapater(iter), proc); + * Equivalent to code[EMAIL PROTECTED] #foreach(Generator,UnaryProcedure) foreach}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),proc)/code. */ public static final void foreach(Iterator iter, UnaryProcedure proc) { foreach(new IteratorToGeneratorAdapter(iter), proc); @@ -221,7 +221,7 @@ } /** - * inject(new IteratorToGeneratorAdapater(iter), seed, func); + * Equivalent to code[EMAIL PROTECTED] #inject(Generator,Object,BinaryFunction) inject}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),seed,func)/code. */ public static final Object inject(Iterator iter, Object seed, BinaryFunction func) { return inject(new IteratorToGeneratorAdapter(iter), seed, func); @@ -258,7 +258,7 @@ /** - * reject(new IteratorToGeneratorAdapater(iter), pred); + * Equivalent to code[EMAIL PROTECTED] #reject(Generator,UnaryPredicate) reject}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)/code. */ public static Generator reject(Iterator iter, UnaryPredicate pred) { return reject(new IteratorToGeneratorAdapter(iter), pred); @@ -283,7 +283,7 @@ } /** - * select(new IteratorToGeneratorAdapater(iter), pred); + * Equivalent to code[EMAIL PROTECTED] #select(Generator,UnaryPredicate) select}(new [EMAIL PROTECTED
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util MaxIterations.java
rwaldhoff2003/11/25 10:23:56 Removed: functor/src/java/org/apache/commons/functor/generator/util MaxIterations.java Log: remove deprecated and now unused MaxIterations - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
rwaldhoff2003/11/25 10:34:14 Modified:functor/src/java/org/apache/commons/functor Algorithms.java functor/src/test/org/apache/commons/functor TestAlgorithms.java Log: when given an iterator, return an iterator Revision ChangesPath 1.9 +24 -18 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java Index: Algorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Algorithms.java 25 Nov 2003 18:22:50 - 1.8 +++ Algorithms.java 25 Nov 2003 18:34:13 - 1.9 @@ -67,9 +67,9 @@ /** * Utility methods and algorithms for applying functors to [EMAIL PROTECTED] Generator}s. * [EMAIL PROTECTED] Generator}s also define these utility methods as instance methods. The - * [EMAIL PROTECTED] #apply}, [EMAIL PROTECTED] #select}, and [EMAIL PROTECTED] #reject} methods return new - * Generators. This becomes useful for constructing nested expressions. For - * example: + * [EMAIL PROTECTED] #apply apply}, [EMAIL PROTECTED] #select select}, and [EMAIL PROTECTED] #reject reject} methods + * return new Generators. This becomes useful for constructing nested expressions. + * For example: * * pre * Algorithms.apply(new EachElement(list), func1) @@ -82,14 +82,16 @@ * @since 1.0 * @version $Revision$ $Date$ * @author Jason Horman ([EMAIL PROTECTED]) + * @author Rodney Waldhoff */ public class Algorithms { /** - * Equivalent to code[EMAIL PROTECTED] #apply(Generator,UnaryFunction) apply}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),func)/code. + * Equivalent to + * code[EMAIL PROTECTED] #apply(Generator,UnaryFunction) apply}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),func).toCollection().iterator()/code. */ -public static final Generator apply(Iterator iter, UnaryFunction func) { -return apply(new IteratorToGeneratorAdapter(iter),func); +public static final Iterator apply(Iterator iter, UnaryFunction func) { +return apply(new IteratorToGeneratorAdapter(iter),func).toCollection().iterator(); } /** @@ -109,7 +111,8 @@ } /** - * Equivalent to code[EMAIL PROTECTED] #contains(Generator,UnaryPredicate) contains}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)/code. + * Equivalent to + * code[EMAIL PROTECTED] #contains(Generator,UnaryPredicate) contains}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)/code. */ public static final boolean contains(Iterator iter, UnaryPredicate pred) { return contains(new IteratorToGeneratorAdapter(iter),pred); @@ -258,10 +261,11 @@ /** - * Equivalent to code[EMAIL PROTECTED] #reject(Generator,UnaryPredicate) reject}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)/code. + * Equivalent to + * code[EMAIL PROTECTED] #reject(Generator,UnaryPredicate) reject}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator()/code. */ -public static Generator reject(Iterator iter, UnaryPredicate pred) { -return reject(new IteratorToGeneratorAdapter(iter), pred); +public static Iterator reject(Iterator iter, UnaryPredicate pred) { +return reject(new IteratorToGeneratorAdapter(iter), pred).toCollection().iterator(); } /** @@ -283,10 +287,11 @@ } /** - * Equivalent to code[EMAIL PROTECTED] #select(Generator,UnaryPredicate) select}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)/code. + * Equivalent to + * code[EMAIL PROTECTED] #select(Generator,UnaryPredicate) select}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator()/code. */ -public static final Generator select(Iterator iter, UnaryPredicate pred) { -return select(new IteratorToGeneratorAdapter(iter), pred); +public static final Iterator select(Iterator iter, UnaryPredicate pred) { +return select(new IteratorToGeneratorAdapter(iter), pred).toCollection().iterator
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection TestTransformedIterator.java TestFilteredIterator.java TestAll.java TestPredicatedIterator.java
rwaldhoff2003/11/25 11:02:42 Modified:functor/src/test/org/apache/commons/functor/core/collection TestAll.java Added: functor/src/java/org/apache/commons/functor/core/collection FilteredIterator.java TransformedIterator.java functor/src/test/org/apache/commons/functor/core/collection TestTransformedIterator.java TestFilteredIterator.java Removed: functor/src/java/org/apache/commons/functor/core/collection PredicatedIterator.java functor/src/test/org/apache/commons/functor/core/collection TestPredicatedIterator.java Log: * rename PredicatedIterator to FilteredIterator * add functions and teststo FilteredIterator * add TransformedIterator and tests Revision ChangesPath 1.1 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java Index: FilteredIterator.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java,v 1.1 2003/11/25 19:02:42 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 [EMAIL PROTECTED] * * 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.collection; import java.util.Iterator; import java.util.NoSuchElementException; import org.apache.commons.functor.UnaryPredicate; /** * @version $Revision: 1.1 $ $Date: 2003/11/25 19:02:42 $ * @author Rodney Waldhoff */ public final class FilteredIterator implements Iterator { // constructor // public FilteredIterator(UnaryPredicate predicate, Iterator iterator) { if(null == iterator || null == predicate) { throw new NullPointerException(); } else { this.predicate = predicate; this.iterator = iterator; } } // iterator methods // /** * @see java.util.Iterator#hasNext
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection TestTransformedIterator.java TestFilteredIterator.java
rwaldhoff2003/11/25 11:06:42 Modified:functor/src/java/org/apache/commons/functor/core/collection FilteredIterator.java TransformedIterator.java functor/src/test/org/apache/commons/functor/core/collection TestTransformedIterator.java TestFilteredIterator.java Log: swap order of parameters to match those used in Algorithms Revision ChangesPath 1.2 +6 -6 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java Index: FilteredIterator.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FilteredIterator.java 25 Nov 2003 19:02:42 - 1.1 +++ FilteredIterator.java 25 Nov 2003 19:06:42 - 1.2 @@ -70,7 +70,7 @@ // constructor // -public FilteredIterator(UnaryPredicate predicate, Iterator iterator) { +public FilteredIterator(Iterator iterator, UnaryPredicate predicate) { if(null == iterator || null == predicate) { throw new NullPointerException(); } else { @@ -136,14 +136,14 @@ } public String toString() { -return FilteredIterator + predicate + , + iterator + ; +return FilteredIterator + iterator + , + predicate + ; } // class methods // -public static Iterator filter(UnaryPredicate pred, Iterator iter) { -return null == pred ? iter : (null == iter ? null : new FilteredIterator(pred,iter)); +public static Iterator filter(Iterator iter, UnaryPredicate pred) { +return null == pred ? iter : (null == iter ? null : new FilteredIterator(iter,pred)); } // private 1.2 +6 -6 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/TransformedIterator.java Index: TransformedIterator.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/TransformedIterator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TransformedIterator.java 25 Nov 2003 19:02:42 - 1.1 +++ TransformedIterator.java 25 Nov 2003 19:06:42 - 1.2 @@ -69,7 +69,7 @@ // constructor // -public TransformedIterator(UnaryFunction function, Iterator iterator) { +public TransformedIterator(Iterator iterator, UnaryFunction function) { if(null == iterator || null == function) { throw new NullPointerException(); } else { @@ -121,14 +121,14 @@ } public String toString() { -return TransformedIterator + function + , + iterator + ; +return TransformedIterator + iterator + , + function + ; } // class methods // -public static Iterator transform(UnaryFunction func, Iterator iter) { -return null == func ? iter : (null == iter ? null : new TransformedIterator(func,iter)); +public static Iterator transform(Iterator iter, UnaryFunction func) { +return null == func ? iter : (null == iter ? null : new TransformedIterator(iter,func)); } 1.2 +16 -16 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.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestTransformedIterator.java 25 Nov 2003 19:02:42 - 1.1 +++ TestTransformedIterator.java 25 Nov 2003 19:06:42 - 1.2 @@ -89,7 +89,7 @@ public Object makeFunctor() { List list = new ArrayList(); list.add(xyzzy); -return TransformedIterator.transform(IdentityFunction.instance(),list.iterator()); +return TransformedIterator.transform(list.iterator(),IdentityFunction.instance()); } // Lifecycle @@ -116,7 +116,7 @@ public void testBasicTransform() { Iterator expected = negatives.iterator
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
rwaldhoff2003/11/25 11:21:43 Modified:functor/src/java/org/apache/commons/functor Algorithms.java functor/src/test/org/apache/commons/functor TestAlgorithms.java Log: iterate lazily, using TransformedIterator and FilteredIterator Revision ChangesPath 1.10 +27 -24 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java Index: Algorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Algorithms.java 25 Nov 2003 18:34:13 - 1.9 +++ Algorithms.java 25 Nov 2003 19:21:43 - 1.10 @@ -60,6 +60,9 @@ import java.util.Iterator; import java.util.NoSuchElementException; +import org.apache.commons.functor.core.collection.FilteredIterator; +import org.apache.commons.functor.core.collection.TransformedIterator; +import org.apache.commons.functor.core.composite.UnaryNot; import org.apache.commons.functor.generator.BaseGenerator; import org.apache.commons.functor.generator.Generator; import org.apache.commons.functor.generator.IteratorToGeneratorAdapter; @@ -87,11 +90,11 @@ public class Algorithms { /** - * Equivalent to - * code[EMAIL PROTECTED] #apply(Generator,UnaryFunction) apply}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),func).toCollection().iterator()/code. + * Returns an [EMAIL PROTECTED] Iterator} that will apply the given [EMAIL PROTECTED] UnaryFunction} to each + * element when accessed. */ public static final Iterator apply(Iterator iter, UnaryFunction func) { -return apply(new IteratorToGeneratorAdapter(iter),func).toCollection().iterator(); +return TransformedIterator.transform(iter,func); } /** @@ -259,13 +262,12 @@ return result[0]; } - /** - * Equivalent to - * code[EMAIL PROTECTED] #reject(Generator,UnaryPredicate) reject}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator()/code. + * Returns an [EMAIL PROTECTED] Iterator} that will only return elements that DO + * NOT match the given predicate. */ public static Iterator reject(Iterator iter, UnaryPredicate pred) { -return reject(new IteratorToGeneratorAdapter(iter), pred).toCollection().iterator(); +return FilteredIterator.filter(iter,UnaryNot.not(pred)); } /** @@ -287,11 +289,11 @@ } /** - * Equivalent to - * code[EMAIL PROTECTED] #select(Generator,UnaryPredicate) select}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator()/code. + * Returns an [EMAIL PROTECTED] Iterator} that will only return elements that DO + * match the given predicate. */ public static final Iterator select(Iterator iter, UnaryPredicate pred) { -return select(new IteratorToGeneratorAdapter(iter), pred).toCollection().iterator(); +return FilteredIterator.filter(iter,pred); } /** @@ -314,24 +316,24 @@ /** * Equivalent to - * code[EMAIL PROTECTED] #until(Generator,UnaryPredicate) until}(new [EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator()/code. + * code[EMAIL PROTECTED] #reject(Iterator,UnaryPredicate) reject}(iter,pred)/code. */ -public static final Iterator until(Iterator iter, UnaryPredicate pred) { -return until(new IteratorToGeneratorAdapter(iter), pred).toCollection().iterator(); +public static final Iterator until(final Iterator iter, final UnaryPredicate pred) { +return reject(iter,pred); } /** - * Returns a [EMAIL PROTECTED] Generator} that will stop when the predicate becomes - * true. This is useful for imposing [EMAIL PROTECTED] Generator} limits. For example: - * - * pre - * EachLine.open(file).until(new Offset(1)); - * /pre - * - * Would only generate 1 line from the file before [EMAIL PROTECTED] Generator#stop - * stopping} the generator. + * Equivalent to + * code[EMAIL PROTECTED] #reject(Generator,UnaryPredicate) reject}(gen,pred)/code. */ public static final Generator until(final Generator gen, final UnaryPredicate pred) { +return reject(gen,pred); +// here's the old version of this code +// reject(gen,pred
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util NumberRange.java
rwaldhoff2003/11/25 11:24:38 Modified:functor/src/test/org/apache/commons/functor/generator/util TestAll.java Removed: functor/src/test/org/apache/commons/functor/generator/util TestNumberRange.java functor/src/java/org/apache/commons/functor/generator/util NumberRange.java Log: delete NumberRange, functionality moved to IntegerRange and LongRange Revision ChangesPath 1.4 +2 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestAll.java 24 Nov 2003 23:59:21 - 1.3 +++ TestAll.java 25 Nov 2003 19:24:37 - 1.4 @@ -72,7 +72,6 @@ public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(TestEachElement.suite()); -suite.addTest(TestNumberRange.suite()); suite.addTest(TestIntegerRange.suite()); suite.addTest(TestLongRange.suite()); return suite; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection CollectionAlgorithms.java
rwaldhoff2003/11/25 11:39:45 Modified:functor/src/java/org/apache/commons/functor Algorithms.java functor/src/test/org/apache/commons/functor/core/collection TestCollectionAlgorithms.java functor/src/test/org/apache/commons/functor/example QuicksortExample.java Removed: functor/src/java/org/apache/commons/functor/core/collection CollectionAlgorithms.java Log: move functionality of CollectionAlgorithms into Algorithms, fix clients, remove CollectionAlgorithms Revision ChangesPath 1.11 +66 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java Index: Algorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Algorithms.java 25 Nov 2003 19:21:43 - 1.10 +++ Algorithms.java 25 Nov 2003 19:39:44 - 1.11 @@ -57,7 +57,10 @@ package org.apache.commons.functor; +import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; +import java.util.ListIterator; import java.util.NoSuchElementException; import org.apache.commons.functor.core.collection.FilteredIterator; @@ -87,8 +90,68 @@ * @author Jason Horman ([EMAIL PROTECTED]) * @author Rodney Waldhoff */ -public class Algorithms { +public final class Algorithms { +/** Public constructor for bean-ish APIs */ +public Algorithms() { +} + +public static Collection collect(Iterator iter) { +return collect(iter,new ArrayList()); +} + +public static Collection collect(Iterator iter, Collection col) { +while(iter.hasNext()) { +col.add(iter.next()); +} +return col; +} + +/** + * [EMAIL PROTECTED] ListIterator#set Set} each element of the + * given [EMAIL PROTECTED] ListIterator ListIterator} to + * the result of applying the + * given [EMAIL PROTECTED] UnaryFunction UnaryFunction} to + * its original value. + */ +public static void transform(ListIterator iter, UnaryFunction func) { +while(iter.hasNext()) { +iter.set(func.evaluate(iter.next())); +} +} + +/** + * [EMAIL PROTECTED] Iterator#remove Remove} from the + * given [EMAIL PROTECTED] Iterator Iterator} all elements + * that fail to match the + * given [EMAIL PROTECTED] UnaryPredicate UnaryPredicate}. + * + * @see #remove(Iterator,UnaryPredicate) + */ +public static void retain(Iterator iter, UnaryPredicate pred) { +while(iter.hasNext()) { +if(!(pred.test(iter.next( { +iter.remove(); +} +} +} + +/** + * [EMAIL PROTECTED] Iterator#remove Renmove} from the + * given [EMAIL PROTECTED] Iterator Iterator} all elements + * that match the + * given [EMAIL PROTECTED] UnaryPredicate UnaryPredicate}. + * + * @see #retain(Iterator,UnaryPredicate) + */ +public static void remove(Iterator iter, UnaryPredicate pred) { +while(iter.hasNext()) { +if(pred.test(iter.next())) { +iter.remove(); +} +} +} + /** * Returns an [EMAIL PROTECTED] Iterator} that will apply the given [EMAIL PROTECTED] UnaryFunction} to each * element when accessed. 1.9 +22 -22 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java Index: TestCollectionAlgorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TestCollectionAlgorithms.java 24 Nov 2003 23:09:13 - 1.8 +++ TestCollectionAlgorithms.java 25 Nov 2003 19:39:45 - 1.9 @@ -68,12 +68,12 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.functor.Algorithms; import org.apache.commons.functor.BinaryFunction; import org.apache.commons.functor.UnaryFunction; import org.apache.commons.functor.UnaryPredicate; import org.apache.commons.functor.UnaryProcedure; import org.apache.commons.functor.adapter.LeftBoundPredicate; -import org.apache.commons.functor.core.IdentityFunction; import org.apache.commons.functor.core.IsEqual; /** @@ -128,11 +128,11 @@ public void
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
rwaldhoff2003/11/25 11:44:09 Modified:functor/src/test/org/apache/commons/functor/core/collection TestAll.java functor/src/test/org/apache/commons/functor TestAlgorithms.java Removed: functor/src/test/org/apache/commons/functor/core/collection TestCollectionAlgorithms.java Log: merge TestCollectionAlgorithms into TestAlgorithms, remove it Revision ChangesPath 1.5 +2 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestAll.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestAll.java 25 Nov 2003 19:02:42 - 1.4 +++ TestAll.java 25 Nov 2003 19:44:08 - 1.5 @@ -72,7 +72,6 @@ public static Test suite() { TestSuite suite = new TestSuite(); -suite.addTest(TestCollectionAlgorithms.suite()); suite.addTest(TestFilteredIterator.suite()); suite.addTest(TestTransformedIterator.suite()); suite.addTest(TestIsEmpty.suite()); 1.7 +78 -31 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestAlgorithms.java 25 Nov 2003 19:21:43 - 1.6 +++ TestAlgorithms.java 25 Nov 2003 19:44:08 - 1.7 @@ -124,40 +124,30 @@ // Tests // -public void testHasPublicConstructor() { -// some frameworks work best with instantiable classes -assertNotNull(new Algorithms()); -} - -public void testApply() { -Collection result = IteratorToGeneratorAdapter.adapt(Algorithms.apply(list.iterator(),IdentityFunction.instance())).toCollection(); +public void testCollect() { +Collection result = Algorithms.collect(list.iterator()); assertNotNull(result); assertEquals(list.size(),result.size()); assertEquals(list,result); -} +} -public void testApply2() { +public void testCollect2() { Set set = new HashSet(); - assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(list.iterator(),IdentityFunction.instance())).to(set)); +assertSame(set,Algorithms.collect(list.iterator(),set)); assertEquals(list.size(),set.size()); for(Iterator iter = list.iterator(); iter.hasNext(); ) { assertTrue(set.contains(iter.next())); } -} +} -public void testApply3() { +public void testCollect3() { Set set = new HashSet(); - assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(listWithDuplicates.iterator(),IdentityFunction.instance())).to(set)); +assertSame(set,Algorithms.collect(listWithDuplicates.iterator(),set)); assertTrue(listWithDuplicates.size() set.size()); for(Iterator iter = listWithDuplicates.iterator(); iter.hasNext(); ) { assertTrue(set.contains(iter.next())); } -} - -public void testContains() { -assertTrue(Algorithms.contains(list.iterator(),equalsThree)); -assertTrue(!Algorithms.contains(list.iterator(),equalsTwentyThree)); -} +} public void testDetect() { assertEquals(new Integer(3),Algorithms.detect(list.iterator(),equalsThree)); @@ -167,41 +157,98 @@ } catch(NoSuchElementException e) { // expected } -} +} public void testDetectIfNone() { assertEquals(new Integer(3),Algorithms.detect(list.iterator(),equalsThree,Xyzzy)); assertEquals(Xyzzy,Algorithms.detect(list.iterator(),equalsTwentyThree,Xyzzy)); -} +} public void testForEach() { Summer summer = new Summer(); Algorithms.foreach(list.iterator(),summer); assertEquals(sum,summer.sum); -} +} public void testSelect1() { -Collection result = IteratorToGeneratorAdapter.adapt(Algorithms.select(list.iterator(),isEven)).toCollection(); +Collection result = Algorithms.collect(Algorithms.select(list.iterator(),isEven)); assertNotNull(result); assertEquals(evens,result); -} +} public void
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util CollectionTransformer.java
rwaldhoff2003/11/25 11:55:03 Modified:functor/src/java/org/apache/commons/functor/generator Transformer.java functor/src/test/org/apache/commons/functor/generator TestAll.java functor/src/java/org/apache/commons/functor/generator/util CollectionTransformer.java Added: functor/src/java/org/apache/commons/functor/generator BaseTransformer.java functor/src/test/org/apache/commons/functor/generator TestBaseTransformer.java Log: * have Transformer extend UnaryFunction * add BaseTransformer * add tests Revision ChangesPath 1.2 +6 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Transformer.java Index: Transformer.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Transformer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Transformer.java 30 Jun 2003 11:00:13 - 1.1 +++ Transformer.java 25 Nov 2003 19:55:02 - 1.2 @@ -57,6 +57,8 @@ package org.apache.commons.functor.generator; +import org.apache.commons.functor.UnaryFunction; + /** * Transformers are used to change a [EMAIL PROTECTED] Generator} into something else, * such as a [EMAIL PROTECTED] java.util.Collection}. @@ -66,6 +68,6 @@ * @author Jason Horman ([EMAIL PROTECTED]) */ -public interface Transformer { -public Object transform(Generator generator); +public interface Transformer extends UnaryFunction { +Object transform(Generator generator); } 1.1 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseTransformer.java Index: BaseTransformer.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseTransformer.java,v 1.1 2003/11/25 19:55:02 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 [EMAIL PROTECTED] * * 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
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator TestBaseGenerator.java TestAll.java TestGenerator.java
rwaldhoff2003/11/25 11:57:48 Modified:functor/src/test/org/apache/commons/functor/generator TestAll.java Added: functor/src/test/org/apache/commons/functor/generator TestBaseGenerator.java Removed: functor/src/test/org/apache/commons/functor/generator TestGenerator.java Log: rename TestGenerator to TestBaseGenerator Revision ChangesPath 1.5 +3 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestAll.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestAll.java 25 Nov 2003 19:55:03 - 1.4 +++ TestAll.java 25 Nov 2003 19:57:48 - 1.5 @@ -71,7 +71,7 @@ public static Test suite() { TestSuite suite = new TestSuite(); -suite.addTest(TestGenerator.suite()); +suite.addTest(TestBaseGenerator.suite()); suite.addTest(TestBaseTransformer.suite()); suite.addTest(TestIteratorToGeneratorAdapter.suite()); suite.addTest(org.apache.commons.functor.generator.util.TestAll.suite()); 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestBaseGenerator.java Index: TestBaseGenerator.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestBaseGenerator.java,v 1.1 2003/11/25 19:57:48 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 [EMAIL PROTECTED] * * 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.generator; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.NoSuchElementException; import java.util.Set; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines - New directory
rwaldhoff2003/11/25 15:13:36 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example TestAll.java
rwaldhoff2003/11/25 15:13:38 Modified:functor/src/test/org/apache/commons/functor/generator/util TestIntegerRange.java TestLongRange.java functor/src/test/org/apache/commons/functor/example TestAll.java Added: functor/src/test/org/apache/commons/functor/example/lines WordCount.java Lines.java Count.java Contains.java Sum.java StartsWith.java TestLines.java Log: add examples Revision ChangesPath 1.4 +23 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java Index: TestIntegerRange.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestIntegerRange.java 25 Nov 2003 00:01:15 - 1.3 +++ TestIntegerRange.java 25 Nov 2003 23:13:38 - 1.4 @@ -57,6 +57,9 @@ package org.apache.commons.functor.generator.util; +import java.util.ArrayList; +import java.util.List; + import junit.framework.Test; import junit.framework.TestSuite; @@ -85,6 +88,24 @@ // Tests // + +public void testGenerateListExample() { +// generates a collection of Integers from 0 (inclusive) to 10 (exclusive) +{ +List list = (List)(new IntegerRange(0,10).to(new ArrayList())); +for(int i=0;i10;i++) { +assertEquals(new Integer(i),list.get(i)); +} +} + +// generates a collection of Integers from 10 (inclusive) to 0 (exclusive) +{ +List list = (List)(new IntegerRange(10,0).to(new ArrayList())); +for(int i=10;i0;i--) { +assertEquals(new Integer(i),list.get(10-i)); +} +} +} public void testStepChecking() { { 1.3 +23 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java Index: TestLongRange.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestLongRange.java25 Nov 2003 00:01:15 - 1.2 +++ TestLongRange.java25 Nov 2003 23:13:38 - 1.3 @@ -57,6 +57,9 @@ package org.apache.commons.functor.generator.util; +import java.util.ArrayList; +import java.util.List; + import junit.framework.Test; import junit.framework.TestSuite; @@ -85,6 +88,24 @@ // Tests // + +public void testGenerateListExample() { +// generates a collection of Integers from 0 (inclusive) to 10 (exclusive) +{ +List list = (List)(new LongRange(0,10).to(new ArrayList())); +for(int i=0;i10;i++) { +assertEquals(new Long(i),list.get(i)); +} +} + +// generates a collection of Integers from 10 (inclusive) to 0 (exclusive) +{ +List list = (List)(new LongRange(10,0).to(new ArrayList())); +for(int i=10;i0;i--) { +assertEquals(new Long(i),list.get(10-i)); +} +} +} public void testStepChecking() { { 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/WordCount.java Index: WordCount.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/WordCount.java,v 1.1 2003/11/25 23:13:38 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
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example TestAll.java
rwaldhoff2003/11/25 15:33:15 Modified:functor/src/test/org/apache/commons/functor/example TestAll.java Added: functor/src/test/org/apache/commons/functor/example/lines TestAll.java Log: add TestAll Revision ChangesPath 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/TestAll.java Index: TestAll.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/TestAll.java,v 1.1 2003/11/25 23:33:15 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 [EMAIL PROTECTED] * * 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.example.lines; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2003/11/25 23:33:15 $ * @author Rodney Waldhoff */ public class TestAll extends TestCase { public TestAll(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(TestLines.suite()); return suite; } } 1.5 +3 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestAll.java 25 Nov 2003 23:13:38 - 1.4 +++ TestAll.java 25 Nov 2003 23:33:15 - 1.5 @@ -74,7 +74,7 @@ suite.addTest(FlexiMapExample.suite()); suite.addTest(QuicksortExample.suite()); -suite.addTest(org.apache.commons.functor.example.lines.TestLines.suite()); +suite.addTest(org.apache.commons.functor.example.lines.TestAll.suite()); return suite; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map - New directory
rwaldhoff2003/11/25 17:18:27 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map TestLazyMap.java FunctoredMap.java FixedSizeMap.java TestAll.java TestPredicatedMap.java PredicatedMap.java LazyMap.java TestFixedSizeMap.java
rwaldhoff2003/11/25 17:18:28 Modified:functor/src/test/org/apache/commons/functor/example TestAll.java Added: functor/src/test/org/apache/commons/functor/example/map TestLazyMap.java FunctoredMap.java FixedSizeMap.java TestAll.java TestPredicatedMap.java PredicatedMap.java LazyMap.java TestFixedSizeMap.java Log: more examples Revision ChangesPath 1.6 +3 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestAll.java 25 Nov 2003 23:33:15 - 1.5 +++ TestAll.java 26 Nov 2003 01:18:28 - 1.6 @@ -75,6 +75,7 @@ suite.addTest(FlexiMapExample.suite()); suite.addTest(QuicksortExample.suite()); suite.addTest(org.apache.commons.functor.example.lines.TestAll.suite()); +suite.addTest(org.apache.commons.functor.example.map.TestAll.suite()); return suite; } 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map/TestLazyMap.java Index: TestLazyMap.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map/TestLazyMap.java,v 1.1 2003/11/26 01:18:28 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 [EMAIL PROTECTED] * * 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.example.map; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.commons.functor.core.collection.Size; /** * @version $Revision: 1.1 $ $Date: 2003/11/26 01:18:28 $ * @author Rodney Waldhoff */ public class TestLazyMap extends TestCase { public TestLazyMap(String
cvs commit: jakarta-commons-sandbox/functor/xdocs examples.xml
rwaldhoff2003/11/25 17:28:36 Modified:functor/xdocs examples.xml Log: link to new examples Revision ChangesPath 1.5 +13 -0 jakarta-commons-sandbox/functor/xdocs/examples.xml Index: examples.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/xdocs/examples.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- examples.xml 31 Mar 2003 19:04:53 - 1.4 +++ examples.xml 26 Nov 2003 01:28:36 - 1.5 @@ -50,6 +50,12 @@ In other words, with descriptive prose mixed right in with the source, as code/* C++ style *//code comments. /p + subsection name=Generators +p + The a href=xref-test/org/apache/commons/functor/example/lines/package-summary.htmllines/a + package demonstrates a functional approach to IO using Generators and the Algorithms class. +/p + /subsection subsection name=Reuse Through Composition p The Functor package, and more generally, a functional approach @@ -84,6 +90,13 @@ applies this design to codejava.util.Map/code, demonstrating how pluggable functors can be applied to a generic codeMap/code structure in order to introduce new behaviors. + /p + p +The +a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/map/package-summary.html;map/a +package is a more complete example of this, implementing a number of the Commons-Collections Maps +derived from a base +a href=http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/map/FunctoredMap.html;FunctoredMap/a. /p /subsection subsection name=A Quicksort Implementation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/docs contributors.html
rwaldhoff2003/11/24 08:57:57 Modified:xdocscontributors.xml docs contributors.html Log: add emeritus section, update committer list Revision ChangesPath 1.17 +83 -29jakarta-commons/xdocs/contributors.xml Index: contributors.xml === RCS file: /home/cvs/jakarta-commons/xdocs/contributors.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- contributors.xml 2 Nov 2003 19:27:55 - 1.16 +++ contributors.xml 24 Nov 2003 16:57:57 - 1.17 @@ -8,37 +8,91 @@ section name=Contributors pWe are the participants in Commons:/p ul -liStephen Colebourne/li -liMartin Cooper/li -liMorgan Delagrange/li -lidIon Gillard/li -liDavid Graham/li -liMatthew Hawthorne/li -liB.C. Holmes/li -liTed Husted/li -liConor MacNeill/li -liGeir Magnusson Jr./li -liCostin Manolache/li -liVincent Massol/li -liRemy Maucherat/li -liCraig R. McClanahan/li -liTim O'Brien/li -liIgnacio J. Ortega/li -liSung-Gu Park/li -liJuergen Pill/li -liDoug Sale/li -liScott Sanders/li -liYoav Shapira/li -liRichard A. Sitze/li -liPhil Steitz/li -liJames Strachan/li -liDirk Verbeeck/li -liRodney Waldhoff/li -liDavid Weinrich/li -liJari Worsley/li -liHenri Yandell/li +!-- alpha by userid, feel free to sort otherwise -- +liAdrian Sutton (adrian)/li +liAlex Chaffee (alex)/li +liArun Mammen Thomas (amamment)/li +liJuozas Baliuka (baliuka)/li +liHenri Yandell (bayard)/li +liJeff Brekke (brekke)/li +liBruno D'Avanzo (brudav)/li +liCostin Manolache (costin)/li +liCraig R. McClanahan (craigmcc)/li +liDaniel F. Savarese (dfs)/li +liDavid Graham (dgraham)/li +liDavanum Srinivas (dims)/li +liDion Gillard (dion)/li +liDirk Verbeeck (dirkv)/li +liDaniel Rall (dlr)/li +liDmitri Plotnikov (dmitri)/li +liFredrik Westermarck (fredrik)/li +liGeir Magnusson Jr. (geirm)/li +liGary Gregory (ggregory)/li +liGlenn Nielsen (glenn)/li +liTed Husted (husted)/li +liSung-Gu Park (jericho)/li +liJean-Frederic Clere (jfclere)/li +liJohn Keyes (jkeyes)/li +liJohn McNally (jmcnally)/li +liJon Stevens (jon)/li +liJeff Dever (jsdever)/li +liJames Strachan (jstrachan)/li +liJason van Zyl (jvanzyl)/li +liJan Luehe (luehe)/li +liMartin Cooper (martinc)/li +liMatthew Hawthorne (matth)/li +liMichael Becke (mbecke)/li +liMark R. Diggory (mdiggory)/li +liMorgan Delagrange (morgand)/li +liMartin Poeschl (mpoeschl)/li +liMladen Turk (mturk)/li +liMartin van den Bemt (mvdb)/li +liOrtwin Gluck (oglueck)/li +liOleg Kalnichevski (olegk)/li +liPatrick Luby (patrickl)/li +liPeter Royal (proyal)/li +liPhil Steitz (psteitz)/li +liRobert Burrell Donkin (rdonkin)/li +liRemy Maucherat (remm)/li +liRobert Leland (rleland)/li +liRichard Sitze (rsitze)/li +liRodney Waldhoff (rwaldhoff)/li +liScott Sanders (sanders)/li +liSteve Cohen (scohen)/li +liStephen Colebourne (scolebourne)/li +liShawn Bayern (shawn)/li +liSteven Caswell (stevencaswell)/li +liSean Sullivan (sullis)/li +liTim O'Brien (tobrien)/li +liJames Turner (turner)/li +liBob McWhirter (werken)/li +liYoav Shapira (yoavs)/li /ul pJoin us!/p +/section +section name=Emeritus Committers + p + The following committers have made a number of contributions to Jakarta Commons, but have + been inactive for some time. Following the Jakarta project's a href=http://jakarta.apache.org/site/roles.html;guidelines/a, + they have been named emeritus committers. These individuals may be restored to active committer status + simply by requesting it on the commons-dev mailing list. + /p + ul +liArron Bates (arron)/li +liConor MacNeill (conor)/li +liDoug Sale (dsale)/li +liDavid Winterfeldt (dwinterfeldt)/li +liPaul Hammant (hammant)/li +li(jariw)/li +liJeff Turner (jefft)/li +liMarc Saegesser (marcsaeg)/li +liMichael Smith (mas)/li +liIgnacio J. Ortega (nacho)/li +liNoel J. Bergman (noel)/li +liPaulo Gaspar (paulo)/li +liSerge Knystautas (serge)/li +liVincent Massol (vmassol)/li + /ul /section /body /document 1.93 +94 -29jakarta-commons/docs/contributors.html Index: contributors.html === RCS file: /home/cvs/jakarta-commons/docs/contributors.html,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93
cvs commit: jakarta-commons/docs contributors.html
rwaldhoff2003/11/24 09:02:02 Modified:xdocscontributors.xml docs contributors.html Log: move noel and serge to active Revision ChangesPath 1.18 +2 -2 jakarta-commons/xdocs/contributors.xml Index: contributors.xml === RCS file: /home/cvs/jakarta-commons/xdocs/contributors.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- contributors.xml 24 Nov 2003 16:57:57 - 1.17 +++ contributors.xml 24 Nov 2003 17:02:02 - 1.18 @@ -47,6 +47,7 @@ liMartin Poeschl (mpoeschl)/li liMladen Turk (mturk)/li liMartin van den Bemt (mvdb)/li +liNoel J. Bergman (noel)/li liOrtwin Gluck (oglueck)/li liOleg Kalnichevski (olegk)/li liPatrick Luby (patrickl)/li @@ -58,6 +59,7 @@ liRichard Sitze (rsitze)/li liRodney Waldhoff (rwaldhoff)/li liScott Sanders (sanders)/li +liSerge Knystautas (serge)/li liSteve Cohen (scohen)/li liStephen Colebourne (scolebourne)/li liShawn Bayern (shawn)/li @@ -88,9 +90,7 @@ liMarc Saegesser (marcsaeg)/li liMichael Smith (mas)/li liIgnacio J. Ortega (nacho)/li -liNoel J. Bergman (noel)/li liPaulo Gaspar (paulo)/li -liSerge Knystautas (serge)/li liVincent Massol (vmassol)/li /ul /section 1.94 +2 -2 jakarta-commons/docs/contributors.html Index: contributors.html === RCS file: /home/cvs/jakarta-commons/docs/contributors.html,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- contributors.html 24 Nov 2003 16:57:57 - 1.93 +++ contributors.html 24 Nov 2003 17:02:02 - 1.94 @@ -255,6 +255,7 @@ liMartin Poeschl (mpoeschl)/li liMladen Turk (mturk)/li liMartin van den Bemt (mvdb)/li +liNoel J. Bergman (noel)/li liOrtwin Gluck (oglueck)/li liOleg Kalnichevski (olegk)/li liPatrick Luby (patrickl)/li @@ -266,6 +267,7 @@ liRichard Sitze (rsitze)/li liRodney Waldhoff (rwaldhoff)/li liScott Sanders (sanders)/li +liSerge Knystautas (serge)/li liSteve Cohen (scohen)/li liStephen Colebourne (scolebourne)/li liShawn Bayern (shawn)/li @@ -307,9 +309,7 @@ liMarc Saegesser (marcsaeg)/li liMichael Smith (mas)/li liIgnacio J. Ortega (nacho)/li -liNoel J. Bergman (noel)/li liPaulo Gaspar (paulo)/li -liSerge Knystautas (serge)/li liVincent Massol (vmassol)/li /ul /blockquote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core ConstantPredicate.java
rwaldhoff2003/11/24 12:31:20 Modified:functor/src/test/org/apache/commons/functor/adapter TestBinaryFunctionBinaryPredicate.java TestFunctionPredicate.java TestUnaryFunctionUnaryPredicate.java functor/src/test/org/apache/commons/functor/core TestIsInstanceOf.java TestIsNotEqual.java TestIsNotNull.java TestConstantPredicate.java TestIsNull.java TestIsEqual.java functor/src/test/org/apache/commons/functor/core/collection TestIsElementOf.java TestPredicatedIterator.java functor/src/test/org/apache/commons/functor/core/composite TestBinaryNot.java TestTransposedPredicate.java TestOr.java TestNot.java TestUnaryOr.java TestUnaryAnd.java TestAnd.java TestBinaryAnd.java TestUnaryNot.java TestBinaryOr.java functor/src/java/org/apache/commons/functor/core ConstantPredicate.java Log: rename ConstantPredicate static methods Revision ChangesPath 1.3 +3 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBinaryFunctionBinaryPredicate.java Index: TestBinaryFunctionBinaryPredicate.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestBinaryFunctionBinaryPredicate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestBinaryFunctionBinaryPredicate.java28 Jan 2003 12:00:30 - 1.2 +++ TestBinaryFunctionBinaryPredicate.java24 Nov 2003 20:31:19 - 1.3 @@ -136,7 +136,7 @@ BinaryPredicate p = new BinaryFunctionBinaryPredicate(new ConstantFunction(Boolean.TRUE)); assertEquals(p,p); assertObjectsAreEqual(p,new BinaryFunctionBinaryPredicate(new ConstantFunction(Boolean.TRUE))); -assertObjectsAreNotEqual(p,ConstantPredicate.getTruePredicate()); +assertObjectsAreNotEqual(p,ConstantPredicate.trueInstance()); assertObjectsAreNotEqual(p,new BinaryFunctionBinaryPredicate(null)); assertObjectsAreNotEqual(p,new BinaryFunctionBinaryPredicate(new ConstantFunction(Boolean.FALSE))); assertObjectsAreEqual(new BinaryFunctionBinaryPredicate(null),new BinaryFunctionBinaryPredicate(null)); 1.2 +3 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestFunctionPredicate.java Index: TestFunctionPredicate.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestFunctionPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestFunctionPredicate.java27 Jan 2003 19:33:41 - 1.1 +++ TestFunctionPredicate.java24 Nov 2003 20:31:19 - 1.2 @@ -136,7 +136,7 @@ Predicate p = new FunctionPredicate(new ConstantFunction(Boolean.TRUE)); assertEquals(p,p); assertObjectsAreEqual(p,new FunctionPredicate(new ConstantFunction(Boolean.TRUE))); -assertObjectsAreNotEqual(p,ConstantPredicate.getTruePredicate()); +assertObjectsAreNotEqual(p,ConstantPredicate.trueInstance()); assertObjectsAreNotEqual(p,new FunctionPredicate(null)); assertObjectsAreNotEqual(p,new FunctionPredicate(new ConstantFunction(Boolean.FALSE))); assertObjectsAreEqual(new FunctionPredicate(null),new FunctionPredicate(null)); 1.3 +3 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestUnaryFunctionUnaryPredicate.java Index: TestUnaryFunctionUnaryPredicate.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/adapter/TestUnaryFunctionUnaryPredicate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestUnaryFunctionUnaryPredicate.java 28 Jan 2003 12:00:30 - 1.2 +++ TestUnaryFunctionUnaryPredicate.java 24 Nov 2003 20:31:19 - 1.3 @@ -136,7 +136,7 @@ UnaryPredicate p = new UnaryFunctionUnaryPredicate(new ConstantFunction(Boolean.TRUE)); assertEquals(p,p); assertObjectsAreEqual(p,new UnaryFunctionUnaryPredicate(new ConstantFunction(Boolean.TRUE))); -assertObjectsAreNotEqual(p,ConstantPredicate.getTruePredicate()); +assertObjectsAreNotEqual(p,ConstantPredicate.trueInstance()); assertObjectsAreNotEqual(p,new UnaryFunctionUnaryPredicate(null)); assertObjectsAreNotEqual(p,new
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator Generator.java
rwaldhoff2003/11/24 13:13:15 Modified:functor/src/java/org/apache/commons/functor/generator Generator.java Log: remove extra space Revision ChangesPath 1.5 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Generator.java12 Nov 2003 00:50:44 - 1.4 +++ Generator.java24 Nov 2003 21:13:15 - 1.5 @@ -65,7 +65,7 @@ /** * @version $Revision$ $Date$ - * @author Jason Horman ([EMAIL PROTECTED]) + * @author Jason Horman ([EMAIL PROTECTED]) * @author Rodney Waldhoff */ public interface Generator { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection TestSize.java
rwaldhoff2003/11/24 13:29:28 Modified:functor/src/java/org/apache/commons/functor/core/collection Size.java functor/src/test/org/apache/commons/functor/core/collection TestSize.java Log: support Strings and arrays in Size function, add tests Revision ChangesPath 1.3 +29 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/Size.java Index: Size.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/Size.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Size.java 24 Nov 2003 20:12:17 - 1.2 +++ Size.java 24 Nov 2003 21:29:28 - 1.3 @@ -57,11 +57,14 @@ package org.apache.commons.functor.core.collection; import java.io.Serializable; +import java.lang.reflect.Array; import java.util.Collection; import org.apache.commons.functor.UnaryFunction; /** + * Returns the size of the specified Collection, or the length + * of the specified array or String. * @version $Revision$ $Date$ * @author Rodney Waldhoff */ @@ -73,7 +76,17 @@ public Size() { } public Object evaluate(Object obj) { -return new Integer(((Collection)obj).size()); +if(obj instanceof Collection) { +return evaluate((Collection)obj); +} else if(obj instanceof String) { +return evaluate((String)obj); +} else if(null != obj obj.getClass().isArray()) { +return evaluateArray(obj); +} else if(null == obj){ +throw new NullPointerException(Argument must not be null); +} else { +throw new ClassCastException(Expected Collection, String or Array, found + obj); +} } /** @@ -100,7 +113,19 @@ public static final Size instance() { return INSTANCE; } + +private Object evaluate(Collection col) { +return new Integer(col.size()); +} + +private Object evaluate(String str) { +return new Integer(str.length()); +} + +private Object evaluateArray(Object array) { +return new Integer(Array.getLength(array)); +} private static final Size INSTANCE = new Size(); - + } 1.3 +9 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestSize.java Index: TestSize.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestSize.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestSize.java 24 Nov 2003 20:12:17 - 1.2 +++ TestSize.java 24 Nov 2003 21:29:28 - 1.3 @@ -139,7 +139,7 @@ } } -public void testTestNonCollection() throws Exception { +public void testEvaluateNonCollection() throws Exception { try { Size.instance().evaluate(new Integer(3)); fail(Expected ClassCastException); @@ -148,6 +148,12 @@ } } +public void testEvaluateArray() throws Exception { +assertEquals(new Integer(10),Size.instance().evaluate(new int[10])); +assertEquals(new Integer(7),Size.instance().evaluate(new String[7])); +assertEquals(new Integer(xyzzy.length()),Size.instance().evaluate(xyzzy)); +} + public void testEquals() throws Exception { UnaryFunction f = new Size(); assertEquals(f,f); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection TestSize.java
rwaldhoff2003/11/24 13:31:30 Modified:functor/src/test/org/apache/commons/functor/core/collection TestSize.java Log: split test Revision ChangesPath 1.4 +5 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestSize.java Index: TestSize.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestSize.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestSize.java 24 Nov 2003 21:29:28 - 1.3 +++ TestSize.java 24 Nov 2003 21:31:30 - 1.4 @@ -151,6 +151,9 @@ public void testEvaluateArray() throws Exception { assertEquals(new Integer(10),Size.instance().evaluate(new int[10])); assertEquals(new Integer(7),Size.instance().evaluate(new String[7])); +} + +public void testEvaluateString() throws Exception { assertEquals(new Integer(xyzzy.length()),Size.instance().evaluate(xyzzy)); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection IsEmpty.java
rwaldhoff2003/11/24 13:38:39 Modified:functor/src/test/org/apache/commons/functor/core/collection TestIsEmpty.java functor/src/java/org/apache/commons/functor/core/collection IsEmpty.java Log: support Strings and arrays in IsEmpty predicate, add tests Revision ChangesPath 1.4 +14 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsEmpty.java Index: TestIsEmpty.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsEmpty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestIsEmpty.java 24 Nov 2003 20:12:17 - 1.3 +++ TestIsEmpty.java 24 Nov 2003 21:38:39 - 1.4 @@ -143,6 +143,18 @@ } } +public void testTestArray() throws Exception { +assertTrue(! IsEmpty.instance().test(new int[10])); +assertTrue(! IsEmpty.instance().test(new Object[10])); +assertTrue(IsEmpty.instance().test(new int[0])); +assertTrue(IsEmpty.instance().test(new Object[0])); +} + +public void testTestString() throws Exception { +assertTrue(! IsEmpty.instance().test(xyzzy)); +assertTrue(IsEmpty.instance().test()); +} + public void testEquals() throws Exception { UnaryPredicate p = new IsEmpty(); assertEquals(p,p); 1.3 +35 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsEmpty.java Index: IsEmpty.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsEmpty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IsEmpty.java 24 Nov 2003 20:12:17 - 1.2 +++ IsEmpty.java 24 Nov 2003 21:38:39 - 1.3 @@ -57,6 +57,7 @@ package org.apache.commons.functor.core.collection; import java.io.Serializable; +import java.lang.reflect.Array; import java.util.Collection; import org.apache.commons.functor.UnaryPredicate; @@ -71,9 +72,22 @@ // public IsEmpty() { } + +// instance methods +// public boolean test(Object obj) { -return ((Collection)obj).isEmpty(); +if(obj instanceof Collection) { +return test((Collection)obj); +} else if(obj instanceof String) { +return test((String)obj); +} else if(null != obj obj.getClass().isArray()) { +return testArray(obj); +} else if(null == obj){ +throw new NullPointerException(Argument must not be null); +} else { +throw new ClassCastException(Expected Collection, String or Array, found + obj); +} } /** @@ -97,9 +111,27 @@ return IsEmpty(); } +private boolean test(Collection col) { +return col.isEmpty(); +} + +private boolean test(String str) { +return 0 == str.length(); +} + +private boolean testArray(Object array) { +return 0 == Array.getLength(array); +} + +// class methods +// + public static final IsEmpty instance() { return INSTANCE; } + +// class variables +// private static final IsEmpty INSTANCE = new IsEmpty(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection IsElementOf.java
rwaldhoff2003/11/24 13:56:43 Modified:functor/src/test/org/apache/commons/functor/core/collection TestIsElementOf.java functor/src/java/org/apache/commons/functor/core/collection IsElementOf.java Log: support Arrays in isElementOf, add tests Revision ChangesPath 1.6 +50 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsElementOf.java Index: TestIsElementOf.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsElementOf.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestIsElementOf.java 24 Nov 2003 20:31:20 - 1.5 +++ TestIsElementOf.java 24 Nov 2003 21:56:43 - 1.6 @@ -96,7 +96,7 @@ // Tests // -public void testTest() throws Exception { +public void testTestCollection() throws Exception { ArrayList list = new ArrayList(); list.add(new Integer(5)); list.add(new Integer(10)); @@ -112,12 +112,57 @@ } -public void testNullWrapper() { +public void testTestArray() throws Exception { +int[] list = new int[] { 5, 10, 15 }; + +UnaryPredicate p = IsElementOf.instance(list); +assertTrue(p.test(new Integer(5))); +assertTrue(p.test(new Integer(10))); +assertTrue(p.test(new Integer(15))); + +assertTrue(!p.test(new Integer(4))); +assertTrue(!p.test(new Integer(11))); +} + +public void testTestArrayWithNull() throws Exception { +assertTrue(! IsElementOf.instance().test(null,new int[] { 5, 10, 15 })); +assertTrue(IsElementOf.instance().test(null,new Integer[] { new Integer(5), null, new Integer(15) })); +assertTrue(IsElementOf.instance().test(new Integer(15),new Integer[] { new Integer(5), null, new Integer(15) })); +} + +public void testWrapNull() { try { IsElementOf.instance(null); +fail(expected NullPointerException); +} catch (NullPointerException e) { +// expected +} +} + +public void testWrapNonCollection() { +try { +IsElementOf.instance(new Integer(3)); +fail(expected IllegalArgumentException); +} catch (IllegalArgumentException e) { +// expected +} +} + +public void testTestNull() { +try { +IsElementOf.instance().test(new Integer(5),null); +fail(expected NullPointerException); +} catch (NullPointerException e) { +// expected +} +} + +public void testTestNonCollection() { +try { +IsElementOf.instance().test(new Integer(5),new Long(5)); fail(expected IllegalArgumentException); } catch (IllegalArgumentException e) { -// good +// expected } } 1.4 +40 -11 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsElementOf.java Index: IsElementOf.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsElementOf.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- IsElementOf.java 24 Nov 2003 20:29:23 - 1.3 +++ IsElementOf.java 24 Nov 2003 21:56:43 - 1.4 @@ -58,6 +58,7 @@ package org.apache.commons.functor.core.collection; import java.io.Serializable; +import java.lang.reflect.Array; import java.util.Collection; import org.apache.commons.functor.BinaryPredicate; @@ -85,13 +86,17 @@ //--- public boolean test(Object obj, Object col) { -return test(obj,(Collection)col); +if(col instanceof Collection) { +return testCollection(obj,(Collection)col); +} else if(null != col col.getClass().isArray()) { +return testArray(obj,col); +} else if(null == col) { +throw new NullPointerException(Right side argument must not be null.); +} else { +throw new IllegalArgumentException(Expected Collection or Array, found + col.getClass()); +} } -public boolean test(Object obj, Collection col) { -return col.contains(obj); -} - public boolean equals(Object obj) { return (obj instanceof IsElementOf); } @@ -104,6 +109,25
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection CollectionAlgorithms.java
rwaldhoff2003/11/24 13:59:30 Modified:functor/src/test/org/apache/commons/functor/core/collection TestCollectionAlgorithms.java functor/src/test/org/apache/commons/functor/example QuicksortExample.java functor/src/java/org/apache/commons/functor/core/collection CollectionAlgorithms.java Log: deprecate CollectionAlgorithms, replaced by Algorithms Revision ChangesPath 1.7 +3 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java Index: TestCollectionAlgorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestCollectionAlgorithms.java 24 Nov 2003 20:12:17 - 1.6 +++ TestCollectionAlgorithms.java 24 Nov 2003 21:59:30 - 1.7 @@ -78,6 +78,7 @@ /** * @version $Revision$ $Date$ + * @deprecated The CollectionAlgorithms class has been deprecated * @author Rodney Waldhoff */ public class TestCollectionAlgorithms extends TestCase { 1.5 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/QuicksortExample.java Index: QuicksortExample.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/QuicksortExample.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- QuicksortExample.java 24 Nov 2003 20:12:16 - 1.4 +++ QuicksortExample.java 24 Nov 2003 21:59:30 - 1.5 @@ -69,7 +69,7 @@ import org.apache.commons.functor.UnaryFunction; import org.apache.commons.functor.adapter.RightBoundPredicate; import org.apache.commons.functor.core.ConstantFunction; -import org.apache.commons.functor.core.collection.CollectionAlgorithms; +import org.apache.commons.functor.Algorithms; import org.apache.commons.functor.core.collection.IsEmpty; import org.apache.commons.functor.core.comparator.IsGreaterThanOrEqual; import org.apache.commons.functor.core.comparator.IsLessThan; @@ -501,7 +501,7 @@ */ private BinaryFunction lesserTail = new ObjectListFunction() { public Object evaluate(Object head, List tail) { -return CollectionAlgorithms.select( +return Algorithms.select( tail.iterator(), RightBoundPredicate.bind( IsLessThan.getIsLessThan(), @@ -516,7 +516,7 @@ */ private BinaryFunction greaterTail = new BinaryFunction() { public Object evaluate(Object head, Object tail) { -return CollectionAlgorithms.select( +return Algorithms.select( ((List)tail).iterator(), RightBoundPredicate.bind( IsGreaterThanOrEqual.instance(), 1.4 +3 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/CollectionAlgorithms.java Index: CollectionAlgorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/CollectionAlgorithms.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CollectionAlgorithms.java 19 Feb 2003 12:34:20 - 1.3 +++ CollectionAlgorithms.java 24 Nov 2003 21:59:30 - 1.4 @@ -71,6 +71,7 @@ * Utility methods and algorithms for applying functors * to [EMAIL PROTECTED] Collection Collections}. * + * @deprecated Replaced by, or to be replaced by org.apache.commons.functor.Algorithms * @version $Revision$ $Date$ * @author Rodney Waldhoff */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection CollectionAlgorithms.java
rwaldhoff2003/11/24 15:09:13 Modified:functor/src/test/org/apache/commons/functor/core/collection TestCollectionAlgorithms.java functor/src/test/org/apache/commons/functor/example QuicksortExample.java functor/src/java/org/apache/commons/functor/core/collection CollectionAlgorithms.java Log: undeprecate CollectionAlgorithms for now, Algorithms and CollectionAlgorithms are less compatiable than I thought Revision ChangesPath 1.8 +2 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java Index: TestCollectionAlgorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestCollectionAlgorithms.java 24 Nov 2003 21:59:30 - 1.7 +++ TestCollectionAlgorithms.java 24 Nov 2003 23:09:13 - 1.8 @@ -78,7 +78,6 @@ /** * @version $Revision$ $Date$ - * @deprecated The CollectionAlgorithms class has been deprecated * @author Rodney Waldhoff */ public class TestCollectionAlgorithms extends TestCase { 1.6 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/QuicksortExample.java Index: QuicksortExample.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/QuicksortExample.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- QuicksortExample.java 24 Nov 2003 21:59:30 - 1.5 +++ QuicksortExample.java 24 Nov 2003 23:09:13 - 1.6 @@ -69,7 +69,7 @@ import org.apache.commons.functor.UnaryFunction; import org.apache.commons.functor.adapter.RightBoundPredicate; import org.apache.commons.functor.core.ConstantFunction; -import org.apache.commons.functor.Algorithms; +import org.apache.commons.functor.core.collection.CollectionAlgorithms; import org.apache.commons.functor.core.collection.IsEmpty; import org.apache.commons.functor.core.comparator.IsGreaterThanOrEqual; import org.apache.commons.functor.core.comparator.IsLessThan; @@ -501,7 +501,7 @@ */ private BinaryFunction lesserTail = new ObjectListFunction() { public Object evaluate(Object head, List tail) { -return Algorithms.select( +return CollectionAlgorithms.select( tail.iterator(), RightBoundPredicate.bind( IsLessThan.getIsLessThan(), @@ -516,7 +516,7 @@ */ private BinaryFunction greaterTail = new BinaryFunction() { public Object evaluate(Object head, Object tail) { -return Algorithms.select( +return CollectionAlgorithms.select( ((List)tail).iterator(), RightBoundPredicate.bind( IsGreaterThanOrEqual.instance(), 1.5 +2 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/CollectionAlgorithms.java Index: CollectionAlgorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/CollectionAlgorithms.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CollectionAlgorithms.java 24 Nov 2003 21:59:30 - 1.4 +++ CollectionAlgorithms.java 24 Nov 2003 23:09:13 - 1.5 @@ -71,7 +71,6 @@ * Utility methods and algorithms for applying functors * to [EMAIL PROTECTED] Collection Collections}. * - * @deprecated Replaced by, or to be replaced by org.apache.commons.functor.Algorithms * @version $Revision$ $Date$ * @author Rodney Waldhoff */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection IsEmpty.java
rwaldhoff2003/11/24 15:11:48 Modified:functor/src/test/org/apache/commons/functor/core/collection TestIsEmpty.java functor/src/java/org/apache/commons/functor/core/collection IsEmpty.java Log: support Maps in IsEmpty, add tests Revision ChangesPath 1.5 +13 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsEmpty.java Index: TestIsEmpty.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsEmpty.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestIsEmpty.java 24 Nov 2003 21:38:39 - 1.4 +++ TestIsEmpty.java 24 Nov 2003 23:11:48 - 1.5 @@ -58,8 +58,10 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import junit.framework.Test; @@ -137,8 +139,8 @@ public void testTestNonCollection() throws Exception { try { IsEmpty.instance().test(new Integer(3)); -fail(Expected ClassCastException); -} catch(ClassCastException e) { +fail(Expected IllegalArgumentException); +} catch(IllegalArgumentException e) { // expected } } @@ -153,6 +155,13 @@ public void testTestString() throws Exception { assertTrue(! IsEmpty.instance().test(xyzzy)); assertTrue(IsEmpty.instance().test()); +} + +public void testTestMap() throws Exception { +Map map = new HashMap(); +assertTrue(IsEmpty.instance().test(map)); +map.put(x,y); +assertTrue(! IsEmpty.instance().test(map)); } public void testEquals() throws Exception { 1.4 +14 -7 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsEmpty.java Index: IsEmpty.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsEmpty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- IsEmpty.java 24 Nov 2003 21:38:39 - 1.3 +++ IsEmpty.java 24 Nov 2003 23:11:48 - 1.4 @@ -59,6 +59,7 @@ import java.io.Serializable; import java.lang.reflect.Array; import java.util.Collection; +import java.util.Map; import org.apache.commons.functor.UnaryPredicate; @@ -78,15 +79,17 @@ public boolean test(Object obj) { if(obj instanceof Collection) { -return test((Collection)obj); +return testCollection((Collection)obj); +} else if(obj instanceof Map) { +return testMap((Map)obj); } else if(obj instanceof String) { -return test((String)obj); +return testString((String)obj); } else if(null != obj obj.getClass().isArray()) { return testArray(obj); } else if(null == obj){ throw new NullPointerException(Argument must not be null); } else { -throw new ClassCastException(Expected Collection, String or Array, found + obj); +throw new IllegalArgumentException(Expected Collection, Map, String or Array, found + obj.getClass()); } } @@ -111,11 +114,15 @@ return IsEmpty(); } -private boolean test(Collection col) { +private boolean testCollection(Collection col) { return col.isEmpty(); } -private boolean test(String str) { +private boolean testMap(Map map) { +return map.isEmpty(); +} + +private boolean testString(String str) { return 0 == str.length(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util IntegerRange.java
rwaldhoff2003/11/24 15:39:17 Modified:functor/src/test/org/apache/commons/functor/generator/util TestAll.java Added: functor/src/test/org/apache/commons/functor/generator/util TestIntegerRange.java functor/src/java/org/apache/commons/functor/generator/util IntegerRange.java Log: add IntegerRange and tests Revision ChangesPath 1.2 +3 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestAll.java 30 Jun 2003 11:00:13 - 1.1 +++ TestAll.java 24 Nov 2003 23:39:17 - 1.2 @@ -73,6 +73,7 @@ TestSuite suite = new TestSuite(); suite.addTest(TestEachElement.suite()); suite.addTest(TestNumberRange.suite()); +suite.addTest(TestIntegerRange.suite()); return suite; } } 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java Index: TestIntegerRange.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java,v 1.1 2003/11/24 23:39:17 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 [EMAIL PROTECTED] * * 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.generator.util; import junit.framework.Test; import junit.framework.TestSuite; import org.apache.commons.functor.BaseFunctorTest; /** * @version $Revision: 1.1 $ $Date: 2003/11/24 23:39:17 $ * @author Jason Horman ([EMAIL PROTECTED]) * @author Rodney Waldhoff */ public class TestIntegerRange extends BaseFunctorTest { // Conventional // public TestIntegerRange(String name) { super(name
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util LongRange.java IntegerRange.java
rwaldhoff2003/11/24 15:59:21 Modified:functor/src/test/org/apache/commons/functor/generator/util TestIntegerRange.java TestAll.java functor/src/java/org/apache/commons/functor/generator/util IntegerRange.java Added: functor/src/test/org/apache/commons/functor/generator/util TestLongRange.java functor/src/java/org/apache/commons/functor/generator/util LongRange.java Log: * add LongRange and tests * make range functions exclusive of the to endpoint, so that things like IntegerRange(Integer.MIN_VALUE,Integer.MAX_VALUE) can actually complete Revision ChangesPath 1.2 +12 -12 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java Index: TestIntegerRange.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestIntegerRange.java 24 Nov 2003 23:39:17 - 1.1 +++ TestIntegerRange.java 24 Nov 2003 23:59:21 - 1.2 @@ -124,34 +124,34 @@ public void testObjectConstructor() { IntegerRange range = new IntegerRange(new Integer(0), new Integer(5)); -assertEquals([0, 1, 2, 3, 4, 5], range.toCollection().toString()); +assertEquals([0, 1, 2, 3, 4], range.toCollection().toString()); range = new IntegerRange(new Integer(0), new Integer(5), new Integer(1)); -assertEquals([0, 1, 2, 3, 4, 5], range.toCollection().toString()); +assertEquals([0, 1, 2, 3, 4], range.toCollection().toString()); } public void testReverseStep() { IntegerRange range = new IntegerRange(10, 0, -2); -assertEquals([10, 8, 6, 4, 2, 0], range.toCollection().toString()); -assertEquals([10, 8, 6, 4, 2, 0], range.toCollection().toString()); +assertEquals([10, 8, 6, 4, 2], range.toCollection().toString()); +assertEquals([10, 8, 6, 4, 2], range.toCollection().toString()); } public void testStep() { IntegerRange range = new IntegerRange(0, 10, 2); -assertEquals([0, 2, 4, 6, 8, 10], range.toCollection().toString()); -assertEquals([0, 2, 4, 6, 8, 10], range.toCollection().toString()); +assertEquals([0, 2, 4, 6, 8], range.toCollection().toString()); +assertEquals([0, 2, 4, 6, 8], range.toCollection().toString()); } public void testForwardRange() { IntegerRange range = new IntegerRange(0, 5); -assertEquals([0, 1, 2, 3, 4, 5], range.toCollection().toString()); -assertEquals([0, 1, 2, 3, 4, 5], range.toCollection().toString()); +assertEquals([0, 1, 2, 3, 4], range.toCollection().toString()); +assertEquals([0, 1, 2, 3, 4], range.toCollection().toString()); } public void testReverseRange() { IntegerRange range = new IntegerRange(5, 0); -assertEquals([5, 4, 3, 2, 1, 0], range.toCollection().toString()); -assertEquals([5, 4, 3, 2, 1, 0], range.toCollection().toString()); +assertEquals([5, 4, 3, 2, 1], range.toCollection().toString()); +assertEquals([5, 4, 3, 2, 1], range.toCollection().toString()); } public void testEquals() { 1.3 +3 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestAll.java 24 Nov 2003 23:39:17 - 1.2 +++ TestAll.java 24 Nov 2003 23:59:21 - 1.3 @@ -74,6 +74,7 @@ suite.addTest(TestEachElement.suite()); suite.addTest(TestNumberRange.suite()); suite.addTest(TestIntegerRange.suite()); +suite.addTest(TestLongRange.suite()); return suite; } } 1.1 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java Index: TestLongRange.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java,v 1.1 2003/11/24 23:59:21 rwaldhoff Exp $ * * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util TestIntegerRange.java TestLongRange.java
rwaldhoff2003/11/24 16:01:15 Modified:functor/src/test/org/apache/commons/functor/generator/util TestIntegerRange.java TestLongRange.java Log: add test of edge case Revision ChangesPath 1.3 +8 -2 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java Index: TestIntegerRange.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestIntegerRange.java 24 Nov 2003 23:59:21 - 1.2 +++ TestIntegerRange.java 25 Nov 2003 00:01:15 - 1.3 @@ -154,6 +154,12 @@ assertEquals([5, 4, 3, 2, 1], range.toCollection().toString()); } +public void testEdgeCase() { +IntegerRange range = new IntegerRange(Integer.MAX_VALUE - 3, Integer.MAX_VALUE); +assertEquals([2147483644, 2147483645, 2147483646], range.toCollection().toString()); +assertEquals([2147483644, 2147483645, 2147483646], range.toCollection().toString()); +} + public void testEquals() { IntegerRange range = new IntegerRange(1, 5); assertObjectsAreEqual(range, range); 1.2 +3 -3 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java Index: TestLongRange.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestLongRange.java24 Nov 2003 23:59:21 - 1.1 +++ TestLongRange.java25 Nov 2003 00:01:15 - 1.2 @@ -154,7 +154,7 @@ assertEquals([5, 4, 3, 2, 1], range.toCollection().toString()); } -public void testLongRange() { +public void testEdgeCase() { LongRange range = new LongRange(Long.MAX_VALUE - 3L, Long.MAX_VALUE); assertEquals([9223372036854775804, 9223372036854775805, 9223372036854775806], range.toCollection().toString()); assertEquals([9223372036854775804, 9223372036854775805, 9223372036854775806], range.toCollection().toString()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core TestOffset.java TestAll.java
rwaldhoff2003/11/24 16:22:26 Modified:functor/src/test/org/apache/commons/functor/core TestAll.java Added: functor/src/java/org/apache/commons/functor/core Offset.java functor/src/test/org/apache/commons/functor/core TestOffset.java Log: add Offset and tests Revision ChangesPath 1.1 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/Offset.java Index: Offset.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/Offset.java,v 1.1 2003/11/25 00:22:26 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 [EMAIL PROTECTED] * * 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 org.apache.commons.functor.BinaryPredicate; import org.apache.commons.functor.Predicate; import org.apache.commons.functor.UnaryPredicate; /** * A predicate that returns codefalse/code * the first in/i times it is invoked, and * codetrue/code thereafter. * * @since 1.0 * @version $Revision: 1.1 $ $Date: 2003/11/25 00:22:26 $ * @author Jason Horman ([EMAIL PROTECTED]) * @author Rodney Waldhoff */ public final class Offset implements Predicate, UnaryPredicate, BinaryPredicate { public Offset(int count) { if(count 0) { throw new IllegalArgumentException(Argument must be a non-negative integer.); } this.min = count; } public boolean test() { // stop incremeting when we've hit max, so we don't loop around if(current min) { current++; return false; } else { return true; } } public boolean test(Object obj) { return test(); } public boolean test(Object a, Object b) { return test(); } public String toString() { return Offset + min + ; } // instance variables //--- private int min; private int current = 0; } 1.8 +3 -2 jakarta-commons-sandbox
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util MaxIterations.java
rwaldhoff2003/11/24 16:23:14 Modified:functor/src/java/org/apache/commons/functor/generator/util MaxIterations.java Log: deprecate MaxIterations Revision ChangesPath 1.2 +3 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java Index: MaxIterations.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MaxIterations.java30 Jun 2003 11:00:13 - 1.1 +++ MaxIterations.java25 Nov 2003 00:23:14 - 1.2 @@ -69,6 +69,7 @@ * Would only generate 1 line from the file. * * @since 1.0 + * @deprecated See Limit and Offset * @version $Revision$ $Date$ * @author Jason Horman ([EMAIL PROTECTED]) */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/primitives/xdocs faq.xml navigation.xml
rwaldhoff2003/11/17 13:00:44 Modified:primitives/xdocs faq.xml navigation.xml Log: update faq Revision ChangesPath 1.2 +12 -8 jakarta-commons/primitives/xdocs/faq.xml Index: faq.xml === RCS file: /home/cvs/jakarta-commons/primitives/xdocs/faq.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- faq.xml 16 Nov 2003 23:20:21 - 1.1 +++ faq.xml 17 Nov 2003 21:00:44 - 1.2 @@ -15,7 +15,7 @@ dd p The main advantage of the primitive collections is that they are signficantly smaller than their java.util equivalents. -How much smaller? Well, consider this table: +How much smaller? /p table border=1 cellspacing=0 tr @@ -82,26 +82,30 @@ data. /p p -In the pre-autoboxing (JDK 1.5) world, you may also find the primitive collections easier +Finally, in the pre-autoboxing (JDK 1.5) world, you may also find the primitive collections easier to work with, since you'll waste fewer keystrokes manually boxing and un-boxing the primitives and their Object wrappers. For instance, to sum an ArrayList of Integers, you might write something like: /p -preint sum = 0; +pre +int sum = 0; for(Iterator iter = list.iterator(); iter.hasNext(); ) { sum += ((Integer)(iter.next())).intValue(); -}/pre +} +/pre p The IntList equivalent would be: /p -preint sum = 0; +pre +int sum = 0; for(IntIterator iter = list.iterator(); iter.hasNext(); ) { sum += iter.next(); -}/pre +} +/pre /dd -dtQ: But isn't this overkill? Aren't the time and space efficiencies -insignificant for the size and number of collections used by most applications?/dt +dtQ: But aren't the time and space efficiencies insignificant for +the size and number of collections used by most applications?/dt dd p Yes. 1.3 +1 -0 jakarta-commons/primitives/xdocs/navigation.xml Index: navigation.xml === RCS file: /home/cvs/jakarta-commons/primitives/xdocs/navigation.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- navigation.xml27 Oct 2003 20:55:56 - 1.2 +++ navigation.xml17 Nov 2003 21:00:44 - 1.3 @@ -8,6 +8,7 @@ body menu name=Commons Primitives item name=Overview href=/index.html/ + item name=FAQ href=/faq.html/ /menu commons-nav; /body - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/primitives/xdocs faq.xml index.xml
rwaldhoff2003/11/16 15:20:21 Modified:primitives/xdocs index.xml Added: primitives/xdocs faq.xml Log: add basic FAQ Revision ChangesPath 1.7 +2 -1 jakarta-commons/primitives/xdocs/index.xml Index: index.xml === RCS file: /home/cvs/jakarta-commons/primitives/xdocs/index.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- index.xml 6 Nov 2003 00:55:23 - 1.6 +++ index.xml 16 Nov 2003 23:20:21 - 1.7 @@ -13,7 +13,7 @@ p Apache Jakarta Commons Primitives provides a collection of types and utilities optimized for working with Java primitives (boolean, byte, char, double, float, int, long, short). -Generally, the Commons-Primitives classes are faster, smaller and easier to work with than +Generally, the Commons-Primitives classes are smaller, faster and easier to work with than their purely Object based alternatives. /p /section @@ -75,6 +75,7 @@ p For more information on Commons Primitives, you might like to visit the +a href=faq.htmlFAQ/a, a href=./apidocs/index.htmlJavaDocs/a, a href=./project-info.htmlproject information/a or a href=./maven-reports.htmlproject reports/a. /p 1.1 jakarta-commons/primitives/xdocs/faq.xml Index: faq.xml === ?xml version=1.0? document properties titleCommons Primitives: FAQ/title author email=[EMAIL PROTECTED]Commons Documentation Team/author /properties body section name=The Primitives Component dl dtQ: Why would I use the primitive collections?/dt dd p The main advantage of the primitive collections is that they are signficantly smaller than their java.util equivalents. How much smaller? Well, consider this table: /p table border=1 cellspacing=0 tr thObject-based Collection/th thBytes per Element/th thPrimitive Collection/th thBytes per Element/th thSpace Savings/th /tr tr tdArrayList of Bytes/td td align=right16/td tdArrayByteList/td td align=right1/td td align=right93.4%/td /tr tr tdArrayList of Shorts/td td align=right16/td tdArrayShortList/td td align=right2/td td align=right87.5%/td /tr tr tdArrayList of Characters/td td align=right16/td tdArrayCharList/td td align=right4/td td align=right75.0%/td /tr tr tdArrayList of Floats/td td align=right16/td tdArrayFloatList/td td align=right4/td td align=right75.0%/td /tr tr tdArrayList of Integers/td td align=right16/td tdArrayIntist/td td align=right4/td td align=right75.0%/td /tr tr tdArrayList of Doubles/td td align=right16/td tdArrayDoubleList/td td align=right8/td td align=right50.0%/td /tr tr tdArrayList of Longs/td td align=right16/td tdArrayLongList/td td align=right8/td td align=right50.0%/td /tr /table p Depending upon your circumstances, you may also find the primitive collections to be faster, both because of the reduction in time spent boxing and un-boxing the primitives and their Object wrappers, and because there are fewer bytes to move around when copying or moving data. /p p In the pre-autoboxing (JDK 1.5) world, you may also find the primitive collections easier to work with, since you'll waste fewer keystrokes manually boxing and un-boxing the primitives and their Object wrappers. For instance, to sum an ArrayList of Integers, you might write something like: /p preint sum = 0; for(Iterator iter = list.iterator(); iter.hasNext(); ) { sum += ((Integer)(iter.next())).intValue(); }/pre p The IntList equivalent would be: /p preint sum = 0; for(IntIterator iter = list.iterator(); iter.hasNext(); ) { sum += iter.next(); }/pre /dd dtQ: But isn't this overkill? Aren't the time and space efficiencies insignificant for the size and number of collections used by most applications?/dt dd p Yes. /pp The primitive collections are most useful for applications that create very many or very large collections of primitive types, or that process them very frequently. /p /dd dtQ: Won't this functionality be available in JDK 1.5 using auto-boxing and generics?/dt dd p No. /pp Using generics, one can create collections that are specific to a particular Object from a templated implementation, for instance, a List of Integers or a List of Strings from the same prototype implemenation. Since the distinction between Java primitives and Java Objects is not going away, it will not be possible to, for example, instantiate a List of ints from that same prototype. /pp Using autoboxing, it will be possible to emulate the syntax of using the primitive
cvs commit: jakarta-commons/primitives project.properties
rwaldhoff2003/11/14 08:24:55 Modified:primitives project.properties Log: exclude protected classes from the javadocs Revision ChangesPath 1.3 +11 -1 jakarta-commons/primitives/project.properties Index: project.properties === RCS file: /home/cvs/jakarta-commons/primitives/project.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- project.properties29 Oct 2003 22:35:17 - 1.2 +++ project.properties14 Nov 2003 16:24:55 - 1.3 @@ -1,5 +1,15 @@ maven.checkstyle.properties=checkstyle.xml + maven.junit.fork=true + maven.xdoc.date = left maven.xdoc.poweredby.image=maven-feather.png -maven.javadoc.links=http://java.sun.com/products/jdk/1.4/docs/api \ No newline at end of file +maven.xdoc.version=${pom.currentVersion} + +maven.javadoc.links=http://java.sun.com/products/jdk/1.4/docs/api +maven.javadoc.author=false +maven.javadoc.public=true +maven.javadoc.protected=false +maven.javadoc.package=false +maven.javadoc.private=false + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite TestDoWhileProcedure.java TestWhileDoProcedure.java TestAll.java
rwaldhoff2003/11/11 15:36:00 Modified:functor/src/test/org/apache/commons/functor/core/composite TestAll.java Added: functor/src/java/org/apache/commons/functor/core/composite AbstractLoopProcedure.java WhileDoProcedure.java DoWhileProcedure.java functor/src/test/org/apache/commons/functor/core/composite TestDoWhileProcedure.java TestWhileDoProcedure.java Log: commit Herve's WhileDo and DoWhile procedures (with minor modifications) Revision ChangesPath 1.1 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java Index: AbstractLoopProcedure.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java,v 1.1 2003/11/11 23:36:00 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 [EMAIL PROTECTED] * * 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.composite; import org.apache.commons.functor.Predicate; import org.apache.commons.functor.Procedure; import java.io.Serializable; /** * Abstract base class for [EMAIL PROTECTED] WhileDoProcedure} and [EMAIL PROTECTED] DoWhileProcedure} * used to implement loop procedures. * p * @version $Revision: 1.1 $ $Date: 2003/11/11 23:36:00 $ * @author Herve Quiroz * @author Rodney Waldhoff */ public abstract class AbstractLoopProcedure implements Procedure, Serializable { protected AbstractLoopProcedure(Predicate condition, Procedure action) { this.condition=condition; this.action=action; } public boolean equals(Object object) { if (object instanceof AbstractLoopProcedure) { AbstractLoopProcedure that = (AbstractLoopProcedure)object; return (null == getCondition() ? null == that.getCondition() : getCondition().equals(that.getCondition())) (null == getAction() ? null == that.getAction() : getAction().equals(that.getAction())); } else
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite TestAbstractLoopProcedure.java TestAll.java
rwaldhoff2003/11/11 16:06:28 Modified:functor/src/java/org/apache/commons/functor/core/composite AbstractLoopProcedure.java functor/src/test/org/apache/commons/functor/core/composite TestAll.java Added: functor/src/test/org/apache/commons/functor/core/composite TestAbstractLoopProcedure.java Log: * add tests to restore 100% coverage * prevent NPE on hashCode() when children are null, add tests for that Revision ChangesPath 1.2 +120 -109 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java Index: AbstractLoopProcedure.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractLoopProcedure.java11 Nov 2003 23:36:00 - 1.1 +++ AbstractLoopProcedure.java12 Nov 2003 00:06:28 - 1.2 @@ -1,109 +1,120 @@ -/* - * $Header$ - * - * 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 [EMAIL PROTECTED] - * - * 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.composite; - -import org.apache.commons.functor.Predicate; -import org.apache.commons.functor.Procedure; - -import java.io.Serializable; - - -/** - * Abstract base class for [EMAIL PROTECTED] WhileDoProcedure} and [EMAIL PROTECTED] DoWhileProcedure} - * used to implement loop procedures. - * p - * @version $Revision$ $Date$ - * @author Herve Quiroz - * @author Rodney Waldhoff - */ -public abstract class AbstractLoopProcedure implements Procedure, Serializable { -protected AbstractLoopProcedure(Predicate condition, Procedure action) { -this.condition=condition; -this.action=action; -} - - public boolean equals(Object object) { - if (object instanceof AbstractLoopProcedure) { - AbstractLoopProcedure that = (AbstractLoopProcedure)object; - return (null == getCondition() ? null
cvs commit: jakarta-commons-sandbox/functor project.xml
rwaldhoff2003/11/11 16:14:23 Modified:functor project.xml Log: list Herve as a contributor Revision ChangesPath 1.5 +4 -0 jakarta-commons-sandbox/functor/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/project.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- project.xml 29 Jun 2003 20:04:06 - 1.4 +++ project.xml 12 Nov 2003 00:14:23 - 1.5 @@ -65,6 +65,10 @@ nameJason Horman/name emailjason AT jhorman DOT org/email /contributor + contributor + nameHerve Quiroz/name + emailherve DOT quiroz AT esil DOT univ DASH mrs DOT fr/email + /contributor /contributors dependencies - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor maven.xml
rwaldhoff2003/11/11 16:24:40 Modified:functor maven.xml Log: de-register checkstyle report for now, since the checkstyle config format has changed Revision ChangesPath 1.3 +5 -0 jakarta-commons-sandbox/functor/maven.xml Index: maven.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/maven.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- maven.xml 18 Feb 2003 22:14:56 - 1.2 +++ maven.xml 12 Nov 2003 00:24:40 - 1.3 @@ -8,4 +8,9 @@ maven:addPath id=maven-classpath refid=conf-classpath/ /preGoal +postGoal name=xdoc:register-reports + attainGoal name=maven-checkstyle-plugin:deregister/ + attainGoal name=maven-linkcheck-plugin:deregister/ +/postGoal + /project - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor maven.xml
rwaldhoff2003/11/11 16:34:02 Modified:functor maven.xml Log: register clover report Revision ChangesPath 1.4 +1 -0 jakarta-commons-sandbox/functor/maven.xml Index: maven.xml === RCS file: /home/cvs/jakarta-commons-sandbox/functor/maven.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- maven.xml 12 Nov 2003 00:24:40 - 1.3 +++ maven.xml 12 Nov 2003 00:34:02 - 1.4 @@ -11,6 +11,7 @@ postGoal name=xdoc:register-reports attainGoal name=maven-checkstyle-plugin:deregister/ attainGoal name=maven-linkcheck-plugin:deregister/ + attainGoal name=maven-clover-plugin:register/ /postGoal /project - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite WhileDoProcedure.java DoWhileProcedure.java
rwaldhoff2003/11/11 16:50:44 Modified:functor/src/java/org/apache/commons/functor/generator Generator.java functor/src/java/org/apache/commons/functor Algorithms.java functor/src/java/org/apache/commons/functor/generator/util NumberRange.java functor/src/java/org/apache/commons/functor/core/composite WhileDoProcedure.java DoWhileProcedure.java Log: javadoc fixes Revision ChangesPath 1.4 +10 -10 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Generator.java17 Jul 2003 22:44:45 - 1.3 +++ Generator.java12 Nov 2003 00:50:44 - 1.4 @@ -75,23 +75,23 @@ public abstract void stop(); /** Check if the generator is stopped. */ public abstract boolean isStopped(); -/** See [EMAIL PROTECTED] Algorithms#apply}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#apply}. */ public abstract Generator apply(UnaryFunction func); -/** See [EMAIL PROTECTED] Algorithms#contains}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#contains}. */ public abstract boolean contains(UnaryPredicate pred); -/** See [EMAIL PROTECTED] Algorithms#detect}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#detect}. */ public abstract Object detect(UnaryPredicate pred); -/** See [EMAIL PROTECTED] Algorithms#detect}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#detect}. */ public abstract Object detect(UnaryPredicate pred, Object ifNone); /** Synonym for run. */ public abstract void foreach(UnaryProcedure proc); -/** See [EMAIL PROTECTED] Algorithms#inject}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#inject}. */ public abstract Object inject(Object seed, BinaryFunction func); -/** See [EMAIL PROTECTED] Algorithms#reject}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#reject}. */ public abstract Generator reject(UnaryPredicate pred); -/** See [EMAIL PROTECTED] Algorithms#select}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#select}. */ public abstract Generator select(UnaryPredicate pred); -/** See [EMAIL PROTECTED] Algorithms#until}. */ +/** See [EMAIL PROTECTED] org.apache.commons.functor.Algorithms#until}. */ public abstract Generator until(UnaryPredicate pred); /** * [EMAIL PROTECTED] Transformer Transforms} this generator using the passed in 1.6 +19 -19 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java Index: Algorithms.java === RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Algorithms.java 17 Jul 2003 22:44:45 - 1.5 +++ Algorithms.java 12 Nov 2003 00:50:44 - 1.6 @@ -65,10 +65,10 @@ import org.apache.commons.functor.generator.IteratorToGeneratorAdapter; /** - * Utility methods and algorithms for applying functors to [EMAIL PROTECTED] IfaceGenerator}s. - * [EMAIL PROTECTED] IfaceGenerator}s also define these utility methods as instance methods. The + * Utility methods and algorithms for applying functors to [EMAIL PROTECTED] Generator}s. + * [EMAIL PROTECTED] Generator}s also define these utility methods as instance methods. The * [EMAIL PROTECTED] #apply}, [EMAIL PROTECTED] #select}, and [EMAIL PROTECTED] #reject} methods return new - * IfaceGenerators. This becomes useful for constructing nested expressions. For + * Generators. This becomes useful for constructing nested expressions. For * example: * * pre @@ -94,7 +94,7 @@ } /** - * Returns a [EMAIL PROTECTED] IfaceGenerator} that will apply the given [EMAIL PROTECTED] UnaryFunction} to each + * Returns a [EMAIL PROTECTED] Generator} that will apply the given [EMAIL PROTECTED] UnaryFunction} to each * generated element. */ public static final Generator apply(final Generator gen, final UnaryFunction func) { @@ -117,10 +117,10 @@ } /** - * Return codetrue/code if some element in the given [EMAIL PROTECTED] IfaceGenerator} + * Return codetrue/code if some element in the given [EMAIL PROTECTED] Generator
cvs commit: jakarta-commons/primitives maven.xml
rwaldhoff2003/11/11 16:56:29 Modified:primitives maven.xml Log: register clover report Revision ChangesPath 1.3 +1 -0 jakarta-commons/primitives/maven.xml Index: maven.xml === RCS file: /home/cvs/jakarta-commons/primitives/maven.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- maven.xml 27 Oct 2003 20:55:56 - 1.2 +++ maven.xml 12 Nov 2003 00:56:29 - 1.3 @@ -3,6 +3,7 @@ postGoal name=xdoc:register-reports attainGoal name=maven-checkstyle-plugin:deregister/ attainGoal name=maven-linkcheck-plugin:deregister/ +attainGoal name=maven-clover-plugin:register/ /postGoal /project - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/primitives ArrayCharList.java RandomAccessLongList.java FloatCollection.java ByteCollection.java ShortIterator.java ArrayUnsignedShortList.java AbstractCharCollection.java RandomAccessDoubleList.java ShortList.java CharIterator.java LongIterator.java IntList.java RandomAccessCharList.java FloatListIterator.java ByteListIterator.java FloatIterator.java RandomAccessFloatList.java ShortListIterator.java AbstractIntCollection.java package.html DoubleCollection.java IntListIterator.java AbstractShortCollection.java LongList.java ByteIterator.java AbstractFloatCollection.java RandomAccessShortList.java ArrayShortList.java ByteList.java ArrayLongList.java FloatList.java RandomAccessByteList.java IntCollections.java DoubleListIterator.java IntCollection.java DoubleIterator.java CharList.java DoubleList.java LongListIterator.java ArrayUnsignedIntList.java ArrayDoubleList.java AbstractLongCollection.java LongCollection.java ArrayFloatList.java CharCollection.java ShortCollection.java ArrayIntList.java AbstractByteCollection.java IntIterator.java ArrayByteList.java CharListIterator.java RandomAccessIntList.java ArrayUnsignedByteList.java AbstractDoubleCollection.java
rwaldhoff2003/11/07 09:24:15 Modified:collections/src/java/org/apache/commons/collections/primitives ArrayCharList.java RandomAccessLongList.java FloatCollection.java ByteCollection.java ShortIterator.java ArrayUnsignedShortList.java AbstractCharCollection.java RandomAccessDoubleList.java ShortList.java CharIterator.java LongIterator.java IntList.java RandomAccessCharList.java FloatListIterator.java ByteListIterator.java FloatIterator.java RandomAccessFloatList.java ShortListIterator.java AbstractIntCollection.java package.html DoubleCollection.java IntListIterator.java AbstractShortCollection.java LongList.java ByteIterator.java AbstractFloatCollection.java RandomAccessShortList.java ArrayShortList.java ByteList.java ArrayLongList.java FloatList.java RandomAccessByteList.java IntCollections.java DoubleListIterator.java IntCollection.java DoubleIterator.java CharList.java DoubleList.java LongListIterator.java ArrayUnsignedIntList.java ArrayDoubleList.java AbstractLongCollection.java LongCollection.java ArrayFloatList.java CharCollection.java ShortCollection.java ArrayIntList.java AbstractByteCollection.java IntIterator.java ArrayByteList.java CharListIterator.java RandomAccessIntList.java ArrayUnsignedByteList.java AbstractDoubleCollection.java Log: deprecate stuff moved to and released from commons-primitives Revision ChangesPath 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ArrayCharList.java Index: ArrayCharList.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ArrayCharList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ArrayCharList.java31 Aug 2003 17:21:14 - 1.2 +++ ArrayCharList.java7 Nov 2003 17:24:13 - 1.3 @@ -69,6 +69,8 @@ * @since Commons Collections 2.2 * @version $Revision$ $Date$ * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @author Rodney Waldhoff */ public class ArrayCharList extends RandomAccessCharList implements CharList, Serializable { 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/RandomAccessLongList.java Index: RandomAccessLongList.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/RandomAccessLongList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RandomAccessLongList.java 31 Aug 2003 17:21:14 - 1.2 +++ RandomAccessLongList.java 7 Nov 2003 17:24:13 - 1.3 @@ -76,6 +76,8 @@ * @since Commons Collections 2.2 * @version $Revision$ $Date$ * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @author Rodney Waldhoff */ public abstract class RandomAccessLongList extends AbstractLongCollection implements LongList { 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/FloatCollection.java Index: FloatCollection.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/FloatCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FloatCollection.java 31 Aug 2003 17:21:15 - 1.2 +++ FloatCollection.java 7 Nov 2003 17:24:13 - 1.3 @@ -66,6 +66,8 @@ * @since Commons Collections 2.2 * @version $Revision$ $Date$ * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @author Rodney Waldhoff */ public interface FloatCollection { 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ByteCollection.java Index: ByteCollection.java
cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io ReaderCharIterator.java ByteIteratorInputStream.java InputStreamByteIterator.java CharIteratorReader.java
rwaldhoff2003/11/07 12:13:05 Modified: collections/src/java/org/apache/commons/collections/primitives/adapters/io ReaderCharIterator.java ByteIteratorInputStream.java InputStreamByteIterator.java CharIteratorReader.java Log: deprecate stuff moved to and released from commons-primitives Revision ChangesPath 1.4 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/ReaderCharIterator.java Index: ReaderCharIterator.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/ReaderCharIterator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ReaderCharIterator.java 31 Aug 2003 17:21:21 - 1.3 +++ ReaderCharIterator.java 7 Nov 2003 20:13:05 - 1.4 @@ -66,6 +66,8 @@ /** * Adapts a [EMAIL PROTECTED] Reader} to the [EMAIL PROTECTED] CharIterator} interface. * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/ByteIteratorInputStream.java Index: ByteIteratorInputStream.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/ByteIteratorInputStream.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ByteIteratorInputStream.java 31 Aug 2003 17:21:21 - 1.2 +++ ByteIteratorInputStream.java 7 Nov 2003 20:13:05 - 1.3 @@ -64,6 +64,8 @@ /** * Adapts an [EMAIL PROTECTED] ByteIterator} to the [EMAIL PROTECTED] InputStream} interface. * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ 1.4 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/InputStreamByteIterator.java Index: InputStreamByteIterator.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/InputStreamByteIterator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- InputStreamByteIterator.java 31 Aug 2003 17:21:21 - 1.3 +++ InputStreamByteIterator.java 7 Nov 2003 20:13:05 - 1.4 @@ -66,6 +66,8 @@ /** * Adapts an [EMAIL PROTECTED] InputStream} to the [EMAIL PROTECTED] ByteIterator} interface. * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/CharIteratorReader.java Index: CharIteratorReader.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/io/CharIteratorReader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CharIteratorReader.java 31 Aug 2003 17:21:21 - 1.2 +++ CharIteratorReader.java 7 Nov 2003 20:13:05 - 1.3 @@ -64,6 +64,8 @@ /** * Adapts a [EMAIL PROTECTED] CharIterator} to the [EMAIL PROTECTED] Reader} interface. * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators ProxyIntIterator.java NonSerializableUnmodifiableIntList.java UnmodifiableIntList.java UnmodifiableIntIterator.java ProxyIntListIterator.java BaseProxyIntList.java BaseUnmodifiableIntList.java UnmodifiableIntListIterator.java BaseProxyIntCollection.java
rwaldhoff2003/11/07 12:17:13 Modified: collections/src/java/org/apache/commons/collections/primitives/decorators ProxyIntIterator.java NonSerializableUnmodifiableIntList.java UnmodifiableIntList.java UnmodifiableIntIterator.java ProxyIntListIterator.java BaseProxyIntList.java BaseUnmodifiableIntList.java UnmodifiableIntListIterator.java BaseProxyIntCollection.java Log: deprecate stuff moved to and released from commons-primitives Revision ChangesPath 1.4 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntIterator.java Index: ProxyIntIterator.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntIterator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ProxyIntIterator.java 31 Aug 2003 17:21:20 - 1.3 +++ ProxyIntIterator.java 7 Nov 2003 20:17:13 - 1.4 @@ -61,6 +61,8 @@ /** * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @since Commons Collections 2.2 * @version $Revision$ $Date$ * 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/NonSerializableUnmodifiableIntList.java Index: NonSerializableUnmodifiableIntList.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/NonSerializableUnmodifiableIntList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NonSerializableUnmodifiableIntList.java 31 Aug 2003 17:21:20 - 1.2 +++ NonSerializableUnmodifiableIntList.java 7 Nov 2003 20:17:13 - 1.3 @@ -61,6 +61,8 @@ /** * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @since Commons Collections 2.2 * @version $Revision$ $Date$ * 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableIntList.java Index: UnmodifiableIntList.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableIntList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- UnmodifiableIntList.java 31 Aug 2003 17:21:20 - 1.2 +++ UnmodifiableIntList.java 7 Nov 2003 20:17:13 - 1.3 @@ -63,6 +63,8 @@ /** * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @since Commons Collections 2.2 * @version $Revision$ $Date$ * 1.3 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableIntIterator.java Index: UnmodifiableIntIterator.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableIntIterator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- UnmodifiableIntIterator.java 31 Aug 2003 17:21:20 - 1.2 +++ UnmodifiableIntIterator.java 7 Nov 2003 20:17:13 - 1.3 @@ -61,6 +61,8 @@ /** * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @since Commons Collections 2.2 * @version $Revision$ $Date$ * 1.4 +4 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntListIterator.java Index: ProxyIntListIterator.java === RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntListIterator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ProxyIntListIterator.java 31 Aug 2003 17:21:20 - 1.3 +++ ProxyIntListIterator.java 7 Nov 2003 20:17:13 - 1.4 @@ -62,6 +62,8 @@ /** * + * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) + * * @since Commons Collections 2.2 * @version $Revision$ $Date
cvs commit: jakarta-commons/primitives/xdocs index.xml
rwaldhoff2003/11/05 16:55:23 Modified:primitives/xdocs index.xml Log: add link to 1.0 release Revision ChangesPath 1.6 +4 -4 jakarta-commons/primitives/xdocs/index.xml Index: index.xml === RCS file: /home/cvs/jakarta-commons/primitives/xdocs/index.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- index.xml 29 Oct 2003 22:00:29 - 1.5 +++ index.xml 6 Nov 2003 00:55:23 - 1.6 @@ -20,12 +20,12 @@ section name=Status p -Commons Primitives has not yet had a formal release. +The most recent stable release is version 1.0, released 5 November 2003. +a href=http://jakarta.apache.org/site/binindex.cgi#commons-primitives;Binary/a and +a href=http://jakarta.apache.org/site/sourceindex.cgi#commons-primitives;source/a distributions are available. +/pp Daily builds and tarballs are available from a href=http://cvs.apache.org/builds/jakarta-commons/nightly/commons-primitives/;http://cvs.apache.org/builds/jakarta-commons/nightly/commons-primitives//a. -/pp -The current codebase is stable and a href=./cloverwell-tested/a -nevertheless. A 1.0 release is expected real soon now. /p /section - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/primitives project.xml build.xml
rwaldhoff2003/11/05 17:06:58 Modified:primitives project.xml build.xml Log: update version number to 2.0-dev Revision ChangesPath 1.10 +1 -1 jakarta-commons/primitives/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/primitives/project.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- project.xml 5 Nov 2003 23:21:47 - 1.9 +++ project.xml 6 Nov 2003 01:06:58 - 1.10 @@ -3,7 +3,7 @@ extend../xdocs/maven/project-base.xml/extend idcommons-primitives/id nameCommons Primitives/name - currentVersion1.0/currentVersion + currentVersion2.0-dev/currentVersion inceptionYear2002/inceptionYear packageorg.apache.commons.collections.primitives/package 1.8 +2 -2 jakarta-commons/primitives/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-commons/primitives/build.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- build.xml 5 Nov 2003 23:21:47 - 1.7 +++ build.xml 6 Nov 2003 01:06:58 - 1.8 @@ -43,7 +43,7 @@ property name=component.title value=Primitive type utilities/ !-- The current version number of this component -- - property name=component.version value=1.0/ + property name=component.version value=2.0-dev/ !-- The final name of the component -- property name=final.name value=commons-${component.name}-${component.version}/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]