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=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java 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(), - IsLessThan.instance((Comparable)head))); + IsLessThan.instance((Comparable) head))); } }; @@ -476,7 +476,7 @@ public Object evaluate(Object head, List tail) { return Algorithms.collect(Algorithms.select( tail.iterator(), - IsGreaterThanOrEqual.instance((Comparable)head))); + IsGreaterThanOrEqual.instance((Comparable) head))); } }; @@ -530,14 +530,14 @@ public void testLesserTail() { List list = new ArrayList(); - for(int i=0;i<10;i++) { + for (int i=0;i<10;i++) { list.add(new Integer(i)); } - for(int i=0;i<10;i++) { + for (int i=0;i<10;i++) { Integer val = new Integer(i); - List lesser = (List)lesserTail.evaluate(val,list); + List lesser = (List) lesserTail.evaluate(val,list); assertEquals(i,lesser.size()); - for(int j=0;j<i;j++) { + for (int j=0;j<i;j++) { assertEquals(new Integer(j),lesser.get(j)); } } @@ -545,14 +545,14 @@ public void testGreaterTail() { List list = new ArrayList(); - for(int i=0;i<10;i++) { + for (int i=0;i<10;i++) { list.add(new Integer(i)); } - for(int i=0;i<10;i++) { + for (int i=0;i<10;i++) { Integer val = new Integer(i); - List greater = (List)greaterTail.evaluate(val,list); + List greater = (List) greaterTail.evaluate(val,list); assertEquals(10-i,greater.size()); - for(int j=i;j<10;j++) { + for (int j=i;j<10;j++) { assertEquals(new Integer(j),greater.get(j-i)); } }
Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/Abs.java Thu Apr 3 13:43:29 2008 @@ -27,7 +27,7 @@ */ public final class Abs implements UnaryFunction { public Object evaluate(Object obj) { - return evaluate((Number)obj); + return evaluate((Number) obj); } public Object evaluate(Number num) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/NthColumn.java Thu Apr 3 13:43:29 2008 @@ -33,8 +33,8 @@ } public Object evaluate(Object obj) { - StringTokenizer toker = new StringTokenizer((String)obj); - for(int count = 0; count < n && toker.hasMoreTokens();count++) { + StringTokenizer toker = new StringTokenizer((String) obj); + for (int count = 0; count < n && toker.hasMoreTokens();count++) { toker.nextToken(); } return toker.hasMoreTokens() ? toker.nextToken() : null; Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/four/ToInteger.java Thu Apr 3 13:43:29 2008 @@ -30,13 +30,13 @@ */ public final class ToInteger implements UnaryFunction { public Object evaluate(Object obj) { - return evaluate((String)obj); + return evaluate((String) obj); } public Object evaluate(String str) { StringBuffer buf = new StringBuffer(); - for(int i=0;i<str.length();i++) { - if(Character.isDigit(str.charAt(i))) { + for (int i=0;i<str.length();i++) { + if (Character.isDigit(str.charAt(i))) { buf.append(str.charAt(i)); } else { break; Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Add.java Thu Apr 3 13:43:29 2008 @@ -26,7 +26,7 @@ */ public class Add implements BinaryFunction { public Object evaluate(Object left, Object right) { - return evaluate((Number)left,(Number)right); + return evaluate((Number) left,(Number) right); } public Object evaluate(Number left, Number right) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/BinaryFunctionUnaryFunction.java Thu Apr 3 13:43:29 2008 @@ -25,7 +25,7 @@ */ public final class BinaryFunctionUnaryFunction implements UnaryFunction { public BinaryFunctionUnaryFunction(BinaryFunction f) { - if(null == f) { + if (null == f) { throw new NullPointerException(); } else { this.function = f; Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Divide.java Thu Apr 3 13:43:29 2008 @@ -26,7 +26,7 @@ */ public class Divide implements BinaryFunction { public Object evaluate(Object left, Object right) { - return evaluate((Number)left,(Number)right); + return evaluate((Number) left,(Number) right); } public Object evaluate(Number left, Number right) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Mod.java Thu Apr 3 13:43:29 2008 @@ -26,7 +26,7 @@ */ public class Mod implements BinaryFunction { public Object evaluate(Object left, Object right) { - return evaluate((Number)left,(Number)right); + return evaluate((Number) left,(Number) right); } public Object evaluate(Number left, Number right) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Money.java Thu Apr 3 13:43:29 2008 @@ -30,8 +30,8 @@ } public boolean equals(Object obj) { - if(obj instanceof Money) { - Money that = (Money)obj; + if (obj instanceof Money) { + Money that = (Money) obj; return getValueAsCents() == that.getValueAsCents(); } else { return false; Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Multiply.java Thu Apr 3 13:43:29 2008 @@ -26,7 +26,7 @@ */ public class Multiply implements BinaryFunction { public Object evaluate(Object left, Object right) { - return evaluate((Number)left,(Number)right); + return evaluate((Number) left,(Number) right); } public Object evaluate(Number left, Number right) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/Subtract.java Thu Apr 3 13:43:29 2008 @@ -26,7 +26,7 @@ */ public class Subtract implements BinaryFunction { public Object evaluate(Object left, Object right) { - return evaluate((Number)left,(Number)right); + return evaluate((Number) left,(Number) right); } public Object evaluate(Number left, Number right) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/SupermarketPricingExample.java Thu Apr 3 13:43:29 2008 @@ -234,7 +234,7 @@ } public Object evaluate(Object obj) { - return evaluate((Number)obj); + return evaluate((Number) obj); } public Object evaluate(Number num) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/one/ToMoney.java Thu Apr 3 13:43:29 2008 @@ -25,7 +25,7 @@ */ public class ToMoney implements UnaryFunction { public Object evaluate(Object cents) { - return evaluate((Number)cents); + return evaluate((Number) cents); } public Object evaluate(Number cents) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java Thu Apr 3 13:43:29 2008 @@ -29,7 +29,7 @@ public abstract class BaseBinaryChop implements BinaryChop { public int find(int seeking, int[] in) { Object[] In = new Object[in.length]; - for(int i=0;i<in.length;i++) { + for (int i=0;i<in.length;i++) { In[i] = new Integer(in[i]); } return find(new Integer(seeking), In); @@ -40,7 +40,7 @@ } protected static int compare(List list, int index, Object obj) { - return ((Comparable)list.get(index)).compareTo(obj); + return ((Comparable) list.get(index)).compareTo(obj); } protected static boolean greaterThan(List list, int index, Object obj) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java Thu Apr 3 13:43:29 2008 @@ -63,7 +63,7 @@ public boolean test() { boolean result = true; Comparable next = (Comparable)(function.evaluate()); - if(null != last) { + if (null != last) { result = last.compareTo(next) > 0; } last = next; @@ -104,7 +104,7 @@ } private void assertTrue(boolean value) { - if(!value) { + if (!value) { throw new IllegalStateException("Assertion failed"); } } 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=644480&r1=644479&r2=644480&view=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:43:29 2008 @@ -160,7 +160,7 @@ int low = 0; while (high - low > 1) { int mid = (high + low) / 2; - if(greaterThan(list,mid,seeking)) { + if (greaterThan(list,mid,seeking)) { high = mid; } else { low = mid; @@ -239,7 +239,7 @@ * Procedure BODY = new Procedure() { * public void run() { * int mid = (high + low) / 2; - * if(greaterThan(list,mid,seeking)) { + * if (greaterThan(list,mid,seeking)) { * high = mid; * } else { * low = mid; @@ -292,7 +292,7 @@ /** Our loop body. */ public void run() { int mid = (high + low) / 2; - if(greaterThan(list,mid,seeking)) { + if (greaterThan(list,mid,seeking)) { high = mid; } else { low = mid; @@ -312,7 +312,7 @@ }; Algorithms.untildo(loop,loop); - return ((Number)loop.evaluate()).intValue(); + return ((Number) loop.evaluate()).intValue(); } }); } @@ -374,7 +374,7 @@ loop(new Procedure() { public void run() { int mid = (high + low) / 2; - if(BaseBinaryChop.greaterThan(list,mid,seeking)) { + if (BaseBinaryChop.greaterThan(list,mid,seeking)) { high = mid; } else { low = mid; @@ -414,9 +414,9 @@ } private int find(Object seeking, List list, int low, int high) { - if(high - low > 1) { + if (high - low > 1) { int mid = (high + low) / 2; - if(greaterThan(list,mid,seeking)) { + if (greaterThan(list,mid,seeking)) { return find(seeking,list,low,mid); } else { return find(seeking,list,mid,high); @@ -443,11 +443,11 @@ public void testTailRecursive() { chopTest(new BaseBinaryChop() { public int find(final Object seeking, final List list) { - return ((Number)Algorithms.recurse(new Function() { + return ((Number) Algorithms.recurse(new Function() { public Object evaluate() { - if(high - low > 1) { + if (high - low > 1) { int mid = (high + low) / 2; - if(greaterThan(list,mid,seeking)) { + if (greaterThan(list,mid,seeking)) { high = mid; } else { low = mid; @@ -492,13 +492,13 @@ } private int find(Object seeking, List list, int offset) { - if(list.isEmpty()) { + if (list.isEmpty()) { return -1; - } if(list.size() == 1) { + } if (list.size() == 1) { return (equals(list,0,seeking) ? offset : -1); } else { int mid = list.size() / 2; - if(greaterThan(list,mid,seeking)) { + if (greaterThan(list,mid,seeking)) { return find(seeking,list.subList(0,mid),offset); } else { return find(seeking,list.subList(mid,list.size()),offset+mid); @@ -517,17 +517,17 @@ public void testTailRecursive2() { chopTest(new BaseBinaryChop() { public int find(final Object seeking, final List list) { - return ((Number)Algorithms.recurse(new Function() { + return ((Number) Algorithms.recurse(new Function() { public Object evaluate() { - if(sublist.isEmpty()) { + if (sublist.isEmpty()) { return BaseBinaryChop.NEGATIVE_ONE; - } if(sublist.size() == 1) { + } if (sublist.size() == 1) { return (BaseBinaryChop.equals(sublist,0,seeking) ? new Integer(offset) : BaseBinaryChop.NEGATIVE_ONE); } else { int mid = sublist.size() / 2; - if(greaterThan(sublist,mid,seeking)) { + if (greaterThan(sublist,mid,seeking)) { sublist = sublist.subList(0,mid); } else { sublist = sublist.subList(mid,sublist.size()); Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java Thu Apr 3 13:43:29 2008 @@ -39,8 +39,8 @@ } public Lines(Reader reader) { - if(reader instanceof BufferedReader) { - in = (BufferedReader)reader; + if (reader instanceof BufferedReader) { + in = (BufferedReader) reader; } else { in = new BufferedReader(reader); } @@ -48,7 +48,7 @@ public void run(UnaryProcedure proc) { try { - for(String line = in.readLine(); line != null; line = in.readLine()) { + for (String line = in.readLine(); line != null; line = in.readLine()) { proc.run(line); } } catch(RuntimeException e) { Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Sum.java Thu Apr 3 13:43:29 2008 @@ -24,7 +24,7 @@ */ public class Sum implements BinaryFunction { public Object evaluate(Object left, Object right) { - return new Integer( ((Number)left).intValue() + ((Number)right).intValue() ); + return new Integer( ((Number) left).intValue() + ((Number) right).intValue() ); } Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/WordCount.java Thu Apr 3 13:43:29 2008 @@ -26,7 +26,7 @@ */ public class WordCount implements UnaryFunction { public Object evaluate(Object obj) { - StringTokenizer toker = new StringTokenizer((String)obj); + StringTokenizer toker = new StringTokenizer((String) obj); return new Integer(toker.countTokens()); } Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java Thu Apr 3 13:43:29 2008 @@ -34,10 +34,10 @@ super(map); setOnPut(new BinaryFunction() { public Object evaluate(Object a, Object b) { - Map map = (Map)a; + Map map = (Map) a; Object key = Array.get(b,0); Object value = Array.get(b,1); - if(map.containsKey(key)) { + if (map.containsKey(key)) { return map.put(key,value); } else { throw new IllegalArgumentException(); @@ -47,10 +47,10 @@ setOnPutAll(new BinaryProcedure() { public void run(Object a, Object b) { - Map dest = (Map)a; - Map src = (Map)b; + Map dest = (Map) a; + Map src = (Map) b; - if(Algorithms.contains(src.keySet().iterator(),UnaryNot.not(new ContainsKey(dest)))) { + if (Algorithms.contains(src.keySet().iterator(),UnaryNot.not(new ContainsKey(dest)))) { throw new IllegalArgumentException(); } else { dest.putAll(src); Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FunctoredMap.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FunctoredMap.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FunctoredMap.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FunctoredMap.java Thu Apr 3 13:43:29 2008 @@ -122,7 +122,7 @@ protected static final BinaryFunction DEFAULT_ON_PUT = new BinaryFunction() { public Object evaluate(Object a, Object b) { - Map map = (Map)a; + Map map = (Map) a; Object key = Array.get(b,0); Object value = Array.get(b,1); return map.put(key,value); @@ -133,7 +133,7 @@ protected static final BinaryFunction DEFAULT_ON_GET = new BinaryFunction() { public Object evaluate(Object map, Object key) { - return ((Map)map).get(key); + return ((Map) map).get(key); } }; @@ -141,8 +141,8 @@ protected static final BinaryProcedure DEFAULT_ON_PUT_ALL = new BinaryProcedure() { public void run(Object a, Object b) { - Map dest = (Map)a; - Map src = (Map)b; + Map dest = (Map) a; + Map src = (Map) b; dest.putAll(src); } }; @@ -151,7 +151,7 @@ protected static final BinaryFunction DEFAULT_ON_REMOVE = new BinaryFunction() { public Object evaluate(Object a, Object key) { - Map map = (Map)a; + Map map = (Map) a; return map.remove(key); } }; @@ -160,7 +160,7 @@ protected static final UnaryProcedure DEFAULT_ON_CLEAR = new UnaryProcedure() { public void run(Object map) { - ((Map)map).clear(); + ((Map) map).clear(); } }; Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/LazyMap.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/LazyMap.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/LazyMap.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/LazyMap.java Thu Apr 3 13:43:29 2008 @@ -30,8 +30,8 @@ super(map); setOnGet(new BinaryFunction() { public Object evaluate(Object m, Object key) { - Map map = (Map)m; - if(map.containsKey(key)) { + Map map = (Map) m; + if (map.containsKey(key)) { return map.get(key); } else { Object value = factory.evaluate(key); Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/PredicatedMap.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/PredicatedMap.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/PredicatedMap.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/PredicatedMap.java Thu Apr 3 13:43:29 2008 @@ -45,11 +45,11 @@ setOnPutAll(new BinaryProcedure() { public void run(Object d, Object s) { - Map dest = (Map)d; - Map src = (Map)s; - for(Iterator iter = src.entrySet().iterator(); iter.hasNext(); ) { - Map.Entry pair = (Map.Entry)iter.next(); - if(keyPredicate.test(pair.getKey()) && + Map dest = (Map) d; + Map src = (Map) s; + for (Iterator iter = src.entrySet().iterator(); iter.hasNext(); ) { + Map.Entry pair = (Map.Entry) iter.next(); + if (keyPredicate.test(pair.getKey()) && valuePredicate.test(pair.getValue())) { dest.put(pair.getKey(),pair.getValue()); } Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestLazyMap.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestLazyMap.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestLazyMap.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestLazyMap.java Thu Apr 3 13:43:29 2008 @@ -68,7 +68,7 @@ // tests public void test() { - for(Iterator iter = expectedMap.keySet().iterator(); iter.hasNext();) { + for (Iterator iter = expectedMap.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); assertFalse(baseMap.containsKey(key)); assertFalse(lazyMap.containsKey(key)); @@ -80,7 +80,7 @@ assertEquals(expectedMap,lazyMap); assertEquals(expectedMap,baseMap); baseMap.clear(); - for(Iterator iter = expectedMap.keySet().iterator(); iter.hasNext();) { + for (Iterator iter = expectedMap.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); assertFalse(baseMap.containsKey(key)); assertFalse(lazyMap.containsKey(key)); Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java Thu Apr 3 13:43:29 2008 @@ -79,13 +79,13 @@ doubled = new ArrayList(); listWithDuplicates = new ArrayList(); sum = 0; - for(int i=0;i<10;i++) { + for (int i=0;i<10;i++) { list.add(new Integer(i)); doubled.add(new Integer(i*2)); listWithDuplicates.add(new Integer(i)); listWithDuplicates.add(new Integer(i)); sum += i; - if(i%2 == 0) { + if (i%2 == 0) { evens.add(new Integer(i)); } } @@ -137,7 +137,7 @@ assertSame(simpleGenerator, wrapped); wrapped.run(new UnaryProcedure() { public void run(Object obj) { - proc.run(new Integer(((Integer)obj).intValue() + 1)); + proc.run(new Integer(((Integer) obj).intValue() + 1)); } }); } @@ -173,7 +173,7 @@ Generator gen = new IntegerRange(1,5); UnaryFunction dbl = new UnaryFunction() { public Object evaluate(Object obj) { - return new Integer(2*((Number)obj).intValue()); + return new Integer(2*((Number) obj).intValue()); } }; Summer summer = new Summer(); @@ -238,7 +238,7 @@ new Integer(0), new BinaryFunction() { public Object evaluate(Object a, Object b) { - return new Integer(((Number)a).intValue() + ((Number)b).intValue()); + return new Integer(((Number) a).intValue() + ((Number) b).intValue()); } }); assertEquals(new Integer(sum),result); @@ -250,11 +250,11 @@ } public void testTo() { - Collection col = (Collection)simpleGenerator.to(new CollectionTransformer()); + Collection col = (Collection) simpleGenerator.to(new CollectionTransformer()); assertEquals("[0, 1, 2, 3, 4]", col.toString()); Collection fillThis = new LinkedList(); - col = (Collection)simpleGenerator.to(new CollectionTransformer(fillThis)); + col = (Collection) simpleGenerator.to(new CollectionTransformer(fillThis)); assertSame(fillThis, col); assertEquals("[0, 1, 2, 3, 4]", col.toString()); @@ -279,12 +279,12 @@ private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23)); private UnaryPredicate isEven = new UnaryPredicate() { public boolean test(Object obj) { - return ((Number)obj).intValue() % 2 == 0; + return ((Number) obj).intValue() % 2 == 0; } }; private UnaryPredicate isOdd = new UnaryPredicate() { public boolean test(Object obj) { - return ((Number)obj).intValue() % 2 != 0; + return ((Number) obj).intValue() % 2 != 0; } }; @@ -293,7 +293,7 @@ static class Summer implements UnaryProcedure { public void run(Object that) { - sum += ((Number)that).intValue(); + sum += ((Number) that).intValue(); } public int sum = 0; } Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java Thu Apr 3 13:43:29 2008 @@ -90,10 +90,10 @@ // ------------------------------------------------------------------------ public void testFromNull() { - assertNull(EachElement.from((Collection)null)); - assertNull(EachElement.from((Map)null)); - assertNull(EachElement.from((Iterator)null)); - assertNull(EachElement.from((Object[])null)); + assertNull(EachElement.from((Collection) null)); + assertNull(EachElement.from((Map) null)); + assertNull(EachElement.from((Iterator) null)); + assertNull(EachElement.from((Object[]) null)); } Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java Thu Apr 3 13:43:29 2008 @@ -52,7 +52,7 @@ // 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;i<10;i++) { + for (int i=0;i<10;i++) { assertEquals(new Integer(i),list.get(i)); } } @@ -60,7 +60,7 @@ // 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;i>0;i--) { + for (int i=10;i>0;i--) { assertEquals(new Integer(i),list.get(10-i)); } } Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java?rev=644480&r1=644479&r2=644480&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java (original) +++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java Thu Apr 3 13:43:29 2008 @@ -52,7 +52,7 @@ // 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;i<10;i++) { + for (int i=0;i<10;i++) { assertEquals(new Long(i),list.get(i)); } } @@ -60,7 +60,7 @@ // 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;i>0;i--) { + for (int i=10;i>0;i--) { assertEquals(new Long(i),list.get(10-i)); } }