You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/09/23 23:06:55 UTC
svn commit: r1175020 -
/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/algorithm/IndexOfInGenerator.java
Author: simonetripodi
Date: Fri Sep 23 21:06:55 2011
New Revision: 1175020
URL: http://svn.apache.org/viewvc?rev=1175020&view=rev
Log:
added missing javadoc comments
Modified:
commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/algorithm/IndexOfInGenerator.java
Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/algorithm/IndexOfInGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/algorithm/IndexOfInGenerator.java?rev=1175020&r1=1175019&r2=1175020&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/algorithm/IndexOfInGenerator.java (original)
+++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/algorithm/IndexOfInGenerator.java Fri Sep 23 21:06:55 2011
@@ -26,6 +26,7 @@ import org.apache.commons.functor.genera
/**
* Return the index of the first Object in a {@link Generator} matching a {@link UnaryPredicate}, or -1 if not found.
*
+ * @param <T> the procedure argument types
* @version $Revision$ $Date$
*/
public final class IndexOfInGenerator<T>
@@ -34,20 +35,40 @@ public final class IndexOfInGenerator<T>
* serialVersionUID declaration.
*/
private static final long serialVersionUID = -11365986575536471L;
+ /**
+ * A static {@code IndexOfInGenerator} instance reference.
+ */
private static final IndexOfInGenerator<Object> INSTANCE = new IndexOfInGenerator<Object>();
/**
* Helper procedure.
+ *
+ * @param <T> the procedure argument type
*/
private static class IndexProcedure<T> implements UnaryProcedure<T> {
+ /**
+ * The wrapped generator
+ */
private final Generator<? extends T> generator;
+ /**
+ * The wrapped predicate
+ */
private final UnaryPredicate<? super T> pred;
+ /**
+ * The number of iterations needed before the wrapped predicate found the target,
+ * {@code -1} means the target was not found.
+ */
private long index = -1L;
+ /**
+ * A local accumulator to increment the number of attempts.
+ */
private long current = 0L;
/**
* Create a new IndexProcedure.
- * @pred test
+ *
+ * @param generator The wrapped generator
+ * @param pred The wrapped predicate
*/
IndexProcedure(Generator<? extends T> generator, UnaryPredicate<? super T> pred) {
this.generator = generator;