Class IndexOfInGenerator.IndexProcedure<T>
java.lang.Object
org.apache.commons.functor.core.algorithm.IndexOfInGenerator.IndexProcedure<T>
- Type Parameters:
T- the procedure argument type
- All Implemented Interfaces:
Functor, UnaryFunctor<T>, UnaryProcedure<T>
- Enclosing class:
IndexOfInGenerator<T>
private static class IndexOfInGenerator.IndexProcedure<T>
extends Object
implements UnaryProcedure<T>
Helper procedure.
- Version:
- $Revision$ $Date$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longA local accumulator to increment the number of attempts.The wrapped generator.private longThe number of iterations needed before the wrapped predicate found the target,-1means the target was not found.private final UnaryPredicate<? super T> The wrapped predicate. -
Constructor Summary
ConstructorsConstructorDescriptionIndexProcedure(Generator<? extends T> generator, UnaryPredicate<? super T> pred) Create a new IndexProcedure. -
Method Summary
-
Field Details
-
generator
-
pred
The wrapped predicate. -
index
private long indexThe number of iterations needed before the wrapped predicate found the target,-1means the target was not found. -
current
private long currentA local accumulator to increment the number of attempts.
-
-
Constructor Details
-
IndexProcedure
IndexProcedure(Generator<? extends T> generator, UnaryPredicate<? super T> pred) Create a new IndexProcedure.- Parameters:
generator- The wrapped generatorpred- The wrapped predicate
-
-
Method Details
-
run
Execute this procedure.- Specified by:
runin interfaceUnaryProcedure<T>- Parameters:
obj- an A parameter to this execution
-