Class Progressor

All Implemented Interfaces:
Runnable

public abstract class Progressor extends RangedRunnable<Integer>
A progress handler.
Since:
3.1.11
Author:
Joel Uckelman
  • Field Details

    • max

      protected final int max
  • Constructor Details

    • Progressor

      public Progressor(int init, int max)
      Creates a Progressor with the given bounds.
      Parameters:
      init - the initial progress value
      max - the maximum progress value
      Throws:
      IllegalArgumentException - if init is not in [0,max]
      IllegalArgumentException - if max &lt; 0
  • Method Details

    • set

      public void set(int prog)
      Sets the progress. Setting the progress submits the Runnable only when it would result in a change in the progress percentage.
      Parameters:
      prog - the new progress value
      Throws:
      IllegalArgumentException - if prog is not in [0,max]
      IllegalArgumentException - if prog &lt;= current value
    • get

      public int get()
      Gets the progress.
      Returns:
      the progress value
    • increment

      public void increment()
      Increments the progress.
    • add

      public void add(int p)
      Adds some amount to the progress.
    • setPct

      public void setPct(int pct)
      Sets the progress as a percentage.
      Parameters:
      pct - the progress percentage
    • getPct

      public int getPct()
      Gets the progress as a percentage.
      Returns:
      the progress percentage
    • run

      protected abstract void run(Pair<Integer,Integer> prog)
      Updates the current progress.
      Specified by:
      run in class RangedRunnable<Integer>
      Parameters:
      prog - the range of progress since the last update
    • submit

      protected void submit()
      Submits this Runnable to be run on the Event Dispatch Thread.
      Specified by:
      submit in class RangedRunnable<Integer>