Class ProgressTransformer

  • All Implemented Interfaces:
    Consumer<Integer>

    public class ProgressTransformer
    extends Object
    implements Consumer<Integer>
    A progress listener wrapping another progress listener, allowing filtering of progress events and changing the reported progress range. Useful as a parameter to the ProgressPipe.
    Author:
    Eyal Schneider
    • Constructor Detail

      • ProgressTransformer

        public ProgressTransformer​(Consumer<Integer> listener,
                                   int from,
                                   int to,
                                   int step)
        Constructor
        Parameters:
        listener - The listener to wrap
        from - The initial progress to report to the underlying listener
        to - The final progress to report to the underlying listener
        step - The step size. Progress will only be reported once it completes multiples of this step size (After the transformation)
      • ProgressTransformer

        public ProgressTransformer​(Consumer<Integer> listener,
                                   int from,
                                   int to)
        Constructor
        Parameters:
        listener - The listener to wrap
        from - The initial progress to report to the underlying listener
        to - The final progress to report to the underlying listener
      • ProgressTransformer

        public ProgressTransformer​(Consumer<Integer> listener,
                                   int step)
        Constructor
        Parameters:
        listener - The listener to wrap
        step - The step size. Progress will only be reported once it completes multiples of this step size