org.wings.util
Class TimeMeasure

java.lang.Object
  extended by org.wings.util.TimeMeasure

public class TimeMeasure
extends Object

Some simple stop watch. It allows to measure multiple time periods and prints them. Usage: call start(comment) and stop() for each period of time.

Author:
Armin Haaf

Field Summary
protected  org.wings.util.TimeMeasure.Measure current
          the current time measurement.
protected  MessageFormat formatter
          Message formatter
protected  ArrayList measures
          List of measurements.
protected static double RESOLUTION
           
 
Constructor Summary
TimeMeasure()
          Simple TimeMesaure with default format.
TimeMeasure(MessageFormat formatter)
          A new TimeMeasure which reports in a specific format.
 
Method Summary
 String print()
           
 String print(boolean shortestIsReference)
          creates a formatted output (using the MessageFormat) of all results.
 void reset()
          Reset of all Measurements.
 void start(String comment)
           
 void stop()
          stop current time measurement and store it.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOLUTION

protected static final double RESOLUTION
See Also:
Constant Field Values

measures

protected final ArrayList measures
List of measurements.


formatter

protected final MessageFormat formatter
Message formatter


current

protected org.wings.util.TimeMeasure.Measure current
the current time measurement.

Constructor Detail

TimeMeasure

public TimeMeasure()
Simple TimeMesaure with default format.


TimeMeasure

public TimeMeasure(MessageFormat formatter)
A new TimeMeasure which reports in a specific format. The format is a standard MessageFormat with the following variables:

Method Detail

reset

public void reset()
Reset of all Measurements.


start

public void start(String comment)

stop

public void stop()
stop current time measurement and store it.


print

public String print()

print

public String print(boolean shortestIsReference)
creates a formatted output (using the MessageFormat) of all results. The output is sorted in the in the sequence the time measurements took place. Writes the relative time to either the shortest or the longest time interval.

Parameters:
shortestIsReference - boolean true, if the shortest time interval is the reference value (1.0). False, if the longest is the reference.

toString

public String toString()
Overrides:
toString in class Object


wingS Swings ;-)