de.jstacs.utils
Class TimeLimitedProgressUpdater

java.lang.Object
  extended by de.jstacs.utils.DefaultProgressUpdater
      extended by 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

Field Summary
 
Fields inherited from class de.jstacs.utils.DefaultProgressUpdater
max
 
Constructor Summary
TimeLimitedProgressUpdater(Time t, int sec, int min, int hours, int days)
          Creates a new TimeLimitedProgressUpdater.
 
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()
           
 
Methods inherited from class de.jstacs.utils.DefaultProgressUpdater
setMax
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeLimitedProgressUpdater

public TimeLimitedProgressUpdater(Time t,
                                  int sec,
                                  int min,
                                  int hours,
                                  int days)
                           throws IllegalArgumentException
Creates a new TimeLimitedProgressUpdater.

Parameters:
t - the current used time
sec - seconds
min - minutes
hours - hours
days - days
Throws:
IllegalArgumentException - if one of sec, min, hours or days is less than 0
See Also:
Time, RealTime, UserTime
Method Detail

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