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 Details

    • generator

      private final Generator<? extends T> generator
      The wrapped generator.
    • 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, -1 means the target was not found.
    • current

      private long current
      A 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 generator
      pred - The wrapped predicate
  • Method Details

    • run

      public void run(T obj)
      Execute this procedure.
      Specified by:
      run in interface UnaryProcedure<T>
      Parameters:
      obj - an A parameter to this execution