Class ProgressRangeAdapter

  • All Implemented Interfaces:
    ProgressListener, java.util.EventListener

    public class ProgressRangeAdapter
    extends java.lang.Object
    implements ProgressListener
    An adapter that can be wrapped around a progress listener to scale the update messages it receives to a certain range.
    Author:
    Chris Jennings
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean progressUpdate​(java.lang.Object source, float progress)
      Called to indicate that an algorithm has made progress towards completion.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProgressRangeAdapter

        public ProgressRangeAdapter​(float rangeLow,
                                    float rangeHigh,
                                    ProgressListener adaptee)
        Creates a new range adapter. The input progress range of 0..1 will be mapped to the range rangeLow..rangeHigh before passing the progress message on to the adaptee.
        Parameters:
        rangeLow - the progress value to report when the input progress is 0
        rangeHigh - the progress value to report when the input progress is 1
        adaptee - the listener that the adapted range will be forwarded to
        Throws:
        java.lang.IllegalArgumentException - if the range values are out of the allowed range of progress values (0 to 1), or if rangeLow > rangeHigh
        java.lang.NullPointerException - if the adaptee is null
    • Method Detail

      • progressUpdate

        public boolean progressUpdate​(java.lang.Object source,
                                      float progress)
        Description copied from interface: ProgressListener
        Called to indicate that an algorithm has made progress towards completion. If the listener returns true, it is a hint that the operation should be cancelled if possible.
        Specified by:
        progressUpdate in interface ProgressListener
        Parameters:
        source - the source of the progress event
        progress - a value between 0 (none) and 1 (algorithm complete)
        Returns:
        true if the callee wishes to hint that the algorithm be cancelled