Class FoldRight.FoldRightHelper<T>

java.lang.Object
org.apache.commons.functor.core.algorithm.FoldRight.FoldRightHelper<T>
Type Parameters:
T - the returned evaluation type.
All Implemented Interfaces:
Functor, UnaryFunctor<T>, UnaryProcedure<T>
Enclosing class:
FoldRight<T>

private static class FoldRight.FoldRightHelper<T> extends Object implements UnaryProcedure<T>
Helper class.
Version:
$Revision$ $Date$
  • Field Details

    • stk

      private final Stack<T> stk
      The stack where storing the wrapped function evaluations.
    • function

      private final BinaryFunction<? super T, ? super T, ? extends T> function
      The wrapped function.
    • seed

      private final T seed
      The seed object.
    • hasSeed

      private final boolean hasSeed
      Flag to check the helper started or not.
  • Constructor Details

    • FoldRightHelper

      public FoldRightHelper(BinaryFunction<? super T, ? super T, ? extends T> function)
      Create a seedless FoldRightHelper.
      Parameters:
      function - The wrapped function
    • FoldRightHelper

      FoldRightHelper(T seed, BinaryFunction<? super T, ? super T, ? extends T> function)
      Create a new FoldRightHelper.
      Parameters:
      seed - initial right-side argument
      function - The wrapped function
  • 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
    • getResult

      T getResult()
      Get result after processing. Get current result.
      Returns:
      Object