commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1096542 [2/2] - in /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor: adapter/ core/ core/algorithm/ core/collection/ core/comparator/ core/composite/ generator/ generator/util/
Date Mon, 25 Apr 2011 17:57:01 GMT
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java
Mon Apr 25 17:56:58 2011
@@ -43,9 +43,9 @@ import org.apache.commons.functor.Predic
 public final class ConditionalPredicate implements Predicate, Serializable {
     // attributes
     // ------------------------------------------------------------------------
-    private Predicate ifPred = null;
-    private Predicate thenPred = null;
-    private Predicate elsePred = null;
+    private final Predicate ifPred;
+    private final Predicate thenPred;
+    private final Predicate elsePred;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java
Mon Apr 25 17:56:58 2011
@@ -44,9 +44,9 @@ import org.apache.commons.functor.core.N
 public final class ConditionalProcedure implements Procedure, Serializable {
     // attributes
     // ------------------------------------------------------------------------
-    private Predicate ifPred = null;
-    private Procedure thenProc = null;
-    private Procedure elseProc = null;
+    private final Predicate ifPred;
+    private final Procedure thenProc;
+    private final Procedure elseProc;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java
Mon Apr 25 17:56:58 2011
@@ -44,9 +44,9 @@ import org.apache.commons.functor.UnaryP
 public final class ConditionalUnaryFunction<A, T> implements UnaryFunction<A, T>,
Serializable {
     // attributes
     // ------------------------------------------------------------------------
-    private UnaryPredicate<? super A> ifPred;
-    private UnaryFunction<? super A, ? extends T> thenFunc;
-    private UnaryFunction<? super A, ? extends T> elseFunc;
+    private final UnaryPredicate<? super A> ifPred;
+    private final UnaryFunction<? super A, ? extends T> thenFunc;
+    private final UnaryFunction<? super A, ? extends T> elseFunc;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
Mon Apr 25 17:56:58 2011
@@ -43,9 +43,9 @@ import org.apache.commons.functor.UnaryP
 public final class ConditionalUnaryPredicate<A> implements UnaryPredicate<A>,
Serializable {
     // attributes
     // ------------------------------------------------------------------------
-    private UnaryPredicate<? super A> ifPred = null;
-    private UnaryPredicate<? super A> thenPred = null;
-    private UnaryPredicate<? super A> elsePred = null;
+    private final UnaryPredicate<? super A> ifPred;
+    private final UnaryPredicate<? super A> thenPred;
+    private final UnaryPredicate<? super A> elsePred;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java
Mon Apr 25 17:56:58 2011
@@ -44,9 +44,9 @@ import org.apache.commons.functor.core.N
 public final class ConditionalUnaryProcedure<A> implements UnaryProcedure<A>,
Serializable {
     // attributes
     // ------------------------------------------------------------------------
-    private UnaryPredicate<? super A> ifPred = null;
-    private UnaryProcedure<? super A> thenProc = null;
-    private UnaryProcedure<? super A> elseProc = null;
+    private final UnaryPredicate<? super A> ifPred;
+    private final UnaryProcedure<? super A> thenProc;
+    private final UnaryProcedure<? super A> elseProc;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java
Mon Apr 25 17:56:58 2011
@@ -38,7 +38,7 @@ public final class Not implements Predic
 
     // attributes
     // ------------------------------------------------------------------------
-    private Predicate predicate = null;
+    private final Predicate predicate;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryFunction.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryFunction.java
Mon Apr 25 17:56:58 2011
@@ -53,7 +53,7 @@ public class TransformedBinaryFunction<L
         }
     }
 
-    private Helper<?> helper;
+    private final Helper<?> helper;
 
     /**
      * Create a new TransformedBinaryFunction.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
Mon Apr 25 17:56:58 2011
@@ -54,7 +54,7 @@ public class TransformedBinaryProcedure<
         }
     }
 
-    private Helper<?> helper;
+    private final Helper<?> helper;
 
     /**
      * Create a new TransformedBinaryProcedure.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedFunction.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedFunction.java
Mon Apr 25 17:56:58 2011
@@ -53,7 +53,7 @@ public class TransformedFunction<T> impl
         }
     }
 
-    private Helper<?> helper;
+    private final Helper<?> helper;
 
     /**
      * Create a new TransformedFunction.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedProcedure.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedProcedure.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedProcedure.java
Mon Apr 25 17:56:58 2011
@@ -54,7 +54,7 @@ public class TransformedProcedure implem
         }
     }
 
-    private Helper<?> helper;
+    private final Helper<?> helper;
 
     /**
      * Create a new TransformedProcedure.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedFunction.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedFunction.java
Mon Apr 25 17:56:58 2011
@@ -42,7 +42,7 @@ import org.apache.commons.functor.Binary
 public class TransposedFunction<L, R, T> implements BinaryFunction<L, R, T>,
Serializable {
     // attributes
     // ------------------------------------------------------------------------
-    private BinaryFunction<? super R, ? super L, ? extends T> function;
+    private final BinaryFunction<? super R, ? super L, ? extends T> function;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedPredicate.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedPredicate.java
Mon Apr 25 17:56:58 2011
@@ -42,7 +42,7 @@ import org.apache.commons.functor.Binary
 public class TransposedPredicate<L, R> implements BinaryPredicate<L, R>, Serializable
{
     // attributes
     // ------------------------------------------------------------------------
-    private BinaryPredicate<? super R, ? super L> predicate;
+    private final BinaryPredicate<? super R, ? super L> predicate;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedProcedure.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedProcedure.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedProcedure.java
Mon Apr 25 17:56:58 2011
@@ -42,7 +42,7 @@ import org.apache.commons.functor.Binary
 public class TransposedProcedure<L, R> implements BinaryProcedure<L, R>, Serializable
{
     // attributes
     // ------------------------------------------------------------------------
-    private BinaryProcedure<? super R, ? super L> procedure = null;
+    private final BinaryProcedure<? super R, ? super L> procedure;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryFunction.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryFunction.java
Mon Apr 25 17:56:58 2011
@@ -66,7 +66,7 @@ public class UnaryCompositeBinaryFunctio
         }
     }
 
-    private Helper<?, ?> helper;
+    private final Helper<?, ?> helper;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
Mon Apr 25 17:56:58 2011
@@ -67,7 +67,7 @@ public class UnaryCompositeBinaryPredica
 
     // attributes
     // ------------------------------------------------------------------------
-    private Helper<?, ?> helper;
+    private final Helper<?, ?> helper;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryNot.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryNot.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryNot.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryNot.java
Mon Apr 25 17:56:58 2011
@@ -37,7 +37,7 @@ import org.apache.commons.functor.UnaryP
 public final class UnaryNot<A> implements UnaryPredicate<A>, Serializable {
     // attributes
     // ------------------------------------------------------------------------
-    private UnaryPredicate<? super A> predicate = null;
+    private final UnaryPredicate<? super A> predicate;
 
     // constructor
     // ------------------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/BaseGenerator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/BaseGenerator.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/BaseGenerator.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/BaseGenerator.java
Mon Apr 25 17:56:58 2011
@@ -30,13 +30,14 @@ import org.apache.commons.functor.genera
 public abstract class BaseGenerator<E> implements Generator<E> {
 
     /** A generator can wrap another generator. */
-    private Generator<?> wrappedGenerator = null;
+    private final Generator<?> wrappedGenerator;
 
     /** Set to true when the generator is {@link #stop stopped}. */
     private boolean stopped = false;
 
     /** Create a new generator. */
     public BaseGenerator() {
+        this(null);
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/FilteredGenerator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/FilteredGenerator.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/FilteredGenerator.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/FilteredGenerator.java
Mon Apr 25 17:56:58 2011
@@ -27,7 +27,7 @@ import org.apache.commons.functor.core.c
  * @version $Revision$ $Date$
  */
 public class FilteredGenerator<E> extends BaseGenerator<E> {
-    private UnaryPredicate<? super E> pred;
+    private final UnaryPredicate<? super E> pred;
 
     /**
      * Create a new FilteredGenerator.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateUntil.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateUntil.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateUntil.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateUntil.java
Mon Apr 25 17:56:58 2011
@@ -26,7 +26,7 @@ import org.apache.commons.functor.UnaryP
  * @version $Revision$ $Date$
  */
 public class GenerateUntil<E> extends BaseGenerator<E> {
-    private UnaryPredicate<? super E> test;
+    private final UnaryPredicate<? super E> test;
 
     /**
      * Create a new GenerateUntil.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateWhile.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateWhile.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateWhile.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/GenerateWhile.java
Mon Apr 25 17:56:58 2011
@@ -26,7 +26,7 @@ import org.apache.commons.functor.UnaryP
  * @version $Revision$ $Date$
  */
 public class GenerateWhile<E> extends BaseGenerator<E> {
-    private UnaryPredicate<? super E> test;
+    private final UnaryPredicate<? super E> test;
 
     /**
      * Create a new GenerateWhile.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java
Mon Apr 25 17:56:58 2011
@@ -30,7 +30,7 @@ public final class IteratorToGeneratorAd
     // instance variables
     //-----------------------------------------------------
 
-    private Iterator<? extends E> iter = null;
+    private final Iterator<? extends E> iter;
 
     // constructors
     //-----------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/TransformedGenerator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/TransformedGenerator.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/TransformedGenerator.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/TransformedGenerator.java
Mon Apr 25 17:56:58 2011
@@ -25,7 +25,7 @@ import org.apache.commons.functor.UnaryP
  * @version $Revision$ $Date$
  */
 public class TransformedGenerator<I, E> extends BaseGenerator<E> {
-    private UnaryFunction<? super I, ? extends E> func;
+    private final UnaryFunction<? super I, ? extends E> func;
 
     /**
      * Create a new TransformedGenerator.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/UntilGenerate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/UntilGenerate.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/UntilGenerate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/UntilGenerate.java
Mon Apr 25 17:56:58 2011
@@ -26,7 +26,7 @@ import org.apache.commons.functor.UnaryP
  * @version $Revision$ $Date$
  */
 public class UntilGenerate<E> extends BaseGenerator<E> {
-    private UnaryPredicate<? super E> test;
+    private final UnaryPredicate<? super E> test;
 
     /**
      * Create a new UntilGenerate.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/WhileGenerate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/WhileGenerate.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/WhileGenerate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/WhileGenerate.java
Mon Apr 25 17:56:58 2011
@@ -26,7 +26,7 @@ import org.apache.commons.functor.UnaryP
  * @version $Revision$ $Date$
  */
 public class WhileGenerate<E> extends BaseGenerator<E> {
-    private UnaryPredicate<? super E> test;
+    private final UnaryPredicate<? super E> test;
 
     /**
      * Create a new WhileGenerate.

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java
Mon Apr 25 17:56:58 2011
@@ -30,10 +30,17 @@ import org.apache.commons.functor.genera
  * @author Jason Horman (jason@jhorman.org)
  */
 public class CollectionTransformer<E> implements UnaryFunction<Generator<? extends
E>, Collection<? super E>> {
+    /*
+     * TODO revisit this class... it could stand a more-descriptive name.  Also, it's a little
+     * hard to say whether, for an instance constructed without a specific target collection,
+     * #evaluate() should return a new ArrayList for each call, or continue adding to
+     * a single ArrayList instance (the current behavior).
+     * Perhaps this is more a documentation issue than anything.
+     */
 
     // instance methods
     //---------------------------------------------------
-    private Collection<? super E> toFill = null;
+    private final Collection<? super E> toFill;
 
     // constructors
     //---------------------------------------------------
@@ -41,7 +48,7 @@ public class CollectionTransformer<E> im
      * Create a new CollectionTransformer.
      */
     public CollectionTransformer() {
-        toFill = new ArrayList<E>();
+        this(null);
     }
 
     /**
@@ -49,7 +56,13 @@ public class CollectionTransformer<E> im
      * @param toFill Collection to fill
      */
     public CollectionTransformer(Collection<? super E> toFill) {
-        this.toFill = toFill;
+        Collection<? super E> coll;
+        if (toFill == null) {
+            coll = new ArrayList<E>();
+        } else {
+            coll = toFill;
+        }
+        this.toFill = coll;
     }
 
     // instance methods

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/IntegerRange.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/IntegerRange.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/IntegerRange.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/IntegerRange.java
Mon Apr 25 17:56:58 2011
@@ -30,9 +30,9 @@ public final class IntegerRange extends 
     // attributes
     //---------------------------------------------------------------
 
-    private int from;
-    private int to;
-    private int step;
+    private final int from;
+    private final int to;
+    private final int step;
 
     // constructors
     //---------------------------------------------------------------

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/LongRange.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/LongRange.java?rev=1096542&r1=1096541&r2=1096542&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/LongRange.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/LongRange.java
Mon Apr 25 17:56:58 2011
@@ -29,9 +29,9 @@ public final class LongRange extends Bas
     // attributes
     //---------------------------------------------------------------
 
-    private long from;
-    private long to;
-    private long step;
+    private final long from;
+    private final long to;
+    private final long step;
 
     // constructors
     //---------------------------------------------------------------



Mime
View raw message