org.crosswire.common.progress
Interface Progress

All Known Implementing Classes:
Job

public interface Progress

A Generic way of keeping track of Threads and monitoring their progress.

Author:
DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details.
The copyright to this program is held by it's authors.

Field Summary
static int UNKNOWN
          Indicate that the total amount of work is unknown.
 
Method Summary
 void beginJob(String name, int totalWork)
          Start the task.
 void cancel()
          Cancel the job (if possible).
 void done()
          Called to indicate that we are finished doing work.
 String getJobName()
           
 String getSectionName()
          We have moved onto another section so update the section title.
 int getTotalWork()
           
 int getWork()
           
 boolean isCancelable()
          Might the job be cancelable?
 boolean isFinished()
          Used to determine whether job is done or cancelled or reached totalWork.
 void setCancelable(boolean newCancelable)
          Indicates whether the job is cancelable or not.
 void setSectionName(String name)
          We have moved onto another section so update the section title.
 void setWork(int progress)
          Indicate progress toward the whole.
 

Field Detail

UNKNOWN

static final int UNKNOWN
Indicate that the total amount of work is unknown.

See Also:
Constant Field Values
Method Detail

beginJob

void beginJob(String name,
              int totalWork)
Start the task.

Parameters:
name - the initial name of the job.
totalWork - the total amount that is to be worked. If UNKNOWN then the progress is to be guessed.

getJobName

String getJobName()
Returns:
the job name

getTotalWork

int getTotalWork()
Returns:
the total amount of work to be done

done

void done()
Called to indicate that we are finished doing work.


setSectionName

void setSectionName(String name)
We have moved onto another section so update the section title.

Parameters:
name - the name of the section

getSectionName

String getSectionName()
We have moved onto another section so update the section title.


setWork

void setWork(int progress)
Indicate progress toward the whole.

Parameters:
progress - a part of the whole.

getWork

int getWork()
Returns:
the amount of work done so far, possibly estimated

cancel

void cancel()
Cancel the job (if possible). If isCancelable() is false, then the job will be canceled if cancelable becomes true. There is no guarantee that


isFinished

boolean isFinished()
Used to determine whether job is done or cancelled or reached totalWork.


isCancelable

boolean isCancelable()
Might the job be cancelable?


setCancelable

void setCancelable(boolean newCancelable)
Indicates whether the job is cancelable or not.

Parameters:
newCancelable - The state to set.

Copyright ยจ 2003-2006