Class Progressor
-
Field Summary
Fields inherited from class VASSAL.tools.concurrent.RangedRunnable
range, submitted
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int p) Adds some amount to the progress.int
get()
Gets the progress.int
getPct()
Gets the progress as a percentage.void
Increments the progress.protected abstract void
Updates the current progress.void
set
(int prog) Sets the progress.void
setPct
(int pct) Sets the progress as a percentage.protected void
submit()
Submits thisRunnable
to be run on the Event Dispatch Thread.Methods inherited from class VASSAL.tools.concurrent.RangedRunnable
run, setLast
-
Field Details
-
max
protected final int max
-
-
Constructor Details
-
Progressor
public Progressor(int init, int max) Creates aProgressor
with the given bounds.- Parameters:
init
- the initial progress valuemax
- the maximum progress value- Throws:
IllegalArgumentException
- ifinit
is not in[0,max]
IllegalArgumentException
- ifmax < 0
-
-
Method Details
-
set
public void set(int prog) Sets the progress. Setting the progress submits theRunnable
only when it would result in a change in the progress percentage.- Parameters:
prog
- the new progress value- Throws:
IllegalArgumentException
- ifprog
is not in[0,max]
IllegalArgumentException
- ifprog <=
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
-
submit
protected void submit()Submits thisRunnable
to be run on the Event Dispatch Thread.- Specified by:
submit
in classRangedRunnable<Integer>
-