commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r645647 - in /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor: adapter/ core/ core/comparator/ core/composite/ generator/util/
Date Mon, 07 Apr 2008 19:05:50 GMT
Author: mbenson
Date: Mon Apr  7 12:05:43 2008
New Revision: 645647

URL: http://svn.apache.org/viewvc?rev=645647&view=rev
Log:
checkstyle

Modified:
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/IntegerRange.java

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryPredicate.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryPredicate.java
Mon Apr  7 12:05:43 2008
@@ -38,6 +38,9 @@
  * @author Rodney Waldhoff
  */
 public final class BinaryFunctionBinaryPredicate implements BinaryPredicate, Serializable
{
+    /** The {@link BinaryFunction BinaryFunction} I'm wrapping. */
+    private BinaryFunction function = null;
+
     /**
      * Create an {@link BinaryPredicate BinaryPredicate} wrapping
      * the given {@link BinaryFunction BinaryFunction}.
@@ -48,6 +51,7 @@
     }
 
     /**
+     * {@inheritDoc}
      * Returns the <code>boolean</code> value of the non-<code>null</code>
      * <code>Boolean</code> returned by the {@link BinaryFunction#evaluate evaluate}
      * method of my underlying function.
@@ -56,9 +60,12 @@
      * @throws ClassCastException if my underlying function returns a non-<code>Boolean</code>
      */
     public boolean test(Object left, Object right) {
-        return ((Boolean)(function.evaluate(left,right))).booleanValue();
+        return ((Boolean) (function.evaluate(left, right))).booleanValue();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof BinaryFunctionBinaryPredicate) {
             return equals((BinaryFunctionBinaryPredicate) that);
@@ -67,10 +74,18 @@
         }
     }
 
+    /**
+     * @param that
+     * @return
+     */
     public boolean equals(BinaryFunctionBinaryPredicate that) {
-        return that == this || (null != that && (null == function ? null == that.function
: function.equals(that.function)));
+        return that == this
+                || (null != that && (null == function ? null == that.function : function.equals(that.function)));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "BinaryFunctionBinaryPredicate".hashCode();
         if (null != function) {
@@ -79,6 +94,9 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "BinaryFunctionBinaryPredicate<" + function + ">";
     }
@@ -100,6 +118,4 @@
         return null == function ? null : new BinaryFunctionBinaryPredicate(function);
     }
 
-    /** The {@link BinaryFunction BinaryFunction} I'm wrapping. */
-    private BinaryFunction function = null;
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java
Mon Apr  7 12:05:43 2008
@@ -39,14 +39,27 @@
  * @author Rodney Waldhoff
  */
 public final class IgnoreRightFunction implements BinaryFunction, Serializable {
+    /** The {@link UnaryFunction UnaryFunction} I'm wrapping. */
+    private UnaryFunction function = null;
+
+    /**
+     * Create a new IgnoreRightFunction.
+     * @param function UnaryFunction to wrap
+     */
     public IgnoreRightFunction(UnaryFunction function) {
         this.function = function;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object left, Object right) {
         return function.evaluate(left);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof IgnoreRightFunction) {
             return equals((IgnoreRightFunction) that);
@@ -55,10 +68,19 @@
         }
     }
 
+    /**
+     * Learn whether another IgnoreRightFunction is equal to this.
+     * @param that IgnoreRightFunction to test
+     * @return boolean
+     */
     public boolean equals(IgnoreRightFunction that) {
-        return that == this || (null != that && (null == function ? null == that.function
: function.equals(that.function)));
+        return that == this
+                || (null != that && (null == function ? null == that.function : function.equals(that.function)));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "IgnoreRightFunction".hashCode();
         if (null != function) {
@@ -67,14 +89,20 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "IgnoreRightFunction<" + function + ">";
     }
 
+    /**
+     * Adapt a UnaryFunction to the BinaryFunction interface.
+     * @param function UnaryFunction to adapt
+     * @return IgnoreRightFunction BinaryFunction
+     */
     public static BinaryFunction adapt(UnaryFunction function) {
         return null == function ? null : new IgnoreRightFunction(function);
     }
 
-    /** The {@link UnaryFunction UnaryFunction} I'm wrapping. */
-    private UnaryFunction function = null;
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java
Mon Apr  7 12:05:43 2008
@@ -39,6 +39,11 @@
  * @author Rodney Waldhoff
  */
 public final class RightBoundFunction implements UnaryFunction, Serializable {
+    /** The {@link BinaryFunction BinaryFunction} I'm wrapping. */
+    private BinaryFunction function = null;
+    /** The parameter to pass to that function. */
+    private Object param = null;
+
     /**
      * @param function the function to adapt
      * @param arg the constant argument to use
@@ -48,10 +53,16 @@
         this.param = arg;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object obj) {
-        return function.evaluate(obj,param);
+        return function.evaluate(obj, param);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof RightBoundFunction) {
             return equals((RightBoundFunction) that);
@@ -60,14 +71,20 @@
         }
     }
 
+    /**
+     * Learn whether another RightBoundFunction is equal to this.
+     * @param that RightBoundFunction to test
+     * @return boolean
+     */
     public boolean equals(RightBoundFunction that) {
-        return that == this || (
-                (null != that) &&
-                (null == function ? null == that.function : function.equals(that.function))
&&
-                (null == param ? null == that.param : param.equals(that.param)) );
-
+        return that == this || ((null != that)
+                && (null == function ? null == that.function : function.equals(that.function))
+                && (null == param ? null == that.param : param.equals(that.param)));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "RightBoundFunction".hashCode();
         if (null != function) {
@@ -81,16 +98,21 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "RightBoundFunction<" + function + "(?," + param + ")>";
     }
 
+    /**
+     * Adapt a BinaryFunction to the UnaryFunction interface.
+     * @param function BinaryFunction to adapt
+     * @param arg Object that will always be used for the right side of the BinaryFunction
delegate.
+     * @return RightBoundFunction
+     */
     public static RightBoundFunction bind(BinaryFunction function, Object arg) {
         return null == function ? null : new RightBoundFunction(function,arg);
     }
 
-    /** The {@link BinaryFunction BinaryFunction} I'm wrapping. */
-    private BinaryFunction function = null;
-    /** The parameter to pass to that function. */
-    private Object param = null;
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java
Mon Apr  7 12:05:43 2008
@@ -58,7 +58,7 @@
      * {@inheritDoc}
      */
     public boolean test(Object obj) {
-        return predicate.test(obj,param);
+        return predicate.test(obj, param);
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java
Mon Apr  7 12:05:43 2008
@@ -39,7 +39,7 @@
     // ------------------------------------------------------------------------
     /**
      * Create a new IsInstanceOf.
-     * @param klass
+     * @param klass Class of which a tested object must be an instance.
      */
     public IsInstanceOf(Class klass) {
         this.klass = klass;

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
Mon Apr  7 12:05:43 2008
@@ -29,23 +29,33 @@
  * @author Rodney Waldhoff
  */
 public final class Min implements BinaryFunction, Serializable {
+    private Comparator comparator = null;
+    private static final Min INSTANCE = new Min();
+
+    /**
+     * Create a new Min.
+     */
     public Min() {
         this(null);
     }
 
+    /**
+     * Create a new Min.
+     * @param comparator to use
+     */
     public Min(Comparator comparator) {
         this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
     }
 
     /**
-     * @see org.apache.commons.functor.BinaryFunction#evaluate(Object, Object)
+     * {@inheritDoc}
      */
     public Object evaluate(Object left, Object right) {
-        return (comparator.compare(left,right) <= 0) ? left : right;
+        return (comparator.compare(left, right) <= 0) ? left : right;
     }
 
     /**
-     * @see java.lang.Object#equals(Object)
+     * {@inheritDoc}
      */
     public boolean equals(Object that) {
         if (that instanceof Min) {
@@ -56,30 +66,34 @@
     }
 
     /**
-     * @see #equals(Object)
+     * Learn whether another Min is equal to this.
+     * @param that Min to test
+     * @return boolean
      */
     public boolean equals(Min that) {
         return null != that && comparator.equals(that.comparator);
     }
 
     /**
-     * @see java.lang.Object#hashCode()
+     * {@inheritDoc}
      */
     public int hashCode() {
         return "Min".hashCode() ^ comparator.hashCode();
     }
 
     /**
-     * @see java.lang.Object#toString()
+     * {@inheritDoc}
      */
     public String toString() {
         return "Min<" + comparator + ">";
     }
 
+    /**
+     * Get a basic Min instance.
+     * @return Min
+     */
     public static Min instance() {
         return INSTANCE;
     }
 
-    private Comparator comparator = null;
-    private static final Min INSTANCE = new Min();
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java
Mon Apr  7 12:05:43 2008
@@ -41,10 +41,20 @@
  * @author Rodney Waldhoff
  */
 public final class ConditionalBinaryPredicate implements BinaryPredicate, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private BinaryPredicate ifPred = null;
+    private BinaryPredicate thenPred = null;
+    private BinaryPredicate elsePred = null;
 
     // constructor
     // ------------------------------------------------------------------------
-
+    /**
+     * Create a new ConditionalBinaryPredicate.
+     * @param ifPred if
+     * @param thenPred then
+     * @param elsePred else
+     */
     public ConditionalBinaryPredicate(BinaryPredicate ifPred, BinaryPredicate thenPred, BinaryPredicate
elsePred) {
         this.ifPred = ifPred;
         this.thenPred = thenPred;
@@ -53,10 +63,16 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object left, Object right) {
         return ifPred.test(left,right) ? thenPred.test(left,right) : elsePred.test(left,right);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof ConditionalBinaryPredicate) {
             return equals((ConditionalBinaryPredicate) that);
@@ -65,13 +81,21 @@
         }
     }
 
+    /**
+     * Learn whether another ConditionalBinaryPredicate is equal to this.
+     * @param that ConditionalBinaryPredicate to test
+     * @return boolean
+     */
     public boolean equals(ConditionalBinaryPredicate that) {
-        return null != that &&
-                (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
-                (null == thenPred ? null == that.thenPred : thenPred.equals(that.thenPred))
&&
-                (null == elsePred ? null == that.elsePred : elsePred.equals(that.elsePred));
+        return null != that
+                && (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred))
+                && (null == thenPred ? null == that.thenPred : thenPred.equals(that.thenPred))
+                && (null == elsePred ? null == that.elsePred : elsePred.equals(that.elsePred));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "ConditionalBinaryPredicate".hashCode();
         if (null != ifPred) {
@@ -89,13 +113,11 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "ConditionalBinaryPredicate<" + ifPred + "?" + thenPred + ":" + elsePred
+ ">";
     }
 
-    // attributes
-    // ------------------------------------------------------------------------
-    private BinaryPredicate ifPred = null;
-    private BinaryPredicate thenPred = null;
-    private BinaryPredicate elsePred = null;
 }

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=645647&r1=645646&r2=645647&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  7 12:05:43 2008
@@ -41,18 +41,31 @@
  * @author Rodney Waldhoff
  */
 public final class ConditionalProcedure implements Procedure, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private Predicate ifPred = null;
+    private Procedure thenProc = null;
+    private Procedure elseProc = null;
 
     // constructor
     // ------------------------------------------------------------------------
-
-    public ConditionalProcedure(Predicate ifPred, Procedure thenPred, Procedure elsePred)
{
+    /**
+     * Create a new ConditionalProcedure.
+     * @param ifPred if
+     * @param thenProc then
+     * @param elseProc else
+     */
+    public ConditionalProcedure(Predicate ifPred, Procedure thenProc, Procedure elseProc)
{
         this.ifPred = ifPred;
-        this.thenProc = thenPred;
-        this.elseProc = elsePred;
+        this.thenProc = thenProc;
+        this.elseProc = elseProc;
     }
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public void run() {
         if (ifPred.test()) {
             thenProc.run();
@@ -61,6 +74,9 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof ConditionalProcedure) {
             return equals((ConditionalProcedure) that);
@@ -69,13 +85,21 @@
         }
     }
 
+    /**
+     * Learn whether another ConditionalProcecure is equal to this.
+     * @param that the ConditionalProcedure to test
+     * @return boolean
+     */
     public boolean equals(ConditionalProcedure that) {
-        return null != that &&
-                (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
-                (null == thenProc ? null == that.thenProc : thenProc.equals(that.thenProc))
&&
-                (null == elseProc ? null == that.elseProc : elseProc.equals(that.elseProc));
+        return null != that
+                && (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred))
+                && (null == thenProc ? null == that.thenProc : thenProc.equals(that.thenProc))
+                && (null == elseProc ? null == that.elseProc : elseProc.equals(that.elseProc));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "ConditionalProcedure".hashCode();
         if (null != ifPred) {
@@ -93,13 +117,11 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "ConditionalProcedure<" + ifPred + "?" + thenProc + ":" + elseProc + ">";
     }
 
-    // attributes
-    // ------------------------------------------------------------------------
-    private Predicate ifPred = null;
-    private Procedure thenProc = null;
-    private Procedure elseProc = null;
 }

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=645647&r1=645646&r2=645647&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  7 12:05:43 2008
@@ -40,19 +40,32 @@
  * @author Rodney Waldhoff
  */
 public class TransposedPredicate implements BinaryPredicate, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private BinaryPredicate predicate = null;
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new TransposedPredicate.
+     * @param p the BinaryPredicate to transpose
+     */
     public TransposedPredicate(BinaryPredicate p) {
         predicate = p;
     }
 
     // functor interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object left, Object right) {
-        return predicate.test(right,left);
+        return predicate.test(right, left);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof TransposedPredicate) {
             return equals((TransposedPredicate) that);
@@ -61,10 +74,18 @@
         }
     }
 
+    /**
+     * Learn whether another TransposedPredicate is equal to this.
+     * @param that the TransposedPredicate to test
+     * @return boolean
+     */
     public boolean equals(TransposedPredicate that) {
         return null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "TransposedPredicate".hashCode();
         if (null != predicate) {
@@ -73,18 +94,22 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "TransposedPredicate<" + predicate + ">";
     }
 
     // static
     // ------------------------------------------------------------------------
+    /**
+     * Return the transposition of <code>p</code>.
+     * @param p BinaryPredicate to transpose
+     * @return TransposedPredicate
+     */
     public static TransposedPredicate transpose(BinaryPredicate p) {
         return null == p ? null : new TransposedPredicate(p);
     }
-
-    // attributes
-    // ------------------------------------------------------------------------
-    private BinaryPredicate predicate = null;
 
 }

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=645647&r1=645646&r2=645647&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  7 12:05:43 2008
@@ -31,36 +31,49 @@
  * @version $Revision$ $Date$
  * @author Jason Horman (jason@jhorman.org)
  */
-
 public class CollectionTransformer implements UnaryFunction {
 
-	// instance methods
-	//---------------------------------------------------
+    // instance methods
+    //---------------------------------------------------
     private Collection toFill = null;
 
-	// constructors
-	//---------------------------------------------------
+    // constructors
+    //---------------------------------------------------
+    /**
+     * Create a new CollectionTransformer.
+     */
     public CollectionTransformer() {
         toFill = new ArrayList();
     }
 
+    /**
+     * Create a new CollectionTransformer.
+     * @param toFill Collection to fill
+     */
     public CollectionTransformer(Collection toFill) {
         this.toFill = toFill;
     }
 
-	// instance methods
-	//---------------------------------------------------
-	public Object evaluate(Object obj) {
-		return evaluate((Generator) obj);
-	}
+    // instance methods
+    //---------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
+    public Object evaluate(Object obj) {
+        return evaluate((Generator) obj);
+    }
 
+    /**
+     * Add the Generator's contents to a Collection.
+     * @param generator to run
+     * @return filled Collection
+     */
     public Object evaluate(Generator generator) {
         generator.run(new UnaryProcedure() {
             public void run(Object obj) {
                 toFill.add(obj);
             }
         });
-
         return toFill;
     }
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java?rev=645647&r1=645646&r2=645647&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
Mon Apr  7 12:05:43 2008
@@ -59,7 +59,7 @@
     }
 
     /**
-     * Get a Generator for each element of an Object[]. 
+     * Get a Generator for each element of an Object[].
      * @param array to iterate
      * @return Generator
      */
@@ -72,7 +72,7 @@
     }
 
     /**
-     * Get a Generator for each element of an Iterator. 
+     * Get a Generator for each element of an Iterator.
      * @param iter to iterate
      * @return Generator
      */

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=645647&r1=645646&r2=645647&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  7 12:05:43 2008
@@ -29,24 +29,51 @@
  * @author Rodney Waldhoff
  */
 public final class IntegerRange extends BaseGenerator {
+    // attributes
+    //---------------------------------------------------------------
+
+    private int from;
+    private int to;
+    private int step;
 
     // constructors
     //---------------------------------------------------------------
-
+    /**
+     * Create a new IntegerRange.
+     * @param from start
+     * @param to end
+     */
     public IntegerRange(Number from, Number to) {
-        this(from.intValue(),to.intValue());
+        this(from.intValue(), to.intValue());
     }
 
+    /**
+     * Create a new IntegerRange.
+     * @param from start
+     * @param to end
+     * @param step increment
+     */
     public IntegerRange(Number from, Number to, Number step) {
-        this(from.intValue(),to.intValue(),step.intValue());
+        this(from.intValue(), to.intValue(), step.intValue());
     }
 
+    /**
+     * Create a new IntegerRange.
+     * @param from start
+     * @param to end
+     */
     public IntegerRange(int from, int to) {
-        this(from,to,defaultStep(from,to));
+        this(from, to, defaultStep(from, to));
     }
 
+    /**
+     * Create a new IntegerRange.
+     * @param from start
+     * @param to end
+     * @param step increment
+     */
     public IntegerRange(int from, int to, int step) {
-        if (from != to && signOf(step) != signOf(to-from)) {
+        if (from != to && signOf(step) != signOf(to - from)) {
             throw new IllegalArgumentException("Will never reach " + to + " from " + from
+ " using step " + step);
         } else {
             this.from = from;
@@ -57,23 +84,31 @@
 
     // methods
     //---------------------------------------------------------------
-
+    /**
+     * {@inheritDoc}
+     */
     public void run(UnaryProcedure proc) {
         if (signOf(step) == -1) {
-            for (int i=from; i > to; i += step) {
+            for (int i = from; i > to; i += step) {
                 proc.run(new Integer(i));
             }
         } else {
-            for (int i=from; i < to; i += step) {
+            for (int i = from; i < to; i += step) {
                 proc.run(new Integer(i));
             }
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "IntegerRange<" + from + "," + to + "," + step + ">";
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object obj) {
         if (obj instanceof IntegerRange) {
             IntegerRange that = (IntegerRange) obj;
@@ -83,6 +118,9 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "IntegerRange".hashCode();
         hash <<= 2;
@@ -96,7 +134,11 @@
 
     // private methods
     //---------------------------------------------------------------
-
+    /**
+     * Get <code>value/|value|</code> (0 when value == 0). 
+     * @param value to test
+     * @return int
+     */
     private static int signOf(int value) {
         if (value < 0) {
             return -1;
@@ -107,6 +149,12 @@
         }
     }
 
+    /**
+     * Calculate default step to get from <code>from</code> to <code>to</code>.
+     * @param from start
+     * @param to end
+     * @return int
+     */
     private static int defaultStep(int from, int to) {
         if (from > to) {
             return -1;
@@ -114,13 +162,5 @@
             return 1;
         }
     }
-
-    // attributes
-    //---------------------------------------------------------------
-
-    private int from;
-    private int to;
-    private int step;
-
 
 }



Mime
View raw message