svn commit: r644305 - /commons/proper/lang/trunk/RELEASE-NOTES.txt
Author: ggregory Date: Thu Apr 3 06:24:42 2008 New Revision: 644305 URL: http://svn.apache.org/viewvc?rev=644305view=rev Log: fix typo. Modified: commons/proper/lang/trunk/RELEASE-NOTES.txt Modified: commons/proper/lang/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/RELEASE-NOTES.txt?rev=644305r1=644304r2=644305view=diff == --- commons/proper/lang/trunk/RELEASE-NOTES.txt (original) +++ commons/proper/lang/trunk/RELEASE-NOTES.txt Thu Apr 3 06:24:42 2008 @@ -79,7 +79,7 @@ * [LANG-353] - Javadoc Example for EqualsBuilder is questionable * [LANG-360] - Why does appendIdentityToString return null? * [LANG-361] - BooleanUtils toBooleanObject javadoc does not match implementation -* [LANG-363] - StringEscapeUtils..escapeJavaScript() method did not escape '/' into '\/', it will make IE render page incorrectly +* [LANG-363] - StringEscapeUtils.escapeJavaScript() method did not escape '/' into '\/', it will make IE render page incorrectly * [LANG-364] - Documentation bug for ignoreEmptyTokens accessors in StrTokenizer * [LANG-365] - BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException * [LANG-367] - FastDateFormat thread safety
svn commit: r644319 - /commons/sandbox/functor/trunk/build.xml
Author: mbenson Date: Thu Apr 3 06:58:44 2008 New Revision: 644319 URL: http://svn.apache.org/viewvc?rev=644319view=rev Log: Ant w/ jdk 1.3 Modified: commons/sandbox/functor/trunk/build.xml Modified: commons/sandbox/functor/trunk/build.xml URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/build.xml?rev=644319r1=644318r2=644319view=diff == --- commons/sandbox/functor/trunk/build.xml (original) +++ commons/sandbox/functor/trunk/build.xml Thu Apr 3 06:58:44 2008 @@ -83,14 +83,30 @@ !-- == Test Execution Defaults === -- + available property=dom.available classname=w3c.dom.Node / + + fileset id=xmlLibs dir=${ant.home}/lib +include name=xml-apis.jar unless=dom.available / +include name=xercesImpl.jar unless=dom.available / + /fileset !-- Construct unit test classpath -- path id=test.classpath pathelement location=${build.home}/classes/ pathelement location=${build.home}/test-classes/ pathelement location=${test.home}/ +fileset refid=xmlLibs / /path + echotest.classpath=${toString:test.classpath}/echo + + condition property=junitReport value=true +and + isset property=dom.available / + available classname=org.apache.xalan.processor.TransformerFactoryImpl/ +/and + /condition + property name=test.entry value=org.apache.commons.functor.TestAll/ property name=junit.fork value=true / @@ -196,7 +212,7 @@ /target - target name=run-reports + target name=run-reports if=junitReport junitreport todir=${build.home}/junit-reports fileset dir=${build.home}/junit-reports/xml includes=TEST-*.xml / report format=frames todir=${build.home}/junit-reports /
svn commit: r644327 - /commons/sandbox/functor/trunk/
Author: sebb Date: Thu Apr 3 07:29:33 2008 New Revision: 644327 URL: http://svn.apache.org/viewvc?rev=644327view=rev Log: Ignore .settings (Eclipse) Modified: commons/sandbox/functor/trunk/ (props changed) Propchange: commons/sandbox/functor/trunk/ -- --- svn:ignore (original) +++ svn:ignore Thu Apr 3 07:29:33 2008 @@ -1,5 +1,6 @@ .classpath .project +.settings build.properties dist target
svn commit: r644342 - /commons/sandbox/functor/trunk/build.xml
Author: mbenson Date: Thu Apr 3 08:04:21 2008 New Revision: 644342 URL: http://svn.apache.org/viewvc?rev=644342view=rev Log: try again to get junitreport working when possible Modified: commons/sandbox/functor/trunk/build.xml Modified: commons/sandbox/functor/trunk/build.xml URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/build.xml?rev=644342r1=644341r2=644342view=diff == --- commons/sandbox/functor/trunk/build.xml (original) +++ commons/sandbox/functor/trunk/build.xml Thu Apr 3 08:04:21 2008 @@ -83,11 +83,11 @@ !-- == Test Execution Defaults === -- - available property=dom.available classname=w3c.dom.Node / + available property=jre.dom.available classname=java.lang.CharSequence / fileset id=xmlLibs dir=${ant.home}/lib -include name=xml-apis.jar unless=dom.available / -include name=xercesImpl.jar unless=dom.available / +include name=xml-apis.jar unless=jre.dom.available / +include name=xercesImpl.jar unless=jre.dom.available / /fileset !-- Construct unit test classpath -- @@ -98,14 +98,8 @@ fileset refid=xmlLibs / /path - echotest.classpath=${toString:test.classpath}/echo - - condition property=junitReport value=true -and - isset property=dom.available / - available classname=org.apache.xalan.processor.TransformerFactoryImpl/ -/and - /condition + available property=xalan.available + classname=org.apache.xalan.processor.TransformerFactoryImpl/ property name=test.entry value=org.apache.commons.functor.TestAll/ @@ -212,7 +206,7 @@ /target - target name=run-reports if=junitReport + target name=run-reports if=xalan.available junitreport todir=${build.home}/junit-reports fileset dir=${build.home}/junit-reports/xml includes=TEST-*.xml / report format=frames todir=${build.home}/junit-reports /
svn commit: r644467 - /commons/sandbox/functor/trunk/checkstyle.xml
Author: mbenson Date: Thu Apr 3 13:17:54 2008 New Revision: 644467 URL: http://svn.apache.org/viewvc?rev=644467view=rev Log: tighten checkstyle rules Modified: commons/sandbox/functor/trunk/checkstyle.xml Modified: commons/sandbox/functor/trunk/checkstyle.xml URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/checkstyle.xml?rev=644467r1=644466r2=644467view=diff == --- commons/sandbox/functor/trunk/checkstyle.xml (original) +++ commons/sandbox/functor/trunk/checkstyle.xml Thu Apr 3 13:17:54 2008 @@ -39,5 +39,30 @@ module name=JavadocMethod property name=allowUndeclaredRTE value=true/ /module - /module + +!-- Checks for whitespace -- +!-- See http://checkstyle.sf.net/config_whitespace.html -- +module name=EmptyForIteratorPad/ +module name=NoWhitespaceAfter + !-- not ARRAY_INIT -- + property name=tokens value=BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS / +/module + +module name=NoWhitespaceBefore/ +module name=OperatorWrap/ +module name=TabCharacter/ +module name=WhitespaceAfter/ +module name=WhitespaceAround/ + +module name=GenericIllegalRegexp + property name=format value=\s+$/ + property name=message value=Line has trailing spaces./ +/module +module name=UpperEll/ + +module name=DeclarationOrder / +module name=ModifierOrder / + + /module + /module
svn commit: r644470 [7/7] - in /commons/sandbox/functor/trunk/src: main/java/org/apache/commons/functor/ main/java/org/apache/commons/functor/adapter/ main/java/org/apache/commons/functor/core/ main/j
Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java?rev=644470r1=644469r2=644470view=diff == --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java Thu Apr 3 13:23:16 2008 @@ -31,25 +31,25 @@ /** * Examples of binary search implementations. - * + * * A binary search algorithm is the same strategy used in * that number guessing game, where one player picks a number * between 1 and 100, and the second player tries to guess it. * Each time the second player guesses a number, the first player * tells whether the chosen number is higher, lower or equal to * the guess. - * + * * An effective strategy for this sort of game is always guess - * the midpoint between what you know to be the lowest and + * the midpoint between what you know to be the lowest and * highest possible number. This will find the number in * log2(N) guesses (when N = 100, this is at most 7 guesses). - * + * * For example, suppose the first player (secretly) picks the * number 63. The guessing goes like this: - * - * P1 I'm thinking of a number between 1 and 100. + * + * P1 I'm thinking of a number between 1 and 100. * P2 Is it 50? - * P1 Higher. + * P1 Higher. * P2 75? * P1 Lower. * P2 62? @@ -62,13 +62,13 @@ * P1 That's it. * * Dave Thomas's Kata Two asks us to implement a binary search algorithm - * in several ways. Here we'll use this as an opportunity to - * consider some common approaches and explore - * some functor based approaches as well. - * + * in several ways. Here we'll use this as an opportunity to + * consider some common approaches and explore + * some functor based approaches as well. + * * See http://pragprog.com/pragdave/Practices/Kata/KataTwo.rdoc,v * for more information on this Kata. - * + * * @version $Revision$ $Date$ * @author Rodney Waldhoff */ @@ -82,10 +82,10 @@ } /** - * This is Dave's test case, plus + * This is Dave's test case, plus * a quick check of searching a fairly large - * list, just to make sure the time and space - * requirements are reasonable. + * list, just to make sure the time and space + * requirements are reasonable. */ private void chopTest(BinaryChop chopper) { assertEquals(-1, chopper.find(3, new int[0])); @@ -119,9 +119,9 @@ } /** - * In practice, one would most likely use the - * binary search method already available in - * java.util.Collections, but that's not + * In practice, one would most likely use the + * binary search method already available in + * java.util.Collections, but that's not * really the point of this exercise. */ public void testBuiltIn() { @@ -130,25 +130,25 @@ int result = Collections.binarySearch(list,seeking); // // Collections.binarySearch is a bit smarter than our -// find. It returns +// find. It returns // (-(insertionPoint) - 1) // when the value is not found, rather than // simply -1. // -return result = 0 ? result : -1; +return result = 0 ? result : -1; } }); } /** * Here's a basic iterative approach. - * + * * We set the lower or upper bound to the midpoint * until there's only one element between the lower * and upper bound. Then the lower bound is where * the element would be found if it existed in the * list. - * + * * We add an additional comparision at the end so * that we can return -1 if the element is not yet * in the list. @@ -174,54 +174,54 @@ /* * At http://onestepback.org/index.cgi/Tech/Programming/Kata/KataTwoVariation1.rdoc, * Jim Weirich discusses Kata Two from the perspective of loop invariants. - * + * * Loop invariants provide a way of deductive reasoning about loops. - * + * * Let P, Q. and R be predicates and A and B be * procedures. Note that if: - * assert(P.test()); - * A.run(); + * assert(P.test()); + * A.run(); * assert(Q.test()); - * and - * assert(Q.test()); - * B.run(); + * and + * assert(Q.test()); + * B.run(); * assert(R.test()); * are both valid, then: - * assert(P.test()); - * A.run(); - * B.run(); + * assert(P.test()); +
svn commit: r644480 [3/3] - in /commons/sandbox/functor/trunk/src: main/java/org/apache/commons/functor/ main/java/org/apache/commons/functor/adapter/ main/java/org/apache/commons/functor/core/ main/j
Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java?rev=644480r1=644479r2=644480view=diff == --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java Thu Apr 3 13:43:29 2008 @@ -126,7 +126,7 @@ public void testSortSingleValueList() { List list = new ArrayList(); -for(int i = 0; i 10; i++) { +for (int i = 0; i 10; i++) { list.add(element); } List sorted = quicksort(list); @@ -147,7 +147,7 @@ */ public void testSortSorted() { List list = new ArrayList(); -for(int i = 0; i 10; i++) { +for (int i = 0; i 10; i++) { list.add(new Integer(i)); } @@ -170,7 +170,7 @@ public void testSortReversed() { List expected = new ArrayList(); List tosort = new ArrayList(); -for(int i = 0; i 10; i++) { +for (int i = 0; i 10; i++) { /* * The expected list contains the integers in order. */ @@ -189,7 +189,7 @@ */ public void testSortShuffled() { List expected = new ArrayList(); -for(int i = 0; i 10; i++) { +for (int i = 0; i 10; i++) { expected.add(new Integer(i)); } List tosort = new ArrayList(expected); @@ -207,7 +207,7 @@ * populate a list with random integers */ List tosort = new ArrayList(); -for(int i = 0; i 10; i++) { +for (int i = 0; i 10; i++) { tosort.add(new Integer(random.nextInt(10))); } /* @@ -244,13 +244,13 @@ /* * Repeat this COUNT times: */ -for(int i = 0; i COUNT; i++) { +for (int i = 0; i COUNT; i++) { /* * Create a List of size SIZE, and * populate it with random integers: */ List tosort = new ArrayList(SIZE); -for(int j = 0; j SIZE; j++) { +for (int j = 0; j SIZE; j++) { tosort.add(new Integer(random.nextInt(SIZE))); } @@ -283,7 +283,7 @@ */ /* -double avgmillis = ((double)elapsed) / ((double)COUNT); +double avgmillis = ((double) elapsed) / ((double) COUNT); System.out.println(); System.out.println( @@ -356,7 +356,7 @@ * sorted list we're generating. */ result.addAll( -(List)quicksort.evaluate( +(List) quicksort.evaluate( lesserTail.evaluate( head.evaluate(list), tail.evaluate(list; @@ -370,7 +370,7 @@ * sorted list we're generating. */ result.addAll( -(List)quicksort.evaluate( +(List) quicksort.evaluate( greaterTail.evaluate( head.evaluate(list), tail.evaluate(list; @@ -395,9 +395,9 @@ public abstract Object evaluate(List list); public Object evaluate(Object obj) { -if(obj instanceof List) { -return evaluate((List)obj); -} else if(null == obj) { +if (obj instanceof List) { +return evaluate((List) obj); +} else if (null == obj) { throw new NullPointerException(The argument must not be null.); } else { throw new ClassCastException( @@ -416,11 +416,11 @@ public abstract Object evaluate(Object head, List tail); public Object evaluate(Object left, Object right) { -if(left != null right instanceof List) { -return evaluate(left, (List)right); -} else if(null == left) { +if (left != null right instanceof List) { +return evaluate(left, (List) right); +} else if (null == left) { throw new NullPointerException(The left argument must not be null.); -} else if(null == right) { +} else if (null == right) { throw new NullPointerException(The right argument must not be null.); } else { throw new ClassCastException( @@ -463,7 +463,7 @@ public Object evaluate(Object head, List tail) { return Algorithms.collect(Algorithms.select( tail.iterator(), -
svn commit: r644563 - in /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor: adapter/ core/ core/collection/ core/comparator/ core/composite/
Author: mbenson Date: Thu Apr 3 16:36:48 2008 New Revision: 644563 URL: http://svn.apache.org/viewvc?rev=644563view=rev Log: checkstyle Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BoundProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightPredicate.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Identity.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/RightIdentity.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsEmpty.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java?rev=644563r1=644562r2=644563view=diff == --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java Thu Apr 3 16:36:48 2008 @@ -38,6 +38,27 @@ * @author Rodney Waldhoff */ public final class BinaryFunctionBinaryProcedure implements BinaryProcedure, Serializable { + +/** + * Adapt the given, possibly-codenull/code, + * [EMAIL PROTECTED] BinaryFunction BinaryFunction} to the + * [EMAIL PROTECTED] BinaryProcedure BinaryProcedure} interface. + * When the given codeBinaryFunction/code is codenull/code, + * returns codenull/code. + * + * @param function the possibly-codenull/code + *[EMAIL PROTECTED] BinaryFunction BinaryFunction} to adapt + * @return a codeBinaryFunctionBinaryProcedure/code wrapping the given + * [EMAIL PROTECTED] BinaryFunction BinaryFunction}, or codenull/code + * if the given codeBinaryFunction/code is codenull/code + */ +public static BinaryFunctionBinaryProcedure adapt(BinaryFunction function) { +return null == function ? null : new BinaryFunctionBinaryProcedure(function); +} + +/** The [EMAIL PROTECTED] BinaryFunction BinaryFunction} I'm wrapping. */ +private BinaryFunction function = null; + /** * Create an [EMAIL PROTECTED] BinaryProcedure BinaryProcedure} wrapping * the given [EMAIL PROTECTED] BinaryFunction BinaryFunction}. @@ -52,9 +73,12 @@ * ignore its returned value. */ public void run(Object left, Object right) { -function.evaluate(left,right); +function.evaluate(left, right); } +/** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { if (that instanceof BinaryFunctionBinaryProcedure) { return equals((BinaryFunctionBinaryProcedure) that); @@ -63,10 +87,19 @@ } } +/** + * Learn whether a given BinaryFunctionBinaryPredicate is equal to this. + * @param that BinaryFunctionBinaryPredicate to compare + * @return boolean + */ public boolean equals(BinaryFunctionBinaryProcedure that) { -