Class ProgressCallbackAdapter

java.lang.Object
com.pnfsoftware.jeb.util.base.ProgressCallbackAdapter
All Implemented Interfaces:
IProgressCallback

public class ProgressCallbackAdapter extends Object implements IProgressCallback
A concurrency-friendly, standard implementation of the progress callback interface. Sub-classes may override the methods they want.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final long
    Retrieve the current unit count.
    final long
    Retrieve the total unit count.
    long
    Increment the current unit count.
    void
    message(int id, String msg)
    This method is used by the provider to send a transient message to its client.
    void
    setCurrent(long current)
    This method is called by a provider to update the current computation count.
    void
    setTotal(long total)
    This method is called by a provider (generally once) to set an initial (possibly estimated) computation count.
    void
    updateTotal(long count)
    Set or update the total by the provided unit amount.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.pnfsoftware.jeb.util.base.IProgressCallback

    isInitialized, message
  • Constructor Details

    • ProgressCallbackAdapter

      public ProgressCallbackAdapter()
  • Method Details

    • setTotal

      public void setTotal(long total)
      Description copied from interface: IProgressCallback
      This method is called by a provider (generally once) to set an initial (possibly estimated) computation count. The number in itself is arbitrary.
      Specified by:
      setTotal in interface IProgressCallback
      Parameters:
      total - total unit count
    • getTotal

      public final long getTotal()
      Description copied from interface: IProgressCallback
      Retrieve the total unit count.
      Specified by:
      getTotal in interface IProgressCallback
      Returns:
      total unit count
    • updateTotal

      public void updateTotal(long count)
      Description copied from interface: IProgressCallback
      Set or update the total by the provided unit amount. If the total had been set, it is updated; else, it is set.
      Specified by:
      updateTotal in interface IProgressCallback
      Parameters:
      count - unit count to add or set
    • setCurrent

      public void setCurrent(long current)
      Description copied from interface: IProgressCallback
      This method is called by a provider to update the current computation count. Together with the total count, a client may compute an estimated completion ratio.
      Specified by:
      setCurrent in interface IProgressCallback
      Parameters:
      current - current unit count
    • getCurrent

      public final long getCurrent()
      Description copied from interface: IProgressCallback
      Retrieve the current unit count.
      Specified by:
      getCurrent in interface IProgressCallback
      Returns:
      current unit count
    • increment

      public long increment()
      Description copied from interface: IProgressCallback
      Increment the current unit count.
      Specified by:
      increment in interface IProgressCallback
      Returns:
      the incremented value
    • message

      public void message(int id, String msg)
      Description copied from interface: IProgressCallback
      This method is used by the provider to send a transient message to its client.
      Specified by:
      message in interface IProgressCallback
      Parameters:
      id - message id (0 or 1)
      msg - message string