Package wsh.util

Class PartialMonitor

  • All Implemented Interfaces:
    Monitor

    public class PartialMonitor
    extends java.lang.Object
    implements Monitor
    Wrap an existing Monitor with a partial range. Note that only makes sense to call initReport() with the first wrapper used.
    • Constructor Summary

      Constructors 
      Constructor Description
      PartialMonitor​(Monitor wrapped, double begin, double end)
      An existing Monitor will be wrapped for progress in a limited range.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void initReport​(double initFraction)
      Initialize the fraction of the work that was completed when the process started.
      boolean isCanceled()
      If true, then any further progress should be cancelled.
      void report​(double fraction)
      This method will be called with the current fraction of work done.
      • Methods inherited from class java.lang.Object

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

      • PartialMonitor

        public PartialMonitor​(Monitor wrapped,
                              double begin,
                              double end)
        An existing Monitor will be wrapped for progress in a limited range.
        Parameters:
        wrapped - The wrapped monitor.
        begin - The first value to be updated to the wrapped monitor, corresponding to a 0 reported to this monitor.
        end - The last value to be updated to the wrapped monitor corresponding to a 1 reported to this monitor.
    • Method Detail

      • report

        public void report​(double fraction)
        Description copied from interface: Monitor
        This method will be called with the current fraction of work done. Values range from 0 at the beginning to 1 when all work is done.
        Specified by:
        report in interface Monitor
        Parameters:
        fraction - Fraction of work done so far, from 0 to 1. This value must equal or exceed all values previously passed to this method or to initReport.
      • isCanceled

        public boolean isCanceled()
        Description copied from interface: Monitor
        If true, then any further progress should be cancelled.
        Specified by:
        isCanceled in interface Monitor
        Returns:
        true, when any requested work should be interrupted. False, if progress is expected to run to completion.
      • initReport

        public void initReport​(double initFraction)
        Description copied from interface: Monitor
        Initialize the fraction of the work that was completed when the process started. If not called, then assumed to be 0.
        Specified by:
        initReport in interface Monitor
        Parameters:
        initFraction - Fraction of work done when process started, from 0 to 1.