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 Details

    • ProgressCallbackAdapter

      public ProgressCallbackAdapter()
  • Method Details

    • setTotal

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

      public final long getTotal()
      Specified by:
      getTotal in interface IProgressCallback
      Returns:
    • 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
    • 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
    • getCurrent

      public final long getCurrent()
      Specified by:
      getCurrent in interface IProgressCallback
      Returns:
    • increment

      public long increment()
      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