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 java.lang.Object implements UnaryProcedure<T>
Helper procedure.
-
-
Field Summary
Fields Modifier and Type Field Description private longcurrentA local accumulator to increment the number of attempts.private Generator<? extends T>generatorThe wrapped generator.private longindexThe number of iterations needed before the wrapped predicate found the target,-1means the target was not found.private UnaryPredicate<? super T>predThe wrapped predicate.
-
Constructor Summary
Constructors Constructor Description IndexProcedure(Generator<? extends T> generator, UnaryPredicate<? super T> pred)Create a new IndexProcedure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidrun(T obj)Execute this procedure.
-
-
-
Field Detail
-
pred
private final UnaryPredicate<? super T> pred
The wrapped predicate.
-
index
private long index
The number of iterations needed before the wrapped predicate found the target,-1means the target was not found.
-
current
private long current
A local accumulator to increment the number of attempts.
-
-
Constructor Detail
-
IndexProcedure
IndexProcedure(Generator<? extends T> generator, UnaryPredicate<? super T> pred)
Create a new IndexProcedure.- Parameters:
generator- The wrapped generatorpred- The wrapped predicate
-
-
Method Detail
-
run
public void run(T obj)
Execute this procedure.- Specified by:
runin interfaceUnaryProcedure<T>- Parameters:
obj- an A parameter to this execution
-
-