commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r646358 - in /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor: ./ adapter/ core/ core/collection/ core/comparator/ core/composite/ generator/ generator/util/
Date Wed, 09 Apr 2008 14:02:14 GMT
Author: mbenson
Date: Wed Apr  9 07:02:10 2008
New Revision: 646358

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

Added:
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/package.html   (with props)
Modified:
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/Algorithms.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsWithinRange.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransposedProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryAnd.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryFunction.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryNot.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryOr.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/WhileDoProcedure.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/BaseGenerator.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/Generator.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/LongRange.java

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/Algorithms.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/Algorithms.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/Algorithms.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/Algorithms.java Wed Apr  9 07:02:10 2008
@@ -60,12 +60,23 @@
     public Algorithms() {
     }
 
+    /**
+     * Collect the elements of <code>iter</code> into a Collection.
+     * @param iter Iterator to collect from
+     * @return Collection
+     */
     public static Collection collect(Iterator iter) {
-        return collect(iter,new ArrayList());
+        return collect(iter, new ArrayList());
     }
 
+    /**
+     * Collect the elements of <code>iter</code> into a Collection.
+     * @param iter Iterator to collect from
+     * @param col Collection to fill
+     * @return Collection
+     */
     public static Collection collect(Iterator iter, Collection col) {
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             col.add(iter.next());
         }
         return col;
@@ -77,9 +88,11 @@
      * the result of applying the
      * given {@link UnaryFunction UnaryFunction} to
      * its original value.
+     * @param iter ListIterator to transform
+     * @param func to apply
      */
     public static void transform(ListIterator iter, UnaryFunction func) {
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             iter.set(func.evaluate(iter.next()));
         }
     }
@@ -91,9 +104,11 @@
      * given {@link UnaryPredicate UnaryPredicate}.
      *
      * @see #remove(Iterator,UnaryPredicate)
+     * @param iter to process
+     * @param pred to apply
      */
     public static void retain(Iterator iter, UnaryPredicate pred) {
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             if (!(pred.test(iter.next()))) {
                 iter.remove();
             }
@@ -107,9 +122,11 @@
      * given {@link UnaryPredicate UnaryPredicate}.
      *
      * @see #retain(Iterator,UnaryPredicate)
+     * @param iter to process
+     * @param pred to apply
      */
     public static void remove(Iterator iter, UnaryPredicate pred) {
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             if (pred.test(iter.next())) {
                 iter.remove();
             }
@@ -119,20 +136,25 @@
     /**
      * Returns an {@link Iterator} that will apply the given {@link UnaryFunction} to each
      * element when accessed.
+     * @param iter to wrap
+     * @param func to apply
+     * @return Iterator
      */
     public static final Iterator apply(Iterator iter, UnaryFunction func) {
-        return TransformedIterator.transform(iter,func);
+        return TransformedIterator.transform(iter, func);
     }
 
     /**
      * Returns a {@link Generator} that will apply the given {@link UnaryFunction} to each
-     * generated element.
+     * generated element from <code>gen</code>.
+     * @param gen to wrap
+     * @param func to apply
+     * @return Generator
      */
     public static final Generator apply(final Generator gen, final UnaryFunction func) {
         return new BaseGenerator(gen) {
-        public void run(final UnaryProcedure proc) {
-            gen.run(
-                new UnaryProcedure() {
+            public void run(final UnaryProcedure proc) {
+                gen.run(new UnaryProcedure() {
                     public void run(Object obj) {
                         proc.run(func.evaluate(obj));
                     }
@@ -143,10 +165,15 @@
 
     /**
      * Equivalent to
-     * <code>{@link #contains(Generator,UnaryPredicate) contains}(new {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)</code>.
+     * <code>{@link #contains(Generator, UnaryPredicate) contains}(new
+     * {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter), pred)
+     * </code>.
+     * @param iter Iterator to search
+     * @param pred to test
+     * @return <code>true</code> if matched
      */
     public static final boolean contains(Iterator iter, UnaryPredicate pred) {
-        return contains(new IteratorToGeneratorAdapter(iter),pred);
+        return contains(new IteratorToGeneratorAdapter(iter), pred);
     }
 
     /**
@@ -154,22 +181,36 @@
      * that matches the given {@link UnaryPredicate UnaryPredicate}.
      *
      * @see #detect(Generator,UnaryPredicate)
+     * @param gen Generator to search
+     * @param pred to test
+     * @return <code>true</code> if matched
      */
     public static final boolean contains(Generator gen, UnaryPredicate pred) {
-        FindWithinGenerator finder = new FindWithinGenerator(gen,pred);
+        FindWithinGenerator finder = new FindWithinGenerator(gen, pred);
         gen.run(finder);
         return finder.wasFound();
     }
 
     /**
-     * Equivalent to <code>{@link #detect(Generator,UnaryPredicate) detect}(new {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred)</code>.
+     * Equivalent to <code>{@link #detect(Generator, UnaryPredicate) detect}(new
+     * {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter), pred)
+     * </code>.
+     * @param iter Iterator to search
+     * @param pred to test
+     * @return first match
      */
     public static final Object detect(Iterator iter, UnaryPredicate pred) {
         return detect(new IteratorToGeneratorAdapter(iter), pred);
     }
 
     /**
-     * Equivalent to <code>{@link #detect(Generator,UnaryPredicate,Object) detect}(new {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),pred,ifNone)</code>.
+     * Equivalent to <code>{@link #detect(Generator, UnaryPredicate,Object) detect}(new
+     * {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),
+     * pred, ifNone)</code>.
+     * @param iter Iterator to search
+     * @param pred to test
+     * @param ifNone default result
+     * @return first match, or <code>ifNone</code>
      */
     public static final Object detect(Iterator iter, UnaryPredicate pred, Object ifNone) {
         return detect(new IteratorToGeneratorAdapter(iter), pred, ifNone);
@@ -183,9 +224,12 @@
      *
      * @see #detect(Generator,UnaryPredicate,Object)
      * @throws NoSuchElementException If no element could be found.
+     * @param gen Generator to search
+     * @param pred to test
+     * @return first match
      */
     public static final Object detect(final Generator gen, final UnaryPredicate pred) {
-        FindWithinGenerator finder = new FindWithinGenerator(gen,pred);
+        FindWithinGenerator finder = new FindWithinGenerator(gen, pred);
         gen.run(finder);
         if (finder.wasFound()) {
             return finder.getFoundObject();
@@ -201,15 +245,23 @@
      * can be found.
      *
      * @see #detect(Generator,UnaryPredicate)
+     * @param gen Generator to search
+     * @param pred to test
+     * @param ifNone default result
+     * @return first match, or <code>ifNone</code>
      */
     public static final Object detect(final Generator gen, final UnaryPredicate pred, Object ifNone) {
-        FindWithinGenerator finder = new FindWithinGenerator(gen,pred);
+        FindWithinGenerator finder = new FindWithinGenerator(gen, pred);
         gen.run(finder);
         return finder.wasFound() ? finder.getFoundObject() : ifNone;
     }
 
     /**
-     * Equivalent to <code>{@link #foreach(Generator,UnaryProcedure) foreach}(new {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter),proc)</code>.
+     * Equivalent to <code>{@link #foreach(Generator, UnaryProcedure) foreach}(new
+     * {@link org.apache.commons.functor.generator.IteratorToGeneratorAdapter IteratorToGeneratorAdapter}(iter), proc)
+     * </code>.
+     * @param iter Iterator to process
+     * @param proc to run for each element
      */
     public static final void foreach(Iterator iter, UnaryProcedure proc) {
         foreach(new IteratorToGeneratorAdapter(iter), proc);
@@ -218,6 +270,8 @@
     /**
      * {@link UnaryProcedure#run Apply} the given {@link UnaryProcedure
      * UnaryProcedure} to each element in the given {@link Generator}.
+     * @param gen Generator to process
+     * @param proc to run for each element
      */
     public static final void foreach(Generator gen, UnaryProcedure proc) {
         gen.run(proc);
@@ -233,15 +287,19 @@
      * <p>
      * In code:
      * <pre>
-     * while(iter.hasNext()) {
-     *   seed = func.evaluate(seed,iter.next());
+     * while (iter.hasNext()) {
+     *   seed = func.evaluate(seed, iter.next());
      * }
      * return seed;
      * </pre>
+     * @param iter Iterator of right arguments
+     * @param seed initial left argument
+     * @param func BinaryFunction to apply
+     * @return final production
      */
     public static final Object inject(Iterator iter, Object seed, BinaryFunction func) {
-        while(iter.hasNext()) {
-            seed = func.evaluate(seed,iter.next());
+        while (iter.hasNext()) {
+            seed = func.evaluate(seed, iter.next());
         }
         return seed;
     }
@@ -256,14 +314,18 @@
      * <p>
      * In code:
      * <pre>
-     * while(iter.hasNext()) {
-     *   seed = func.evaluate(seed,iter.next());
+     * while (iter.hasNext()) {
+     *   seed = func.evaluate(seed, iter.next());
      * }
      * return seed;
      * </pre>
+     * @param gen Generator of right arguments
+     * @param seed initial left argument
+     * @param func BinaryFunction to apply
+     * @return final production
      */
     public static final Object inject(Generator gen, final Object seed, final BinaryFunction func) {
-        Injector injector = new Injector(seed,func);
+        Injector injector = new Injector(seed, func);
         gen.run(injector);
         return injector.getResult();
     }
@@ -271,19 +333,25 @@
     /**
      * Returns an {@link Iterator} that will only return elements that DO
      * NOT match the given predicate.
+     * @param iter Iterator to wrap
+     * @param pred to test
+     * @return filtered Iterator
      */
     public static Iterator reject(Iterator iter, UnaryPredicate pred) {
-        return FilteredIterator.filter(iter,UnaryNot.not(pred));
+        return FilteredIterator.filter(iter, UnaryNot.not(pred));
     }
 
     /**
      * Returns a {@link Generator} that will only "generate" elements that DO
      * NOT match the given predicate.
+     * @param gen Generator to wrap
+     * @param pred to test
+     * @return Generator that will not process matching elements
      */
     public static Generator reject(final Generator gen, final UnaryPredicate pred) {
         return new BaseGenerator(gen) {
             public void run(final UnaryProcedure proc) {
-                gen.run(new ConditionalUnaryProcedure(pred,NoOp.instance(),proc));
+                gen.run(new ConditionalUnaryProcedure(pred, NoOp.instance(), proc));
             }
         };
     }
@@ -291,53 +359,89 @@
     /**
      * Returns an {@link Iterator} that will only return elements that DO
      * match the given predicate.
+     * @param iter to wrap
+     * @param pred to test
+     * @return filtered Iterator
      */
     public static final Iterator select(Iterator iter, UnaryPredicate pred) {
-        return FilteredIterator.filter(iter,pred);
+        return FilteredIterator.filter(iter, pred);
     }
 
     /**
      * Returns a {@link Generator} that will only "generate" elements that DO
      * match the given predicate.
+     * @param gen Generator to wrap
+     * @param pred to test
+     * @return Generator that will only process matching elements
      */
     public static final Generator select(final Generator gen, final UnaryPredicate pred) {
         return new BaseGenerator(gen) {
             public void run(final UnaryProcedure proc) {
-                gen.run(new ConditionalUnaryProcedure(pred,proc,NoOp.instance()));
+                gen.run(new ConditionalUnaryProcedure(pred, proc, NoOp.instance()));
             }
         };
     }
 
+    /**
+     * Repeat <code>proc</code> until <code>pred</code> evaluates to <code>true</code> (test after).
+     * @param proc to perform
+     * @param pred exit test
+     */
     public static final void dountil(Procedure proc, Predicate pred) {
-        dowhile(proc,Not.not(pred));
+        dowhile(proc, Not.not(pred));
     }
 
+    /**
+     * Repeat <code>proc</code> as long as <code>pred</code> evaluates to <code>true</code> (test after).
+     * @param proc to perform
+     * @param pred continuation test
+     */
     public static final void dowhile(Procedure proc, Predicate pred) {
-        do { proc.run(); } while(pred.test());
+        do {
+            proc.run();
+        } while (pred.test());
     }
 
+    /**
+     * Repeat <code>proc</code> until <code>pred</code> evaluates to <code>true</code> (test before).
+     * @param pred exit test
+     * @param proc to perform
+     */
     public static final void untildo(Predicate pred, Procedure proc) {
-        whiledo(Not.not(pred),proc);
+        whiledo(Not.not(pred), proc);
     }
 
+    /**
+     * Repeat <code>proc</code> as long as <code>pred</code> evaluates to <code>true</code> (test before).
+     * @param pred continuation test
+     * @param proc to perform
+     */
     public static final void whiledo(Predicate pred, Procedure proc) {
-        while(pred.test()) { proc.run(); }
+        while (pred.test()) {
+            proc.run();
+        }
     }
 
     /**
      * Equivalent to
-     * <code>{@link #reject(Iterator,UnaryPredicate) reject}(iter,pred)</code>.
+     * <code>{@link #reject(Iterator, UnaryPredicate) reject}(iter, pred)</code>.
+     * @param iter Iterator to wrap
+     * @param pred to test
+     * @return filtered Iterator
      */
     public static final Iterator until(final Iterator iter, final UnaryPredicate pred) {
-        return reject(iter,pred);
+        return reject(iter, pred);
     }
 
     /**
      * Equivalent to
-     * <code>{@link #reject(Generator,UnaryPredicate) reject}(gen,pred)</code>.
+     * <code>{@link #reject(Generator, UnaryPredicate) reject}(gen, pred)</code>.
+     * @param gen Generator to wrap
+     * @param pred to test
+     * @return Generator that will not process matching elements
      */
     public static final Generator until(final Generator gen, final UnaryPredicate pred) {
-        return reject(gen,pred);
+        return reject(gen, pred);
     }
 
     /**
@@ -345,6 +449,8 @@
      * returns another function of the same type as the original, that function
      * is executed. Functions are executed until a non function value or a
      * function of a different type is returned.
+     * @param function initial Function
+     * @return final result
      */
     public static final Object recurse(Function function) {
         Object result = null;
@@ -352,7 +458,7 @@
 
         // if the function returns another function, execute it. stop executing
         // when the function doesn't return another function of the same type.
-        while(true) {
+        while (true) {
             result = function.evaluate();
             if (recursiveFunctionClass.isInstance(result)) {
                 function = (Function) result;
@@ -361,14 +467,25 @@
                 break;
             }
         }
-
         return result;
     }
 
     // inner classes
     //---------------------------------------------------------------
-
+    /**
+     * Helper to search a Generator.
+     */
     private static class FindWithinGenerator implements UnaryProcedure {
+        private UnaryPredicate predicate = null;
+        private boolean found = false;
+        private Object foundObject = null;
+        private Generator generator = null;
+
+        /**
+         * Create a new FindWithinGenerator.
+         * @param gen to search
+         * @param pred to test
+         */
         FindWithinGenerator(Generator gen, UnaryPredicate pred) {
             this.generator = gen;
             this.predicate = pred;
@@ -376,6 +493,9 @@
             this.foundObject = null;
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public void run(Object obj) {
             if (predicate.test(obj)) {
                 found = true;
@@ -384,36 +504,56 @@
             }
         }
 
+        /**
+         * Learn whether a match was found.
+         * @return boolean
+         */
         boolean wasFound() {
             return found;
         }
 
+        /**
+         * Return the first match, if any, that was found.
+         * @return Object
+         */
         Object getFoundObject() {
             return foundObject;
         }
 
-        private UnaryPredicate predicate = null;
-        private boolean found = false;
-        private Object foundObject = null;
-        private Generator generator = null;
     }
 
+    /**
+     * Helper class for {@link #inject(Generator, Object, BinaryFunction)}.
+     */
     private static class Injector implements UnaryProcedure {
+        private Object seed = null;
+        private BinaryFunction function = null;
+
+        /**
+         * Create a new Injector.
+         * @param seed initial left argument
+         * @param function to apply
+         */
         Injector(Object seed, BinaryFunction function) {
             this.seed = seed;
             this.function = function;
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public void run(Object obj) {
-            seed = function.evaluate(seed,obj);
+            seed = function.evaluate(seed, obj);
         }
 
+        /**
+         * Get current result.
+         * @return Object
+         */
         Object getResult() {
             return seed;
         }
 
-        private Object seed = null;
-        private BinaryFunction function = null;
     }
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java Wed Apr  9 07:02:10 2008
@@ -39,14 +39,27 @@
  * @author Rodney Waldhoff
  */
 public final class IgnoreLeftFunction implements BinaryFunction, Serializable {
+    /** The {@link UnaryFunction UnaryFunction} I'm wrapping. */
+    private UnaryFunction function = null;
+
+    /**
+     * Create a new IgnoreLeftFunction.
+     * @param function UnaryFunction for right argument
+     */
     public IgnoreLeftFunction(UnaryFunction function) {
         this.function = function;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object left, Object right) {
         return function.evaluate(right);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof IgnoreLeftFunction) {
             return equals((IgnoreLeftFunction) that);
@@ -55,10 +68,19 @@
         }
     }
 
+    /**
+     * Learn whether another IgnoreLeftFunction is equal to this.
+     * @param that IgnoreLeftFunction to test
+     * @return boolean
+     */
     public boolean equals(IgnoreLeftFunction 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 = "IgnoreLeftFunction".hashCode();
         if (null != function) {
@@ -67,14 +89,20 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "IgnoreLeftFunction<" + function + ">";
     }
 
+    /**
+     * Adapt a UnaryFunction to the BinaryFunction interface.
+     * @param function to adapt
+     * @return BinaryFunction
+     */
     public static BinaryFunction adapt(UnaryFunction function) {
         return null == function ? null : new IgnoreLeftFunction(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/IgnoreLeftPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java Wed Apr  9 07:02:10 2008
@@ -105,5 +105,4 @@
         return null == predicate ? null : new IgnoreLeftPredicate(predicate);
     }
 
-    //TODO add static adapt(UnaryPredicate) method
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java Wed Apr  9 07:02:10 2008
@@ -74,7 +74,8 @@
      * @return boolean
      */
     public boolean equals(IgnoreLeftProcedure that) {
-        return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
+        return that == this
+                || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java Wed Apr  9 07:02:10 2008
@@ -110,7 +110,7 @@
     /**
      * Adapt a BinaryPredicate to the UnaryPredicate interface.
      * @param predicate to adapt
-     * @param arg Object argument to always send as the left operand to the wrapped function 
+     * @param arg Object argument to always send as the left operand to the wrapped function
      * @return LeftBoundPredicate
      */
     public static LeftBoundPredicate bind(BinaryPredicate predicate, Object arg) {

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java Wed Apr  9 07:02:10 2008
@@ -114,7 +114,7 @@
      * @return LeftBoundProcedure
      */
     public static LeftBoundProcedure bind(BinaryProcedure procedure, Object arg) {
-        return null == procedure ? null : new LeftBoundProcedure(procedure,arg);
+        return null == procedure ? null : new LeftBoundProcedure(procedure, arg);
     }
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java Wed Apr  9 07:02:10 2008
@@ -39,14 +39,27 @@
  * @author Rodney Waldhoff
  */
 public final class PredicateUnaryPredicate implements UnaryPredicate, Serializable {
+    /** The {@link Predicate Predicate} I'm wrapping. */
+    private Predicate predicate = null;
+
+    /**
+     * Create a new PredicateUnaryPredicate.
+     * @param predicate to adapt
+     */
     public PredicateUnaryPredicate(Predicate predicate) {
         this.predicate = predicate;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object obj) {
         return predicate.test();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof PredicateUnaryPredicate) {
             return equals((PredicateUnaryPredicate) that);
@@ -55,10 +68,19 @@
         }
     }
 
+    /**
+     * Learn whether a given PredicateUnaryPredicate is equal to this.
+     * @param that PredicateUnaryPredicate to test
+     * @return boolean
+     */
     public boolean equals(PredicateUnaryPredicate that) {
-        return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate)));
+        return that == this
+                || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate)));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "PredicateUnaryPredicate".hashCode();
         if (null != predicate) {
@@ -67,14 +89,20 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "PredicateUnaryPredicate<" + predicate + ">";
     }
 
+    /**
+     * Adapt a Predicate to the UnaryPredicate interface.
+     * @param predicate to adapt
+     * @return PredicateUnaryPredicate
+     */
     public static PredicateUnaryPredicate adapt(Predicate predicate) {
         return null == predicate ? null : new PredicateUnaryPredicate(predicate);
     }
 
-    /** The {@link Predicate Predicate} I'm wrapping. */
-    private Predicate predicate = null;
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java Wed Apr  9 07:02:10 2008
@@ -58,7 +58,7 @@
      * {@inheritDoc}
      */
     public void run(Object obj) {
-        procedure.run(obj,param);
+        procedure.run(obj, param);
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java Wed Apr  9 07:02:10 2008
@@ -38,6 +38,9 @@
  * @author Rodney Waldhoff
  */
 public final class UnaryFunctionUnaryPredicate implements UnaryPredicate, Serializable {
+    /** The {@link UnaryFunction UnaryFunction} I'm wrapping. */
+    private UnaryFunction function = null;
+
     /**
      * Create an {@link UnaryPredicate UnaryPredicate} wrapping
      * the given {@link UnaryFunction UnaryFunction}.
@@ -48,6 +51,7 @@
     }
 
     /**
+     * {@inheritDoc}
      * Returns the <code>boolean</code> value of the non-<code>null</code>
      * <code>Boolean</code> returned by the {@link UnaryFunction#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 obj) {
-        return ((Boolean)(function.evaluate(obj))).booleanValue();
+        return ((Boolean) (function.evaluate(obj))).booleanValue();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof UnaryFunctionUnaryPredicate) {
             return equals((UnaryFunctionUnaryPredicate) that);
@@ -67,10 +74,19 @@
         }
     }
 
+    /**
+     * Learn whether another UnaryFunctionUnaryPredicate is equal to this.
+     * @param that UnaryFunctionUnaryPredicate to test
+     * @return boolean
+     */
     public boolean equals(UnaryFunctionUnaryPredicate 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 = "UnaryFunctionUnaryPredicate".hashCode();
         if (null != function) {
@@ -79,6 +95,9 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "UnaryFunctionUnaryPredicate<" + function + ">";
     }
@@ -100,6 +119,4 @@
         return null == function ? null : new UnaryFunctionUnaryPredicate(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/UnaryProcedureUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java Wed Apr  9 07:02:10 2008
@@ -39,15 +39,28 @@
  * @author Rodney Waldhoff
  */
 public final class UnaryProcedureUnaryFunction implements UnaryFunction, Serializable {
+    /** The {@link UnaryProcedure UnaryProcedure} I'm wrapping. */
+    private UnaryProcedure procedure = null;
+
+    /**
+     * Create a new UnaryProcedureUnaryFunction.
+     * @param procedure to adapt
+     */
     public UnaryProcedureUnaryFunction(UnaryProcedure procedure) {
         this.procedure = procedure;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object evaluate(Object obj) {
         procedure.run(obj);
         return null;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof UnaryProcedureUnaryFunction) {
             return equals((UnaryProcedureUnaryFunction) that);
@@ -56,10 +69,19 @@
         }
     }
 
+    /**
+     * Learn whether a given UnaryProcedureUnaryFunction is equal to this.
+     * @param that UnaryProcedureUnaryFunction to test
+     * @return boolean
+     */
     public boolean equals(UnaryProcedureUnaryFunction that) {
-        return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
+        return that == this
+                || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "UnaryProcedureUnaryFunction".hashCode();
         if (null != procedure) {
@@ -68,14 +90,20 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "UnaryProcedureUnaryFunction<" + procedure + ">";
     }
 
+    /**
+     * Adapt a UnaryProcedure to the UnaryFunction interface.
+     * @param procedure to adapt
+     * @return UnaryProcedureUnaryFunction
+     */
     public static UnaryProcedureUnaryFunction adapt(UnaryProcedure procedure) {
         return null == procedure ? null : new UnaryProcedureUnaryFunction(procedure);
     }
 
-    /** The {@link UnaryProcedure UnaryProcedure} I'm wrapping. */
-    private UnaryProcedure procedure = null;
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java Wed Apr  9 07:02:10 2008
@@ -60,7 +60,6 @@
      * @param value boolean
      */
     public Constant(boolean value) {
-        //TODO use Boolean.TRUE and Boolean.FALSE
         this(new Boolean(value));
     }
 

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java Wed Apr  9 07:02:10 2008
@@ -32,49 +32,74 @@
  * @author Rodney Waldhoff
  */
 public final class IsNull implements UnaryPredicate, Serializable {
+    // static attributes
+    // ------------------------------------------------------------------------
+    private static final IsNull INSTANCE = new IsNull();
+    private static final BinaryPredicate LEFT = IgnoreRightPredicate.adapt(instance());
+    private static final BinaryPredicate RIGHT = IgnoreLeftPredicate.adapt(instance());
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new IsNull.
+     */
     public IsNull() {
     }
 
     // predicate interface
     // ------------------------------------------------------------------------
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object obj) {
         return (null == obj);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         return that instanceof IsNull;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return "IsNull".hashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "IsNull";
     }
 
     // static methods
     // ------------------------------------------------------------------------
+    /**
+     * Get an IsNull instance.
+     * @return IsNull
+     */
     public static IsNull instance() {
         return INSTANCE;
     }
 
+    /**
+     * Get a BinaryPredicate that matches if the left argument is null.
+     * @return BinaryPredicate
+     */
     public static BinaryPredicate left() {
         return LEFT;
     }
 
+    /**
+     * Get a BinaryPredicate that matches if the right argument is null.
+     * @return BinaryPredicate
+     */
     public static BinaryPredicate right() {
         return RIGHT;
     }
-
-    // static attributes
-    // ------------------------------------------------------------------------
-    private static final IsNull INSTANCE = new IsNull();
-    private static final BinaryPredicate LEFT = IgnoreRightPredicate.adapt(instance());
-    private static final BinaryPredicate RIGHT = IgnoreLeftPredicate.adapt(instance());
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java Wed Apr  9 07:02:10 2008
@@ -31,7 +31,15 @@
  */
 
 public final class Limit implements Predicate, UnaryPredicate, BinaryPredicate {
+    // instance variables
+    //---------------------------------------------------------------
+    private int max;
+    private int current = 0;
 
+    /**
+     * Create a new Limit.
+     * @param count limit
+     */
     public Limit(int count) {
         if (count < 0) {
             throw new IllegalArgumentException("Argument must be a non-negative integer.");
@@ -39,8 +47,11 @@
         this.max = count;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean test() {
-        // stop incremeting when we've hit max, so we don't loop around
+        // stop incrementing when we've hit max, so we don't loop around
         if (current < max) {
             current++;
             return true;
@@ -49,20 +60,25 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object obj) {
         return test();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object a, Object b) {
         return test();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "Limit<" + max + ">";
     }
-    // instance variables
-    //---------------------------------------------------------------
-    private int max;
-    private int current = 0;
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java Wed Apr  9 07:02:10 2008
@@ -22,6 +22,8 @@
 import org.apache.commons.functor.UnaryPredicate;
 
 /**
+ * Iterator that filters another Iterator by only passing through those elements
+ * that are matched by a specified UnaryPredicate.
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -141,7 +143,7 @@
      * @return whether the current iterator position is valid
      */
     private boolean setNext() {
-        while(iterator.hasNext()) {
+        while (iterator.hasNext()) {
             canRemove = false;
             Object obj = iterator.next();
             if (predicate.test(obj)) {

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java Wed Apr  9 07:02:10 2008
@@ -35,20 +35,29 @@
  * @author  Rodney Waldhoff
  */
 public final class IsElementOf implements BinaryPredicate, Serializable {
+    // static members
+    //---------------------------------------------------------------
+
+    private static IsElementOf INSTANCE = new IsElementOf();
 
     // constructors
     //---------------------------------------------------------------
+    /**
+     * Create a new IsElementOf.
+     */
     public IsElementOf() {
     }
 
     // instance methods
     //---------------------------------------------------------------
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object obj, Object col) {
         if (col instanceof Collection) {
-            return testCollection(obj,(Collection) col);
+            return testCollection(obj, (Collection) col);
         } else if (null != col && col.getClass().isArray()) {
-            return testArray(obj,col);
+            return testArray(obj, col);
         } else if (null == col) {
             throw new NullPointerException("Right side argument must not be null.");
         } else {
@@ -56,25 +65,46 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object obj) {
         return (obj instanceof IsElementOf);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return "IsElementOf".hashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "IsElementOf";
     }
 
+    /**
+     * Test a collection.
+     * @param obj to find
+     * @param col to search
+     * @return boolean
+     */
     private boolean testCollection(Object obj, Collection col) {
         return col.contains(obj);
     }
 
+    /**
+     * Test an array.
+     * @param obj to find
+     * @param array to search
+     * @return boolean
+     */
     private boolean testArray(Object obj, Object array) {
-        for (int i=0,m=Array.getLength(array);i<m;i++) {
-            Object value = Array.get(array,i);
+        for (int i = 0, m = Array.getLength(array); i < m; i++) {
+            Object value = Array.get(array, i);
             if (null == obj) {
                 if (null == value) {
                     return true;
@@ -86,29 +116,31 @@
         return false;
     }
 
-
-    // class methods
+    // static methods
     //---------------------------------------------------------------
-
+    /**
+     * Get an IsElementOf instance.
+     * @return IsElementOf
+     */
     public static IsElementOf instance() {
         return INSTANCE;
     }
 
+    /**
+     * Get an IsElementOf(collection|array) UnaryPredicate.
+     * @param obj collection/array to search
+     * @return UnaryPredicate
+     */
     public static UnaryPredicate instance(Object obj) {
         if (null == obj) {
             throw new NullPointerException("Argument must not be null");
         } else if (obj instanceof Collection) {
-            return new RightBoundPredicate(instance(),obj);
+            return new RightBoundPredicate(instance(), obj);
         } else if (obj.getClass().isArray()) {
-            return new RightBoundPredicate(instance(),obj);
+            return new RightBoundPredicate(instance(), obj);
         } else {
             throw new IllegalArgumentException("Expected Collection or Array, found " + obj.getClass());
         }
     }
-
-    // class variables
-    //---------------------------------------------------------------
-
-    private static IsElementOf INSTANCE = new IsElementOf();
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java Wed Apr  9 07:02:10 2008
@@ -21,6 +21,7 @@
 import org.apache.commons.functor.UnaryFunction;
 
 /**
+ * Iterator that transforms another Iterator by applying a UnaryFunction to each returned element.
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
@@ -114,9 +115,8 @@
      * @param func transforming function
      * @return Iterator
      */
-    //TODO is this the best name for this method?
     public static Iterator transform(Iterator iter, UnaryFunction func) {
-        return null == func ? iter : (null == iter ? null : new TransformedIterator(iter,func));
+        return null == func ? iter : (null == iter ? null : new TransformedIterator(iter, func));
     }
 
 }

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java Wed Apr  9 07:02:10 2008
@@ -61,7 +61,7 @@
      * {@inheritDoc}
      */
     public String toString() {
-        return" ComparableComparator";
+        return "ComparableComparator";
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsWithinRange.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsWithinRange.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsWithinRange.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsWithinRange.java Wed Apr  9 07:02:10 2008
@@ -29,6 +29,8 @@
  */
 
 public class IsWithinRange implements UnaryPredicate, Serializable {
+    /** Hashcode of the name of this Predicate. */
+    private static final int nameHashCode = "IsWithinRange".hashCode();
 
     /***************************************************
      *  Instance variables
@@ -38,8 +40,6 @@
     private Comparable min = null;
     /** The maximum value of the range. */
     private Comparable max = null;
-    /** Hashcode of the name of this Predicate. */
-    private static final int nameHashCode = "IsWithinRange".hashCode();
 
     /***************************************************
      *  Constructors

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java Wed Apr  9 07:02:10 2008
@@ -29,9 +29,10 @@
  * @author Rodney Waldhoff
  */
 public final class Max implements BinaryFunction, Serializable {
-    private Comparator comparator = null;
     private static final Max INSTANCE = new Max();
 
+    private Comparator comparator = null;
+
     /**
      * Create a new Max.
      */
@@ -51,7 +52,7 @@
      * {@inheritDoc}
      */
     public Object evaluate(Object left, Object right) {
-        return (comparator.compare(left,right) >= 0) ? left : right;
+        return (comparator.compare(left, right) >= 0) ? left : right;
     }
 
     /**

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -93,7 +93,7 @@
      */
     public boolean test(Object a, Object b) {
         for (Iterator iter = getBinaryPredicateIterator(); iter.hasNext();) {
-            if (((BinaryPredicate) iter.next()).test(a,b)) {
+            if (((BinaryPredicate) iter.next()).test(a, b)) {
                 return true;
             }
         }

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -28,8 +28,6 @@
  * @author Rodney Waldhoff
  */
 public final class Composite {
-    //TODO discuss method signatures
-
     // constructor - for beanish apis
     // ------------------------------------------------------------------------
     /**

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -85,8 +85,8 @@
     // modifiers
     // ------------------------------------------------------------------------
     /**
-     * Fluently add a UnaryFunction.
-     * @param f UnaryFunction to add
+     * Fluently prepend a UnaryFunction to the chain.
+     * @param f UnaryFunction to prepend
      * @return this
      */
     public CompositeUnaryFunction of(UnaryFunction f) {

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -77,8 +77,8 @@
     // modifiers
     // ------------------------------------------------------------------------
     /**
-     * Fluently add a UnaryFunction to the chain.
-     * @param f UnaryFunction to add
+     * Fluently prepend a UnaryFunction to the chain.
+     * @param f UnaryFunction to prepend
      * @return this
      */
     public CompositeUnaryPredicate of(UnaryFunction f) {

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java Wed Apr  9 07:02:10 2008
@@ -45,24 +45,48 @@
  * @author Rodney Waldhoff
  */
 public final class CompositeUnaryProcedure implements UnaryProcedure, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private CompositeUnaryFunction function = null;
+    private UnaryProcedure procedure = null;
 
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new CompositeUnaryProcedure.
+     * @param p final UnaryProcedure to run
+     */
     public CompositeUnaryProcedure(UnaryProcedure p) {
-        if (null == p) { throw new NullPointerException(); }
+        if (null == p) {
+            throw new NullPointerException();
+        }
         this.procedure = p;
         this.function = new CompositeUnaryFunction();
     }
 
+    /**
+     * Create a new CompositeUnaryProcedure.
+     * @param p final UnaryProcedure to run
+     * @param f UnaryFunction to chain into <code>p</code>
+     */
     public CompositeUnaryProcedure(UnaryProcedure p, UnaryFunction f) {
-        if (null == p) { throw new NullPointerException(); }
-        if (null == f) { throw new NullPointerException(); }
+        if (null == p) {
+            throw new NullPointerException();
+        }
+        if (null == f) {
+            throw new NullPointerException();
+        }
         this.procedure = p;
         this.function = new CompositeUnaryFunction(f);
     }
 
     // modifiers
     // ------------------------------------------------------------------------
+    /**
+     * Fluently prepend a transformation to the chain.
+     * @param f UnaryFunction to prepend
+     * @return this
+     */
     public CompositeUnaryProcedure of(UnaryFunction f) {
         function.of(f);
         return this;
@@ -70,10 +94,16 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public void run(Object obj) {
         procedure.run(function.evaluate(obj));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof CompositeUnaryProcedure) {
             return equals((CompositeUnaryProcedure) that);
@@ -82,10 +112,18 @@
         }
     }
 
+    /**
+     * Learn whether another CompositeUnaryProcedure is equal to this.
+     * @param that CompositeUnaryProcedure to test
+     * @return boolean
+     */
     public boolean equals(CompositeUnaryProcedure that) {
         return null != that && procedure.equals(that.procedure) && function.equals(that.function);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "CompositeUnaryProcedure".hashCode();
         hash <<= 2;
@@ -95,13 +133,11 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "CompositeUnaryProcedure<" + procedure + ";" + function + ">";
     }
-
-    // attributes
-    // ------------------------------------------------------------------------
-    private CompositeUnaryFunction function = null;
-    private UnaryProcedure procedure = null;
 
 }

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -68,7 +68,7 @@
      * {@inheritDoc}
      */
     public Object evaluate(Object left, Object right) {
-        return ifPred.test(left,right) ? thenFunc.evaluate(left,right) : elseFunc.evaluate(left,right);
+        return ifPred.test(left, right) ? thenFunc.evaluate(left, right) : elseFunc.evaluate(left, right);
     }
 
     /**

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -86,7 +86,7 @@
     }
 
     /**
-     * Learn whether another ConditionalUnaryProcedure is equal to this. 
+     * Learn whether another ConditionalUnaryProcedure is equal to this.
      * @param that ConditionalUnaryProcedure to test
      * @return boolean
      */

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -60,7 +60,7 @@
      * {@inheritDoc}
      */
     public void run(Object left, Object right) {
-        procedure.run(right,left);
+        procedure.run(right, left);
     }
 
     /**

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -61,7 +61,7 @@
      * @param q UnaryPredicate to add
      */
     public UnaryAnd(UnaryPredicate p, UnaryPredicate q) {
-        super(p,q);
+        super(p, q);
     }
 
     /**
@@ -71,7 +71,7 @@
      * @param r UnaryPredicate to add
      */
     public UnaryAnd(UnaryPredicate p, UnaryPredicate q, UnaryPredicate r) {
-        super(p,q,r);
+        super(p, q, r);
     }
 
     // modifiers

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

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -35,20 +35,32 @@
  * @author Rodney Waldhoff
  */
 public final class UnaryNot implements UnaryPredicate, Serializable {
+    // attributes
+    // ------------------------------------------------------------------------
+    private UnaryPredicate predicate = null;
 
     // constructor
     // ------------------------------------------------------------------------
-
+    /**
+     * Create a new UnaryNot.
+     * @param p UnaryPredicate to negate
+     */
     public UnaryNot(UnaryPredicate p) {
         this.predicate = p;
     }
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public boolean test(Object obj) {
         return !(predicate.test(obj));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof UnaryNot) {
             return equals((UnaryNot) that);
@@ -57,10 +69,18 @@
         }
     }
 
+    /**
+     * Learn whether another UnaryNot is equal to this.
+     * @param that UnaryNot to test
+     * @return boolean
+     */
     public boolean equals(UnaryNot that) {
         return null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "UnaryNot".hashCode();
         if (null != predicate) {
@@ -69,17 +89,22 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "UnaryNot<" + predicate + ">";
     }
 
     // static
     // ------------------------------------------------------------------------
-    public static UnaryPredicate not(UnaryPredicate that) {
-        return null == that ? null : new UnaryNot(that);
+    /**
+     * Invert a UnaryPredicate.
+     * @param pred UnaryPredicate to invert
+     * @return UnaryPredicate
+     */
+    public static UnaryPredicate not(UnaryPredicate pred) {
+        return null == pred ? null : new UnaryNot(pred);
     }
 
-    // attributes
-    // ------------------------------------------------------------------------
-    private UnaryPredicate predicate = 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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -61,7 +61,7 @@
      * @param q Predicate to add
      */
     public UnaryOr(UnaryPredicate p, UnaryPredicate q) {
-        super(p,q);
+        super(p, q);
     }
 
     /**
@@ -71,7 +71,7 @@
      * @param r Predicate to add
      */
     public UnaryOr(UnaryPredicate p, UnaryPredicate q, UnaryPredicate r) {
-        super(p,q,r);
+        super(p, q, r);
     }
 
     // modifiers

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java Wed Apr  9 07:02:10 2008
@@ -42,15 +42,31 @@
  */
 public class UnarySequence implements UnaryProcedure, Serializable {
 
+    // attributes
+    // ------------------------------------------------------------------------
+    private List list = new ArrayList();
+
     // constructor
     // ------------------------------------------------------------------------
+    /**
+     * Create a new UnarySequence.
+     */
     public UnarySequence() {
     }
 
+    /**
+     * Create a new UnarySequence.
+     * @param p UnaryProcedure to add
+     */
     public UnarySequence(UnaryProcedure p) {
         then(p);
     }
 
+    /**
+     * Create a new UnarySequence.
+     * @param p UnaryProcedure to add
+     * @param q UnaryProcedure to add
+     */
     public UnarySequence(UnaryProcedure p, UnaryProcedure q) {
         then(p);
         then(q);
@@ -58,6 +74,11 @@
 
     // modifiers
     // ------------------------------------------------------------------------
+    /**
+     * Fluently add a UnaryProcedure to the sequence.
+     * @param p UnaryProcedure to add
+     * @return this
+     */
     public UnarySequence then(UnaryProcedure p) {
         list.add(p);
         return this;
@@ -65,12 +86,18 @@
 
     // predicate interface
     // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
     public void run(Object obj) {
         for (ListIterator iter = list.listIterator(list.size()); iter.hasPrevious();) {
             ((UnaryProcedure) iter.previous()).run(obj);
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object that) {
         if (that instanceof UnarySequence) {
             return equals((UnarySequence) that);
@@ -79,23 +106,29 @@
         }
     }
 
+    /**
+     * Learn whether another UnarySequence is equal to this.
+     * @param that UnarySequence to test
+     * @return boolean
+     */
     public boolean equals(UnarySequence 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 "UnarySequence".hashCode() ^ list.hashCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "UnarySequence<" + list + ">";
     }
-
-
-    // attributes
-    // ------------------------------------------------------------------------
-    private List list = new ArrayList();
 
 }

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -50,8 +50,9 @@
      * {@inheritDoc}
      */
     public void run() {
-        while(getCondition().test())
+        while (getCondition().test()) {
             getAction().run();
+        }
     }
 
     /**
@@ -59,9 +60,9 @@
      */
     public boolean equals(Object object) {
         if (object instanceof WhileDoProcedure) {
-        	return super.equals(object);
+            return super.equals(object);
         } else {
-			return false;
+            return false;
         }
     }
 
@@ -69,7 +70,7 @@
      * {@inheritDoc}
      */
     public int hashCode() {
-    	return super.hashCode("WhileDoProcedure".hashCode());
+        return super.hashCode("WhileDoProcedure".hashCode());
     }
 
     /**

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -89,7 +89,7 @@
      * See {@link Algorithms#apply}.
      */
     public final Generator apply(UnaryFunction func) {
-        return Algorithms.apply(this,func);
+        return Algorithms.apply(this, func);
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/Generator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/Generator.java?rev=646358&r1=646357&r2=646358&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/Generator.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/Generator.java Wed Apr  9 07:02:10 2008
@@ -26,40 +26,113 @@
  * @author Rodney Waldhoff
  */
 public interface Generator {
-    /** Generators must implement this method. */
+    /**
+     * Generators must implement this method.
+     * @param proc UnaryProcedure to run
+     */
     public abstract void run(UnaryProcedure proc);
-    /** Stop the generator. Will stop the wrapped generator if one was set. */
+
+    /**
+     * Stop the generator. Will stop the wrapped generator if one was set.
+     */
     public abstract void stop();
-    /** Check if the generator is stopped. */
+
+    /**
+     * Check if the generator is stopped.
+     * @return true if stopped
+     */
     public abstract boolean isStopped();
-    /*** See {@link org.apache.commons.functor.Algorithms#apply}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#apply}.
+     * @param func UnaryFunction to apply
+     * @return this
+     */
     public abstract Generator apply(UnaryFunction func);
-    /** See {@link org.apache.commons.functor.Algorithms#contains}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#contains}.
+     * @param pred UnaryPredicate to apply
+     * @return true if a match was found
+     */
     public abstract boolean contains(UnaryPredicate pred);
-    /** See {@link org.apache.commons.functor.Algorithms#detect}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#detect}.
+     * @param pred UnaryPredicate to apply
+     * @return first match or <code>null</code>
+     */
     public abstract Object detect(UnaryPredicate pred);
-    /** See {@link org.apache.commons.functor.Algorithms#detect}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#detect}.
+     * @param pred UnaryPredicate to apply
+     * @param ifNone default result
+     * @return first match or <code>null</code>
+     */
     public abstract Object detect(UnaryPredicate pred, Object ifNone);
-    /** Synonym for run. */
+
+    /**
+     * Synonym for run.
+     * @param proc UnaryProcedure to run against each element
+     */
     public abstract void foreach(UnaryProcedure proc);
-    /** See {@link org.apache.commons.functor.Algorithms#inject}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#inject}.
+     * @param seed seed Object
+     * @param func BinaryFunction to apply
+     * @return final result
+     */
     public abstract Object inject(Object seed, BinaryFunction func);
-    /** See {@link org.apache.commons.functor.Algorithms#reject}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#reject}.
+     * @param pred UnaryPredicate to apply
+     * @return a Generator of non-matching elements
+     */
     public abstract Generator reject(UnaryPredicate pred);
-    /** See {@link org.apache.commons.functor.Algorithms#select}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#select}.
+     * @param pred UnaryPredicate to apply
+     * @return Generator of matching elements
+     */
     public abstract Generator select(UnaryPredicate pred);
-    /** See {@link org.apache.commons.functor.Algorithms#select}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#select}.
+     * @param pred UnaryPredicate to apply
+     * @return Generator of matching elements
+     */
     public abstract Generator where(UnaryPredicate pred);
-    /** See {@link org.apache.commons.functor.Algorithms#until}. */
+
+    /**
+     * See {@link org.apache.commons.functor.Algorithms#until}.
+     * @param pred UnaryPredicate to apply
+     * @return a Generator of non-matching elements
+     */
     public abstract Generator until(UnaryPredicate pred);
+
     /**
      * Transforms this generator using the passed in
      * transformer. An example transformer might turn the contents of the
      * generator into a {@link Collection} of elements.
+     * @param transformer UnaryFunction to apply to this
+     * @return transformation result
      */
     public abstract Object to(UnaryFunction transformer);
-    /** Same as to(new CollectionTransformer(collection)). */
+
+    /**
+     * Same as to(new CollectionTransformer(collection)).
+     * @param collection Collection to which my elements should be added
+     * @return <code>collection</code>
+     */
     public abstract Collection to(Collection collection);
-    /** Same as to(new CollectionTransformer()). */
+
+    /**
+     * Same as to(new CollectionTransformer()).
+     * @return Collection
+     */
     public abstract Collection toCollection();
-}
\ No newline at end of file
+}

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -27,10 +27,17 @@
  * @author Rodney Waldhoff
  */
 public final class IteratorToGeneratorAdapter extends BaseGenerator {
+    // instance variables
+    //-----------------------------------------------------
+
+    private Iterator iter = null;
 
     // constructors
     //-----------------------------------------------------
-
+    /**
+     * Create a new IteratorToGeneratorAdapter.
+     * @param iter Iterator to adapt
+     */
     public IteratorToGeneratorAdapter(Iterator iter) {
         if (null == iter) {
             throw new NullPointerException();
@@ -41,14 +48,21 @@
 
     // instance methods
     //-----------------------------------------------------
-
+    /**
+     * {@inheritDoc}
+     */
     public void run(UnaryProcedure proc) {
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             proc.run(iter.next());
-            if (isStopped()) { break; }
+            if (isStopped()) {
+                break;
+            }
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object obj) {
         if (obj instanceof IteratorToGeneratorAdapter) {
             IteratorToGeneratorAdapter that = (IteratorToGeneratorAdapter) obj;
@@ -58,6 +72,9 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         int hash = "IteratorToGeneratorAdapater".hashCode();
         hash <<= 2;
@@ -65,20 +82,22 @@
         return hash;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "IteratorToGeneratorAdapter<" + iter + ">";
     }
 
-
-    // class methods
+    // static methods
     //-----------------------------------------------------
-
+    /**
+     * Adapt an Iterator to the Generator interface.
+     * @param iter to adapt
+     * @return IteratorToGeneratorAdapter
+     */
     public static IteratorToGeneratorAdapter adapt(Iterator iter) {
         return null == iter ? null : new IteratorToGeneratorAdapter(iter);
     }
 
-    // instance variables
-    //-----------------------------------------------------
-
-    private Iterator iter = null;
 }

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=646358&r1=646357&r2=646358&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 Wed Apr  9 07:02:10 2008
@@ -70,7 +70,7 @@
      * @param step increment
      */
     public LongRange(long from, long to, long 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;

Added: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/package.html
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/package.html?rev=646358&view=auto
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/package.html (added)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/package.html Wed Apr  9 07:02:10 2008
@@ -0,0 +1,21 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<html><body>
+<p>
+Contains utility code for Generators.
+</p>
+</body></html>

Propchange: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/package.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message