org.jboss.dna.common.monitor
Class ProgressStatus

java.lang.Object
  extended by org.jboss.dna.common.monitor.ProgressStatus
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ProgressStatus>

@Immutable
public class ProgressStatus
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<ProgressStatus>

A snapshot of the progress on an activity.

Author:
Randall Hauch
See Also:
Serialized Form

Constructor Summary
ProgressStatus(java.lang.String activityName, java.lang.String message, double percentWorked, boolean cancelled)
          Create the progress status.
ProgressStatus(java.lang.String activityName, java.lang.String message, double workedSoFar, double totalWork, boolean cancelled)
          Create the progress status and compute the percentage worked.
 
Method Summary
 int compareTo(ProgressStatus that)
          
 boolean equals(java.lang.Object obj)
          
 java.lang.String getActivityName()
          Get the name of the activity.
 java.lang.String getMessage()
          Get the progress monitor's text message.
 double getPercentWorked()
          Get the progress as a percentage of the total work that's been completed.
 int hashCode()
          
 boolean isCancelled()
          Return whether the activity was requested to be cancelled.
 boolean isDone()
          Return whether work on this activity has completed.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProgressStatus

public ProgressStatus(java.lang.String activityName,
                      java.lang.String message,
                      double percentWorked,
                      boolean cancelled)
Create the progress status.

Parameters:
activityName - the name of the activity, which may not be null
message - the message for the progress, which may not be null
percentWorked - the percentage worked, ranging from 0.0 for not started to 100.0 for complete; a negative value are treated as 0.0, while a value greater than 100.0 is treated as 100.0
cancelled - true if the activity has been requested to be cancelled, or false otherwise

ProgressStatus

public ProgressStatus(java.lang.String activityName,
                      java.lang.String message,
                      double workedSoFar,
                      double totalWork,
                      boolean cancelled)
Create the progress status and compute the percentage worked.

Parameters:
activityName - the name of the activity, which may not be null
message - the message for the progress, which may not be null
workedSoFar - the amount of work so far percentage worked
totalWork - the total amount of work for this activity
cancelled - true if the activity has been requested to be cancelled, or false otherwise
Method Detail

getActivityName

public java.lang.String getActivityName()
Get the name of the activity.

Returns:
the activity's name

getPercentWorked

public double getPercentWorked()
Get the progress as a percentage of the total work that's been completed.

Returns:
the percentage worked, ranging from 0.0 to 100.0

getMessage

public java.lang.String getMessage()
Get the progress monitor's text message.

Returns:
the text message

isDone

public boolean isDone()
Return whether work on this activity has completed.

Returns:
true if work has completed, or false if work on the activity is still progressing
See Also:
isCancelled()

isCancelled

public boolean isCancelled()
Return whether the activity was requested to be cancelled.

Returns:
cancelled
See Also:
isDone()

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(ProgressStatus that)

Specified by:
compareTo in interface java.lang.Comparable<ProgressStatus>


Copyright © 2008. All Rights Reserved.