de.jstacs.utils
Class TimeLimitedProgressUpdater
java.lang.Object
de.jstacs.utils.DefaultProgressUpdater
de.jstacs.utils.TimeLimitedProgressUpdater
- All Implemented Interfaces:
- ProgressUpdater
public class TimeLimitedProgressUpdater
- extends DefaultProgressUpdater
This class is an extension of DefaultProgressUpdater
. It prints the
percentage of iterations that is already done on the screen. Furthermore it
limits the time of the progress. If a progress calls the method
isCancelled()
and the time given in the constructor has passed
false
is returned. Be aware: this class does not stop a progress
after a certain time, it only answers on request. The user has to stop the
progress!
- Author:
- Jens Keilwagen
Method Summary |
boolean |
isCancelled()
Specifies if the process is cancelled by the user. |
void |
setValue(int value)
Sets the current value the supervised process has reached. |
String |
toString()
|
TimeLimitedProgressUpdater
public TimeLimitedProgressUpdater(Time t,
int sec,
int min,
int hours,
int days)
throws IllegalArgumentException
- Creates a new
TimeLimitedProgressUpdater
.
- Parameters:
t
- the current used timesec
- secondsmin
- minuteshours
- hoursdays
- days
- Throws:
IllegalArgumentException
- if one of sec
, min
,
hours
or days
is less than 0- See Also:
Time
,
RealTime
,
UserTime
setValue
public void setValue(int value)
- Description copied from interface:
ProgressUpdater
- Sets the current value the supervised process has reached.
- Specified by:
setValue
in interface ProgressUpdater
- Overrides:
setValue
in class DefaultProgressUpdater
- Parameters:
value
- the current value
isCancelled
public boolean isCancelled()
- Description copied from interface:
ProgressUpdater
- Specifies if the process is cancelled by the user.
- Specified by:
isCancelled
in interface ProgressUpdater
- Overrides:
isCancelled
in class DefaultProgressUpdater
- Returns:
true
if process was cancelled, false
otherwise
toString
public String toString()
- Overrides:
toString
in class Object