org.perfectjpattern.core.behavioral.observer.data
Class ProgressData

java.lang.Object
  extended by org.perfectjpattern.core.behavioral.observer.data.StatusData
      extended by org.perfectjpattern.core.behavioral.observer.data.ProgressData
All Implemented Interfaces:
IEventData

public class ProgressData
extends StatusData

Immutable Observer event data intended to be used in notifying progress information.

Version:
$Revision: 1.0 $ $Date: Jun 17, 2007 3:00:29 PM $
Author:
Giovanni Azua
 

Field Summary
static ProgressData COMPLETED
          Reusable ProgressData instance corresponding to a Completed event.
static ProgressData FAILED
          Reusable ProgressData instance corresponding to a Failed event.
static ProgressData STARTED
          Reusable ProgressData instance corresponding to a Started event.
 
Constructor Summary
ProgressData(ProgressData aProgressData)
          Copy constructor.
ProgressData(Status aStatus, String aMessage, int aProgress)
          Creates a progress information with precalculated task percentage completed.
ProgressData(Status aStatus, String aMessage, int aTotal, int aCurrent)
          Creates a progress information with total and current progress values, this variation of the constructor calculates the percentage based on the two values.
 
Method Summary
 boolean equals(Object anObject)
          
 int getProgress()
          Returns the progress information as an Integer with value between 0 and 100.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class org.perfectjpattern.core.behavioral.observer.data.StatusData
getMessage, getStatus
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

STARTED

public static final ProgressData STARTED
Reusable ProgressData instance corresponding to a Started event.


FAILED

public static final ProgressData FAILED
Reusable ProgressData instance corresponding to a Failed event.


COMPLETED

public static final ProgressData COMPLETED
Reusable ProgressData instance corresponding to a Completed event.

Constructor Detail

ProgressData

public ProgressData(Status aStatus,
                    String aMessage,
                    int aProgress)
Creates a progress information with precalculated task percentage completed.

Parameters:
aStatus - Status of the task
aMessage - Description of the current status
aProgress - Percentage of completion of the task [0 .. 100]
Throws:
IllegalArgumentException - "'aStatus' must not be null"
IllegalArgumentException - "'aMessage' must not be null"

ProgressData

public ProgressData(Status aStatus,
                    String aMessage,
                    int aTotal,
                    int aCurrent)
Creates a progress information with total and current progress values, this variation of the constructor calculates the percentage based on the two values.

Parameters:
aStatus - Status of the task
aMessage - Description of the current status
aTotal - Numeric total of the task
aCurrent - Current value of the task in reference to the total

ProgressData

public ProgressData(ProgressData aProgressData)
Copy constructor.

Parameters:
aProgressData - Existing ProgressData
Method Detail

getProgress

public int getProgress()
Returns the progress information as an Integer with value between 0 and 100.

Returns:
Progress information as an Integer with value between 0 and 100.

equals

public boolean equals(Object anObject)

Overrides:
equals in class StatusData

hashCode

public int hashCode()

Overrides:
hashCode in class StatusData

toString

public String toString()

Overrides:
toString in class StatusData


Copyright © 2007-2009. All Rights Reserved.