commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r645735 [2/2] - in /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor: adapter/ core/ core/collection/ core/comparator/ core/composite/ generator/ generator/util/
Date Mon, 07 Apr 2008 23:29:30 GMT
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java Mon Apr  7 16:29:25 2008
@@ -40,24 +40,47 @@
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new BinaryOr.
+     */
     public BinaryOr() {
         super();
     }
 
+    /**
+     * Create a new BinaryOr.
+     * @param p BinaryPredicate to add
+     */
     public BinaryOr(BinaryPredicate p) {
         super(p);
     }
 
+    /**
+     * Create a new BinaryOr.
+     * @param p BinaryPredicate to add
+     * @param q BinaryPredicate to add
+     */
     public BinaryOr(BinaryPredicate p, BinaryPredicate q) {
-        super(p,q);
+        super(p, q);
     }
 
+    /**
+     * Create a new BinaryOr.
+     * @param p BinaryPredicate to add
+     * @param q BinaryPredicate to add
+     * @param r BinaryPredicate to add
+     */
     public BinaryOr(BinaryPredicate p, BinaryPredicate q, BinaryPredicate r) {
-        super(p,q,r);
+        super(p, q, r);
     }
 
     // modifiers
     // ------------------------------------------------------------------------
+    /**
+     * Fluently add a BinaryPredicate.
+     * @param p BinaryPredicate to add
+     * @return this
+     */
     public BinaryOr or(BinaryPredicate p) {
         super.addBinaryPredicate(p);
         return this;
@@ -65,6 +88,9 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object a, Object b) {
         for (Iterator iter = getBinaryPredicateIterator(); iter.hasNext();) {
             if (((BinaryPredicate) iter.next()).test(a,b)) {
@@ -74,6 +100,9 @@
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof BinaryOr) {
             return equals((BinaryOr) that);
@@ -82,14 +111,25 @@
         }
     }
 
+    /**
+     * Learn whether another BinaryOr is equal to this.
+     * @param that BinaryOr to test
+     * @return boolean
+     */
     public boolean equals(BinaryOr that) {
         return getBinaryPredicateListEquals(that);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return "BinaryOr".hashCode() ^ getBinaryPredicateListHashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "BinaryOr<" + getBinaryPredicateListToString() + ">";
     }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java Mon Apr  7 16:29:25 2008
@@ -28,34 +28,75 @@
  * @author Rodney Waldhoff
  */
 public final class Composite {
+    //TODO discuss method signatures
 
     // constructor - for beanish apis
     // ------------------------------------------------------------------------
+    /**
+     * Create a new Composite.
+     */
     public Composite() { }
 
-    // ------------------------------------------------------------------------
-
+    /**
+     * Create a composite UnaryProcedure.
+     * @param p UnaryProcedure to execute against output of <code>f</code>
+     * @param f UnaryFunction to apply
+     * @return CompositeUnaryProcedure
+     */
     public static final CompositeUnaryProcedure procedure(UnaryProcedure p, UnaryFunction f) {
-        return new CompositeUnaryProcedure(p,f);
+        return new CompositeUnaryProcedure(p, f);
     }
 
+    /**
+     * Create a composite UnaryPredicate.
+     * @param p UnaryPredicate to test the output of <code>f</code>
+     * @param f UnaryFunction to apply
+     * @return CompositeUnaryPredicate
+     */
     public static final CompositeUnaryPredicate predicate(UnaryPredicate p, UnaryFunction f) {
-        return new CompositeUnaryPredicate(p,f);
+        return new CompositeUnaryPredicate(p, f);
     }
 
+    /**
+     * Create a composite BinaryPredicate.
+     * @param p BinaryPredicate to test <i>output(</i><code>f</code><i>), output(</i><code>g</code><i>)</i>
+     * @param f left UnaryFunction
+     * @param g right UnaryFunction
+     * @return BinaryPredicate
+     */
     public static final BinaryPredicate predicate(BinaryPredicate p, UnaryFunction f, UnaryFunction g) {
-        return new UnaryCompositeBinaryPredicate(p,f,g);
+        return new UnaryCompositeBinaryPredicate(p, f, g);
     }
 
+    /**
+     * Create a composite UnaryFunction.
+     * @param f UnaryFunction to apply to the output of <code>g</code>
+     * @param g UnaryFunction to apply first
+     * @return CompositeUnaryFunction
+     */
     public static final CompositeUnaryFunction function(UnaryFunction f, UnaryFunction g) {
-        return new CompositeUnaryFunction(f,g);
+        return new CompositeUnaryFunction(f, g);
     }
 
+    /**
+     * Create a composite<UnaryFunction> BinaryFunction.
+     * @param f BinaryFunction to apply to <i>output(</i><code>f</code><i>), output(</i><code>g</code><i>)</i>
+     * @param g left UnaryFunction
+     * @param h right UnaryFunction
+     * @return BinaryFunction
+     */
     public static final BinaryFunction function(BinaryFunction f, UnaryFunction g, UnaryFunction h) {
-        return new UnaryCompositeBinaryFunction(f,g,h);
+        return new UnaryCompositeBinaryFunction(f, g, h);
     }
 
+    /**
+     * Create a composite<BinaryFunction> BinaryFunction.
+     * @param f BinaryFunction to apply to <i>output(</i><code>f</code><i>), output(</i><code>g</code><i>)</i>
+     * @param g left BinaryFunction
+     * @param h right BinaryFunction
+     * @return BinaryFunction
+     */
     public static final BinaryFunction function(BinaryFunction f, BinaryFunction g, BinaryFunction h) {
-        return new BinaryCompositeBinaryFunction(f,g,h);
+        return new BinaryCompositeBinaryFunction(f, g, h);
     }
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java Mon Apr  7 16:29:25 2008
@@ -52,15 +52,31 @@
  */
 public class CompositeUnaryFunction implements UnaryFunction, Serializable {
 
+    // attributes
+    // ------------------------------------------------------------------------
+    private List list = new ArrayList();
+
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new CompositeUnaryFunction.
+     */
     public CompositeUnaryFunction() {
     }
 
+    /**
+     * Create a new CompositeUnaryFunction.
+     * @param f UnaryFunction to add
+     */
     public CompositeUnaryFunction(UnaryFunction f) {
         of(f);
     }
 
+    /**
+     * Create a new CompositeUnaryFunction.
+     * @param f UnaryFunction to add
+     * @param g UnaryFunction to add
+     */
     public CompositeUnaryFunction(UnaryFunction f, UnaryFunction g) {
         of(f);
         of(g);
@@ -68,13 +84,19 @@
 
     // modifiers
     // ------------------------------------------------------------------------
+    /**
+     * Fluently add a UnaryFunction.
+     * @param f UnaryFunction to add
+     * @return this
+     */
     public CompositeUnaryFunction of(UnaryFunction f) {
         list.add(f);
         return this;
     }
 
-    // predicate interface
-    // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object obj) {
         Object result = obj;
         for (ListIterator iter = list.listIterator(list.size()); iter.hasPrevious();) {
@@ -83,6 +105,9 @@
         return result;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof CompositeUnaryFunction) {
             return equals((CompositeUnaryFunction) that);
@@ -91,23 +116,29 @@
         }
     }
 
+    /**
+     * Learn whether another CompositeUnaryFunction is equal to this.
+     * @param that CompositeUnaryFunction to test
+     * @return boolean
+     */
     public boolean equals(CompositeUnaryFunction that) {
         // by construction, list is never null
         return null != that && list.equals(that.list);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         // by construction, list is never null
         return "CompositeUnaryFunction".hashCode() ^ list.hashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "CompositeUnaryFunction<" + list + ">";
     }
-
-
-    // attributes
-    // ------------------------------------------------------------------------
-    private List list = new ArrayList();
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java Mon Apr  7 16:29:25 2008
@@ -50,12 +50,11 @@
     private CompositeUnaryFunction function = null;
     private UnaryPredicate predicate = null;
 
-    //TODO have somebody who understands this class better write the missing javadoc!
     // constructor
     // ------------------------------------------------------------------------
     /**
      * Create a new CompositeUnaryPredicate.
-     * @param p
+     * @param p UnaryPredicate against which the composite functions' output will be tested
      */
     public CompositeUnaryPredicate(UnaryPredicate p) {
         if (null == p) { throw new NullPointerException(); }
@@ -65,8 +64,8 @@
 
     /**
      * Create a new CompositeUnaryPredicate.
-     * @param p
-     * @param f
+     * @param p UnaryPredicate against which the composite functions' output will be tested
+     * @param f UnaryFunction single UnaryFunction to apply
      */
     public CompositeUnaryPredicate(UnaryPredicate p, UnaryFunction f) {
         if (null == p) { throw new NullPointerException(); }
@@ -78,9 +77,9 @@
     // modifiers
     // ------------------------------------------------------------------------
     /**
-     * 
-     * @param f
-     * @return
+     * Fluently add a UnaryFunction to the chain.
+     * @param f UnaryFunction to add
+     * @return this
      */
     public CompositeUnaryPredicate of(UnaryFunction f) {
         function.of(f);

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java Mon Apr  7 16:29:25 2008
@@ -42,22 +42,38 @@
  * @author Rodney Waldhoff
  */
 public final class ConditionalBinaryFunction implements BinaryFunction, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private BinaryPredicate ifPred = null;
+    private BinaryFunction thenFunc = null;
+    private BinaryFunction elseFunc = null;
 
     // constructor
     // ------------------------------------------------------------------------
-
-    public ConditionalBinaryFunction(BinaryPredicate ifPred, BinaryFunction thenPred, BinaryFunction elsePred) {
+    /**
+     * Create a new ConditionalBinaryFunction.
+     * @param ifPred if
+     * @param thenFunc then
+     * @param elseFunc else
+     */
+    public ConditionalBinaryFunction(BinaryPredicate ifPred, BinaryFunction thenFunc, BinaryFunction elseFunc) {
         this.ifPred = ifPred;
-        this.thenFunc = thenPred;
-        this.elseFunc = elsePred;
+        this.thenFunc = thenFunc;
+        this.elseFunc = elseFunc;
     }
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object left, Object right) {
         return ifPred.test(left,right) ? thenFunc.evaluate(left,right) : elseFunc.evaluate(left,right);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof ConditionalBinaryFunction) {
             return equals((ConditionalBinaryFunction) that);
@@ -66,13 +82,21 @@
         }
     }
 
+    /**
+     * Learn whether another ConditionalBinaryFunction is equal to this.
+     * @param that ConditionalBinaryFunction to test
+     * @return boolean
+     */
     public boolean equals(ConditionalBinaryFunction that) {
-        return null != that &&
-                (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
-                (null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc)) &&
-                (null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
+        return null != that
+                && (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred))
+                && (null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc))
+                && (null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "ConditionalBinaryFunction".hashCode();
         if (null != ifPred) {
@@ -90,13 +114,11 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "ConditionalBinaryFunction<" + ifPred + "?" + thenFunc + ":" + elseFunc + ">";
     }
 
-    // attributes
-    // ------------------------------------------------------------------------
-    private BinaryPredicate ifPred = null;
-    private BinaryFunction thenFunc = null;
-    private BinaryFunction elseFunc = null;
 }

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=645735&r1=645734&r2=645735&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 16:29:25 2008
@@ -67,7 +67,7 @@
      * {@inheritDoc}
      */
     public boolean test(Object left, Object right) {
-        return ifPred.test(left,right) ? thenPred.test(left,right) : elsePred.test(left,right);
+        return ifPred.test(left, right) ? thenPred.test(left, right) : elsePred.test(left, right);
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java Mon Apr  7 16:29:25 2008
@@ -42,22 +42,38 @@
  * @author Rodney Waldhoff
  */
 public final class ConditionalFunction implements Function, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private Predicate ifPred = null;
+    private Function thenFunc = null;
+    private Function elseFunc = null;
 
     // constructor
     // ------------------------------------------------------------------------
-
-    public ConditionalFunction(Predicate ifPred, Function thenPred, Function elsePred) {
+    /**
+     * Create a new ConditionalFunction.
+     * @param ifPred if
+     * @param thenFunc then
+     * @param elseFunc else
+     */
+    public ConditionalFunction(Predicate ifPred, Function thenFunc, Function elseFunc) {
         this.ifPred = ifPred;
-        this.thenFunc = thenPred;
-        this.elseFunc = elsePred;
+        this.thenFunc = thenFunc;
+        this.elseFunc = elseFunc;
     }
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate() {
         return ifPred.test() ? thenFunc.evaluate() : elseFunc.evaluate();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof ConditionalFunction) {
             return equals((ConditionalFunction) that);
@@ -66,13 +82,21 @@
         }
     }
 
+    /**
+     * Learn whether another ConditionalFunction is equal to this.
+     * @param that ConditionalFunction to test
+     * @return boolean
+     */
     public boolean equals(ConditionalFunction that) {
-        return null != that &&
-                (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
-                (null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc)) &&
-                (null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
+        return null != that
+                && (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred))
+                && (null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc))
+                && (null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "ConditionalFunction".hashCode();
         if (null != ifPred) {
@@ -90,13 +114,11 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "ConditionalFunction<" + ifPred + "?" + thenFunc + ":" + elseFunc + ">";
     }
 
-    // attributes
-    // ------------------------------------------------------------------------
-    private Predicate ifPred = null;
-    private Function thenFunc = null;
-    private Function elseFunc = null;
 }

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=645735&r1=645734&r2=645735&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  7 16:29:25 2008
@@ -42,10 +42,20 @@
  * @author Rodney Waldhoff
  */
 public final class ConditionalUnaryFunction implements UnaryFunction, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private UnaryPredicate ifPred = null;
+    private UnaryFunction thenFunc = null;
+    private UnaryFunction elseFunc = null;
 
     // constructor
     // ------------------------------------------------------------------------
-
+    /**
+     * Create a new ConditionalUnaryFunction.
+     * @param ifPred if
+     * @param thenPred then
+     * @param elsePred else
+     */
     public ConditionalUnaryFunction(UnaryPredicate ifPred, UnaryFunction thenPred, UnaryFunction elsePred) {
         this.ifPred = ifPred;
         this.thenFunc = thenPred;
@@ -54,10 +64,16 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object obj) {
         return ifPred.test(obj) ? thenFunc.evaluate(obj) : elseFunc.evaluate(obj);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof ConditionalUnaryFunction) {
             return equals((ConditionalUnaryFunction) that);
@@ -66,13 +82,21 @@
         }
     }
 
+    /**
+     * Learn whether another ConditionalUnaryFunction is equal to this.
+     * @param that ConditionalUnaryFunction to test
+     * @return boolean
+     */
     public boolean equals(ConditionalUnaryFunction that) {
-        return null != that &&
-                (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
-                (null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc)) &&
-                (null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
+        return null != that
+                && (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred))
+                && (null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc))
+                && (null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "ConditionalUnaryFunction".hashCode();
         if (null != ifPred) {
@@ -90,13 +114,11 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "ConditionalUnaryFunction<" + ifPred + "?" + thenFunc + ":" + elseFunc + ">";
     }
 
-    // attributes
-    // ------------------------------------------------------------------------
-    private UnaryPredicate ifPred = null;
-    private UnaryFunction thenFunc = null;
-    private UnaryFunction elseFunc = null;
 }

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

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java Mon Apr  7 16:29:25 2008
@@ -40,24 +40,45 @@
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new Or.
+     */
     public Or() {
         super();
     }
 
+    /**
+     * Create a new Or.
+     * @param p Predicate to add
+     */
     public Or(Predicate p) {
         super(p);
     }
 
+    /**
+     * Create a new Or.
+     * @param p Predicate to add
+     * @param q Predicate to add
+     */
     public Or(Predicate p, Predicate q) {
-        super(p,q);
+        super(p, q);
     }
 
+    /**
+     * Create a new Or.
+     * @param p Predicate to add
+     * @param q Predicate to add
+     * @param r Predicate to add
+     */
     public Or(Predicate p, Predicate q, Predicate r) {
-        super(p,q,r);
+        super(p, q, r);
     }
 
-    // modifiers
-    // ------------------------------------------------------------------------
+    /**
+     * Fluently add a Predicate.
+     * @param p Predicate to add
+     * @return this
+     */
     public Or or(Predicate p) {
         super.addPredicate(p);
         return this;
@@ -65,6 +86,9 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test() {
         for (Iterator iter = getPredicateIterator(); iter.hasNext();) {
             if (((Predicate) iter.next()).test()) {
@@ -74,6 +98,9 @@
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof Or) {
             return equals((Or) that);
@@ -82,14 +109,25 @@
         }
     }
 
+    /**
+     * Learn whether another Or is equal to this.
+     * @param that Or to test
+     * @return boolean
+     */
     public boolean equals(Or that) {
         return getPredicateListEquals(that);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return "Or".hashCode() ^ getPredicateListHashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "Or<" + getPredicateListToString() + ">";
     }

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=645735&r1=645734&r2=645735&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  7 16:29:25 2008
@@ -40,19 +40,32 @@
  * @author Rodney Waldhoff
  */
 public class TransposedFunction implements BinaryFunction, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private BinaryFunction function = null;
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new TransposedFunction.
+     * @param f BinaryFunction to transpose.
+     */
     public TransposedFunction(BinaryFunction f) {
         function = f;
     }
 
     // functor interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object left, Object right) {
-        return function.evaluate(right,left);
+        return function.evaluate(right, left);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof TransposedFunction) {
             return equals((TransposedFunction) that);
@@ -61,10 +74,18 @@
         }
     }
 
+    /**
+     * Learn whether another TransposedFunction is equal to this.
+     * @param that TransposedFunction to test
+     * @return boolean
+     */
     public boolean equals(TransposedFunction that) {
         return null != that && (null == function ? null == that.function : function.equals(that.function));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "TransposedFunction".hashCode();
         if (null != function) {
@@ -73,18 +94,22 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "TransposedFunction<" + function + ">";
     }
 
     // static
     // ------------------------------------------------------------------------
+    /**
+     * Transpose a BinaryFunction.
+     * @param f BinaryFunction to transpose
+     * @return TransposedFunction
+     */
     public static TransposedFunction transpose(BinaryFunction f) {
         return null == f ? null : new TransposedFunction(f);
     }
-
-    // attributes
-    // ------------------------------------------------------------------------
-    private BinaryFunction function = null;
 
 }

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=645735&r1=645734&r2=645735&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  7 16:29:25 2008
@@ -40,19 +40,32 @@
  * @author Rodney Waldhoff
  */
 public class TransposedProcedure implements BinaryProcedure, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private BinaryProcedure procedure = null;
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new TransposedProcedure.
+     * @param p BinaryProcedure to transpose
+     */
     public TransposedProcedure(BinaryProcedure p) {
         procedure = p;
     }
 
     // functor interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public void run(Object left, Object right) {
         procedure.run(right,left);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof TransposedProcedure) {
             return equals((TransposedProcedure) that);
@@ -61,10 +74,18 @@
         }
     }
 
+    /**
+     * Learn whether another TransposedProcedure is equal to this.
+     * @param that TransposedPredicate to test
+     * @return boolean
+     */
     public boolean equals(TransposedProcedure that) {
         return null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "TransposedProcedure".hashCode();
         if (null != procedure) {
@@ -73,18 +94,22 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "TransposedProcedure<" + procedure + ">";
     }
 
     // static
     // ------------------------------------------------------------------------
+    /**
+     * Transpose a BinaryProcedure.
+     * @param p to transpose
+     * @return TransposedProcedure
+     */
     public static TransposedProcedure transpose(BinaryProcedure p) {
         return null == p ? null : new TransposedProcedure(p);
     }
-
-    // attributes
-    // ------------------------------------------------------------------------
-    private BinaryProcedure procedure = null;
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryAnd.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryAnd.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryAnd.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryAnd.java Mon Apr  7 16:29:25 2008
@@ -40,24 +40,47 @@
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new UnaryAnd.
+     */
     public UnaryAnd() {
         super();
     }
 
+    /**
+     * Create a new UnaryAnd.
+     * @param p UnaryPredicate to add
+     */
     public UnaryAnd(UnaryPredicate p) {
         super(p);
     }
 
+    /**
+     * Create a new UnaryAnd.
+     * @param p UnaryPredicate to add
+     * @param q UnaryPredicate to add
+     */
     public UnaryAnd(UnaryPredicate p, UnaryPredicate q) {
         super(p,q);
     }
 
+    /**
+     * Create a new UnaryAnd.
+     * @param p UnaryPredicate to add
+     * @param q UnaryPredicate to add
+     * @param r UnaryPredicate to add
+     */
     public UnaryAnd(UnaryPredicate p, UnaryPredicate q, UnaryPredicate r) {
         super(p,q,r);
     }
 
     // modifiers
     // ------------------------------------------------------------------------
+    /**
+     * Fluently add a UnaryPredicate.
+     * @param p UnaryPredicate to add
+     * @return this
+     */
     public UnaryAnd and(UnaryPredicate p) {
         super.addUnaryPredicate(p);
         return this;
@@ -65,6 +88,9 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object obj) {
         for (Iterator iter = getUnaryPredicateIterator(); iter.hasNext();) {
             if (!((UnaryPredicate) iter.next()).test(obj)) {
@@ -74,6 +100,9 @@
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof UnaryAnd) {
             return equals((UnaryAnd) that);
@@ -82,14 +111,25 @@
         }
     }
 
+    /**
+     * Learn whether another UnaryAnd is equal to this.
+     * @param that UnaryAnd to test
+     * @return boolean
+     */
     public boolean equals(UnaryAnd that) {
         return getUnaryPredicateListEquals(that);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return "UnaryAnd".hashCode() ^ getUnaryPredicateListHashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "UnaryAnd<" + getUnaryPredicateListToString() + ">";
     }

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=645735&r1=645734&r2=645735&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  7 16:29:25 2008
@@ -39,9 +39,20 @@
  * @author Rodney Waldhoff
  */
 public class UnaryCompositeBinaryPredicate implements BinaryPredicate, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private BinaryPredicate binary = null;
+    private UnaryFunction leftUnary = null;
+    private UnaryFunction rightUnary = null;
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new UnaryCompositeBinaryPredicate.
+     * @param f BinaryPredicate to test <i>output(</i><code>f</code><i>), output(</i><code>g</code><i>)</i>
+     * @param g left UnaryFunction
+     * @param h right UnaryFunction
+     */
     public UnaryCompositeBinaryPredicate(BinaryPredicate f, UnaryFunction g, UnaryFunction h) {
         binary = f;
         leftUnary = g;
@@ -50,10 +61,16 @@
 
     // function interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object left, Object right) {
         return binary.test(leftUnary.evaluate(left), rightUnary.evaluate(right));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof UnaryCompositeBinaryPredicate) {
             return equals((UnaryCompositeBinaryPredicate) that);
@@ -62,13 +79,21 @@
         }
     }
 
+    /**
+     * Learn whether another UnaryCompositeBinaryPredicate is equal to this.
+     * @param that UnaryCompositeBinaryPredicate to test
+     * @return boolean
+     */
     public boolean equals(UnaryCompositeBinaryPredicate that) {
-        return (null != that) &&
-            (null == binary ? null == that.binary : binary.equals(that.binary)) &&
-            (null == leftUnary ? null == that.leftUnary : leftUnary.equals(that.leftUnary)) &&
-            (null == rightUnary ? null == that.rightUnary : rightUnary.equals(that.rightUnary));
+        return (null != that)
+                && (null == binary ? null == that.binary : binary.equals(that.binary))
+                && (null == leftUnary ? null == that.leftUnary : leftUnary.equals(that.leftUnary))
+                && (null == rightUnary ? null == that.rightUnary : rightUnary.equals(that.rightUnary));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "UnaryCompositeBinaryPredicate".hashCode();
         if (null != binary) {
@@ -86,14 +111,11 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "UnaryCompositeBinaryPredicate<" + binary + ";" + leftUnary + ";" + rightUnary + ">";
     }
-
-    // attributes
-    // ------------------------------------------------------------------------
-    private BinaryPredicate binary = null;
-    private UnaryFunction leftUnary = null;
-    private UnaryFunction rightUnary = null;
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryOr.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryOr.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryOr.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryOr.java Mon Apr  7 16:29:25 2008
@@ -40,24 +40,47 @@
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new UnaryOr.
+     */
     public UnaryOr() {
         super();
     }
 
+    /**
+     * Create a new UnaryOr.
+     * @param p Predicate to add
+     */
     public UnaryOr(UnaryPredicate p) {
         super(p);
     }
 
+    /**
+     * Create a new UnaryOr.
+     * @param p Predicate to add
+     * @param q Predicate to add
+     */
     public UnaryOr(UnaryPredicate p, UnaryPredicate q) {
         super(p,q);
     }
 
+    /**
+     * Create a new UnaryOr.
+     * @param p Predicate to add
+     * @param q Predicate to add
+     * @param r Predicate to add
+     */
     public UnaryOr(UnaryPredicate p, UnaryPredicate q, UnaryPredicate r) {
         super(p,q,r);
     }
 
     // modifiers
     // ------------------------------------------------------------------------
+    /**
+     * Fluently add a Predicate.
+     * @param p Predicate to add
+     * @return this
+     */
     public UnaryOr or(UnaryPredicate p) {
         super.addUnaryPredicate(p);
         return this;
@@ -65,6 +88,9 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object a) {
         for (Iterator iter = getUnaryPredicateIterator(); iter.hasNext();) {
             if (((UnaryPredicate) iter.next()).test(a)) {
@@ -74,6 +100,9 @@
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof UnaryOr) {
             return equals((UnaryOr) that);
@@ -82,14 +111,25 @@
         }
     }
 
+    /**
+     * Learn whether another UnaryOr is equal to this.
+     * @param that UnaryOr to test
+     * @return boolean
+     */
     public boolean equals(UnaryOr that) {
         return getUnaryPredicateListEquals(that);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return "UnaryOr".hashCode() ^ getUnaryPredicateListHashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "UnaryOr<" + getUnaryPredicateListToString() + ">";
     }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/WhileDoProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/WhileDoProcedure.java?rev=645735&r1=645734&r2=645735&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/WhileDoProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/WhileDoProcedure.java Mon Apr  7 16:29:25 2008
@@ -37,17 +37,26 @@
  * @author Rodney Waldhoff
  */
 public class WhileDoProcedure extends AbstractLoopProcedure {
+    /**
+     * Create a new WhileDoProcedure.
+     * @param condition while
+     * @param action to do
+     */
     public WhileDoProcedure(Predicate condition, Procedure action) {
         super(condition, action);
     }
 
-
+    /**
+     * {@inheritDoc}
+     */
     public void run() {
         while(getCondition().test())
             getAction().run();
     }
 
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object object) {
         if (object instanceof WhileDoProcedure) {
         	return super.equals(object);
@@ -56,13 +65,17 @@
         }
     }
 
-
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
     	return super.hashCode("WhileDoProcedure".hashCode());
     }
 
-
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
-        return "WhileDoProcedure<while("+getCondition()+") do("+getAction()+")>";
+        return "WhileDoProcedure<while(" + getCondition() + ") do(" + getAction() + ")>";
     }
 }

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=645735&r1=645734&r2=645735&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  7 16:29:25 2008
@@ -31,12 +31,14 @@
  * @version $Revision$ $Date$
  * @author  Jason Horman (jason@jhorman.org)
  */
-
 public abstract class BaseGenerator implements Generator {
 
     /** A generator can wrap another generator. */
     private Generator wrappedGenerator = null;
 
+    /** Set to true when the generator is {@link #stop stopped}. */
+    private boolean stopped = false;
+
     /** Create a new generator. */
     public BaseGenerator() {
     }
@@ -45,84 +47,125 @@
      * A generator can wrap another generator. When wrapping generators you
      * should use probably this constructor since doing so will cause the
      * {@link #stop} method to stop the wrapped generator as well.
+     * @param generator Generator to wrap
      */
     public BaseGenerator(Generator generator) {
         this.wrappedGenerator = generator;
     }
 
-    /** Get the generator that is being wrapped. */
+    /**
+     * Get the generator that is being wrapped.
+     * @return Generator
+     */
     protected Generator getWrappedGenerator() {
         return wrappedGenerator;
     }
 
-    /** Generators must implement this method. */
+    /**
+     * {@inheritDoc}
+     * Generators must implement this method.
+     */
     public abstract void run(UnaryProcedure proc);
 
-    /** Stop the generator. Will stop the wrapped generator if one was set. */
+    /**
+     * {@inheritDoc}
+     * Stop the generator. Will stop the wrapped generator if one was set.
+     */
     public void stop() {
         if (wrappedGenerator != null) { wrappedGenerator.stop(); }
         stopped = true;
     }
 
-    /** Check if the generator is stopped. */
+    /**
+     * {@inheritDoc}
+     * Check if the generator is stopped.
+     */
     public boolean isStopped() {
         return stopped;
     }
 
-    /** Set to true when the generator is {@link #stop stopped}. */
-    private boolean stopped = false;
-
-    /*** See {@link Algorithms#apply}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#apply}.
+     */
     public final Generator apply(UnaryFunction func) {
         return Algorithms.apply(this,func);
     }
 
-    /** See {@link Algorithms#contains}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#contains}.
+     */
     public final boolean contains(UnaryPredicate pred) {
         return Algorithms.contains(this, pred);
     }
 
-    /** See {@link Algorithms#detect}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#detect}.
+     */
     public final Object detect(UnaryPredicate pred) {
         return Algorithms.detect(this, pred);
     }
 
-    /** See {@link Algorithms#detect}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#detect}.
+     */
     public final Object detect(UnaryPredicate pred, Object ifNone) {
         return Algorithms.detect(this, pred, ifNone);
     }
 
-    /** Synonym for run. */
+    /**
+     * {@inheritDoc}
+     * Synonym for run.
+     */
     public final void foreach(UnaryProcedure proc) {
         Algorithms.foreach(this, proc);
     }
 
-    /** See {@link Algorithms#inject}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#inject}.
+     */
     public final Object inject(Object seed, BinaryFunction func) {
         return Algorithms.inject(this, seed, func);
     }
 
-    /** See {@link Algorithms#reject}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#reject}.
+     */
     public final Generator reject(UnaryPredicate pred) {
         return Algorithms.reject(this, pred);
     }
 
-    /** See {@link Algorithms#select}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#select}.
+     */
     public final Generator select(UnaryPredicate pred) {
         return Algorithms.select(this, pred);
     }
 
-    /** See {@link Algorithms#select}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#select}.
+     */
     public final Generator where(UnaryPredicate pred) {
         return Algorithms.select(this, pred);
     }
 
-    /** See {@link Algorithms#until}. */
+    /**
+     * {@inheritDoc}
+     * See {@link Algorithms#until}.
+     */
     public final Generator until(UnaryPredicate pred) {
         return Algorithms.until(this, pred);
     }
 
     /**
+     * {@inheritDoc}
      * Transforms this generator using the passed in
      * UnaryFunction. An example function might turn the contents of the
      * generator into a {@link Collection} of elements.
@@ -131,12 +174,18 @@
         return transformer.evaluate(this);
     }
 
-    /** Same as to(new CollectionTransformer(collection)). */
+    /**
+     * {@inheritDoc}
+     * Same as to(new CollectionTransformer(collection)).
+     */
     public final Collection to(Collection collection) {
         return (Collection) to(new CollectionTransformer(collection));
     }
 
-    /** Same as to(new CollectionTransformer()). */
+    /**
+     * {@inheritDoc}
+     * Same as to(new CollectionTransformer()).
+     */
     public final Collection toCollection() {
         return (Collection) to(new CollectionTransformer());
     }

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=645735&r1=645734&r2=645735&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 16:29:25 2008
@@ -133,7 +133,7 @@
     // private methods
     //---------------------------------------------------------------
     /**
-     * Get <code>value/|value|</code> (0 when value == 0). 
+     * Get <code>value/|value|</code> (0 when value == 0).
      * @param value to test
      * @return int
      */

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=645735&r1=645734&r2=645735&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  7 16:29:25 2008
@@ -17,7 +17,6 @@
 import org.apache.commons.functor.UnaryProcedure;
 import org.apache.commons.functor.generator.BaseGenerator;
 
-
 /**
  * A generator for the range <i>from</i> (inclusive) to <i>to</i> (exclusive).
  *
@@ -27,22 +26,49 @@
  * @author Rodney Waldhoff
  */
 public final class LongRange extends BaseGenerator {
+    // attributes
+    //---------------------------------------------------------------
+
+    private long from;
+    private long to;
+    private long step;
 
     // constructors
     //---------------------------------------------------------------
-
+    /**
+     * Create a new LongRange.
+     * @param from start
+     * @param to end
+     */
     public LongRange(Number from, Number to) {
-        this(from.longValue(),to.longValue());
+        this(from.longValue(), to.longValue());
     }
 
+    /**
+     * Create a new LongRange.
+     * @param from start
+     * @param to end
+     * @param step increment
+     */
     public LongRange(Number from, Number to, Number step) {
-        this(from.longValue(),to.longValue(),step.longValue());
+        this(from.longValue(), to.longValue(), step.longValue());
     }
 
+    /**
+     * Create a new LongRange.
+     * @param from start
+     * @param to end
+     */
     public LongRange(long from, long to) {
-        this(from,to,defaultStep(from,to));
+        this(from, to, defaultStep(from, to));
     }
 
+    /**
+     * Create a new LongRange.
+     * @param from start
+     * @param to end
+     * @param step increment
+     */
     public LongRange(long from, long to, long step) {
         if (from != to && signOf(step) != signOf(to-from)) {
             throw new IllegalArgumentException("Will never reach " + to + " from " + from + " using step " + step);
@@ -55,23 +81,31 @@
 
     // methods
     //---------------------------------------------------------------
-
+    /**
+     * {@inheritDoc}
+     */
     public void run(UnaryProcedure proc) {
         if (signOf(step) == -1L) {
-            for (long i=from; i > to; i += step) {
+            for (long i = from; i > to; i += step) {
                 proc.run(new Long(i));
             }
         } else {
-            for (long i=from; i < to; i += step) {
+            for (long i = from; i < to; i += step) {
                 proc.run(new Long(i));
             }
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "LongRange<" + from + "," + to + "," + step + ">";
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object obj) {
         if (obj instanceof LongRange) {
             LongRange that = (LongRange) obj;
@@ -81,6 +115,9 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "LongRange".hashCode();
         hash <<= 2;
@@ -94,17 +131,27 @@
 
     // private methods
     //---------------------------------------------------------------
-
+    /**
+     * Get <code>value/|value|</code> (0L when value == 0L).
+     * @param value to test
+     * @return long
+     */
     private static long signOf(long value) {
-        if (value < 0) {
-            return -1;
-        } else if (value > 0) {
-            return 1;
+        if (value < 0L) {
+            return -1L;
+        } else if (value > 0L) {
+            return 1L;
         } else {
-            return 0;
+            return 0L;
         }
     }
 
+    /**
+     * Calculate default step to get from <code>from</code> to <code>to</code>.
+     * @param from start
+     * @param to end
+     * @return long
+     */
     private static long defaultStep(long from, long to) {
         if (from > to) {
             return -1L;
@@ -112,13 +159,5 @@
             return 1L;
         }
     }
-
-    // attributes
-    //---------------------------------------------------------------
-
-    private long from;
-    private long to;
-    private long step;
-
 
 }



Mime
View raw message