com.commsen.stopwatch.reports
Class DefaultStopwatchReport

java.lang.Object
  extended by com.commsen.stopwatch.reports.DefaultStopwatchReport
All Implemented Interfaces:
Report, java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
LoadStopwatchReport, MemoryStopwatchReport

public class DefaultStopwatchReport
extends java.lang.Object
implements Report

This is the default implementation of Report interface. It is mainly used by DefaultStopwatchEngine. Note: this class has a natural ordering that is inconsistent with equals.

Author:
Milen Dyankov
See Also:
Report, Serialized Form

Constructor Summary
DefaultStopwatchReport(java.lang.String group, java.lang.String label, long count, double minTime, double maxTime, double averageTime, double totalTime)
          Creates new instance of this class.
 
Method Summary
 int compareTo(java.lang.Object arg0)
          Compares this report with the specified report for order.
 boolean equals(java.lang.Object obj)
           
 double getAverageTime()
          The average of all completed measurements for this label and/or group
 long getCount()
          The number of all completed measurements for this label and/or group
 java.lang.String getGroup()
          Information about the group for which this report was generated.
 java.lang.String getLabel()
          Information about the label for which this report was generated.
 double getMaxTime()
          The maximal of all completed measurements for this label and/or group
 double getMinTime()
          The minimal of all completed measurements for this label and/or group
 double getTotalTime()
          The sum of all completed measurements for this label and/or group
 int hashCode()
           
 java.lang.String toString()
          Generates string representation of this report
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultStopwatchReport

public DefaultStopwatchReport(java.lang.String group,
                              java.lang.String label,
                              long count,
                              double minTime,
                              double maxTime,
                              double averageTime,
                              double totalTime)
Creates new instance of this class.

Parameters:
group -
label -
count -
minTime -
maxTime -
averageTime -
totalTime -
Method Detail

toString

public java.lang.String toString()
Generates string representation of this report

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getAverageTime

public double getAverageTime()
Description copied from interface: Report
The average of all completed measurements for this label and/or group

Specified by:
getAverageTime in interface Report
Returns:
Returns the average.
See Also:
Report.getAverageTime()

getCount

public long getCount()
Description copied from interface: Report
The number of all completed measurements for this label and/or group

Specified by:
getCount in interface Report
Returns:
Returns the count.
See Also:
Report.getCount()

getMinTime

public double getMinTime()
Description copied from interface: Report
The minimal of all completed measurements for this label and/or group

Specified by:
getMinTime in interface Report
Returns:
Returns the fastest.
See Also:
Report.getMinTime()

getGroup

public java.lang.String getGroup()
Description copied from interface: Report
Information about the group for which this report was generated. If null then this is summary report for given lebel (as returned by Report.getLabel()) in all groups.

Specified by:
getGroup in interface Report
Returns:
Returns the group.
See Also:
Report.getGroup()

getLabel

public java.lang.String getLabel()
Description copied from interface: Report
Information about the label for which this report was generated. If null then this is summary report for all lebels in given group (as returned by Report.getGroup()).

Specified by:
getLabel in interface Report
Returns:
Returns the label.
See Also:
Report.getLabel()

getMaxTime

public double getMaxTime()
Description copied from interface: Report
The maximal of all completed measurements for this label and/or group

Specified by:
getMaxTime in interface Report
Returns:
Returns the slowest.
See Also:
Report.getMaxTime()

getTotalTime

public double getTotalTime()
Description copied from interface: Report
The sum of all completed measurements for this label and/or group

Specified by:
getTotalTime in interface Report
Returns:
Returns the total.
See Also:
Report.getTotalTime()

compareTo

public int compareTo(java.lang.Object arg0)
Compares this report with the specified report for order. Returns a negative integer, zero, or a positive integer as this report is less than, equal to, or greater than the specified report.

Note: this class has a natural ordering that is inconsistent with equals: Reports are compared by the value of totalTime. Report A is considered to be less then report B when A.getTotalTime() > B.getTotoalTime()

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
arg0 - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as specified report is less than, equal to, or greater than the current report.
Throws:
java.lang.ClassCastException - if the specified object is not an instnce of Report

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2006-2008 Commsen International. All Rights Reserved.