Class NullMonitor

java.lang.Object
org.pgcodekeeper.core.monitor.NullMonitor
All Implemented Interfaces:
IMonitor

public class NullMonitor extends Object implements IMonitor
A null object implementation of IMonitor that provides no-op behavior for all monitoring operations except cancellation state management. This class can be used when monitoring functionality is not required but an IMonitor instance must be provided.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a sub-monitor for tracking a portion of this monitor's work.
    boolean
    Returns whether this monitor has been canceled.
    void
    setCanceled(boolean cancelled)
    Sets the cancellation state of this monitor.
    void
    setWorkRemaining(int size)
    Sets the number of work units remaining for this monitor.
    void
    worked(int i)
    Notifies that a given number of work units have been completed.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NullMonitor

      public NullMonitor()
  • Method Details

    • setCanceled

      public void setCanceled(boolean cancelled)
      Description copied from interface: IMonitor
      Sets the cancellation state of this monitor.
      Specified by:
      setCanceled in interface IMonitor
      Parameters:
      cancelled - true to cancel the operation, false otherwise
    • isCanceled

      public boolean isCanceled()
      Description copied from interface: IMonitor
      Returns whether this monitor has been canceled.
      Specified by:
      isCanceled in interface IMonitor
      Returns:
      true if the operation has been canceled, false otherwise
    • worked

      public void worked(int i)
      Description copied from interface: IMonitor
      Notifies that a given number of work units have been completed.
      Specified by:
      worked in interface IMonitor
      Parameters:
      i - the number of work units completed
    • createSubMonitor

      public IMonitor createSubMonitor()
      Description copied from interface: IMonitor
      Creates a sub-monitor for tracking a portion of this monitor's work.
      Specified by:
      createSubMonitor in interface IMonitor
      Returns:
      a new sub-monitor instance
    • setWorkRemaining

      public void setWorkRemaining(int size)
      Description copied from interface: IMonitor
      Sets the number of work units remaining for this monitor.
      Specified by:
      setWorkRemaining in interface IMonitor
      Parameters:
      size - the number of work units remaining