giny.util
Interface MonitorableTask

All Known Implementing Classes:
IntNodeDistances, NodeDistances

public interface MonitorableTask

Classes that perform long tasks (like graph algorithms) can implement this interface so that they can be monitored by a GUI like a javax.swing.plaf.ProgressBarUI or a javax.swing.ProgressMonitor


Method Summary
 int getCurrentProgress()
           
 java.lang.String getCurrentStatusMessage()
           
 int getLengthOfTask()
           
 java.lang.String getTaskDescription()
           
 boolean isDone()
           
 void start(boolean return_when_done)
          Starts doing the task in a separate thread so that the GUI stays responsive
 void stop()
          Stops the task if it is currently running.
 boolean wasCanceled()
           
 

Method Detail

isDone

public boolean isDone()
Returns:
true if the task is done, false otherwise

getCurrentProgress

public int getCurrentProgress()
Returns:
the current progress

getLengthOfTask

public int getLengthOfTask()
Returns:
the total length of the task

getTaskDescription

public java.lang.String getTaskDescription()
Returns:
a String describing the task being performed

getCurrentStatusMessage

public java.lang.String getCurrentStatusMessage()
Returns:
a String status message describing what the task is currently doing (example: "Completed 23% of total.", "Initializing...", etc).

start

public void start(boolean return_when_done)
Starts doing the task in a separate thread so that the GUI stays responsive

Parameters:
return_when_done - if true, then this method will return only when the task is done, else, it will return immediately after spawning the thread that performs the task

stop

public void stop()
Stops the task if it is currently running.


wasCanceled

public boolean wasCanceled()
Returns:
true if the task was canceled before it was done (for example, by calling MonitorableSwingWorker.stop(), false otherwise