|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.javatools.util.Chronometer
public final class Chronometer
This class implements a virtual digital stopwatch (or chronometer), providing basic and useful functionalities for time measurement, such as start(), stop(), multiple laps and total elapsed running time.
| Nested Class Summary | |
|---|---|
static class |
Chronometer.PrecisionDefines the method to be utilized by a Chronometer instance in order to obtain current time. |
| Constructor Summary | |
|---|---|
Chronometer()Default constructor. |
|
Chronometer(Chronometer.Precision precision)Constructor. |
|
| Method Summary | |
|---|---|
int |
countLaps()The total count of laps this chronometer is currently keeping track of. |
java.lang.String |
dumpTimes()This method will dump the entire content of the chronometer to a string. |
static java.lang.String |
format(long time)Converts a time interval to a human-readable text up to the millisecond. |
static java.lang.String |
format(long time, Chronometer.Precision precision)Converts a time interval to a human-readable text up to the specificed precision. |
long |
getCurrentLap()Gets the running time elapsed for the current lap, which excludes any time elapsed while the chronometer was stopped. |
long |
getElapsedTime()Total elapsed time during which the chronometer is or was running. |
long |
getLap(java.lang.String label)Gets the running time elapsed for the given labeled lap. |
boolean |
isRunning() |
void |
newLap(java.lang.String label)Starts of a new labeled lap and also stops the previous one, if any. |
void |
reset()Completely resets the chronometer, putting it in stop state. |
void |
start()Starts the chronometer. |
long |
stop()Completely "freezes" the chronometer, including any current lap. |
java.lang.String |
toString()Converts the current elapsed time to a human-readable text up to the chronometer's precision. |
java.lang.String |
toString(java.lang.String label)Converts the current elapsed time for a given lap to a human-readable text up to the chronometer's precision. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Chronometer()
Chronometer(Precision.Milliseconds.public Chronometer(Chronometer.Precision precision)
precision - The chronometer's precision| Method Detail |
|---|
public long stop()
Completely "freezes" the chronometer, including any current lap.
Calling start() after a stop means that the chronometer will restart exactly from the last stop. In other words, the time elapsed between these two sequential calls: stop() -> start() won't count.
getElapsedTime()public void reset()
public void start()
Starts the chronometer.
Calling start after a stop() means that the chronometer will restart exactly from the last stop. In other words, the time elapsed between these two sequential calls: stop() -> start() won't count.
If the chronometer is already running, an IllegalStateException will be thrown.
public boolean isRunning()
public long getElapsedTime()
public int countLaps()
public void newLap(java.lang.String label)
Starts of a new labeled lap and also stops the previous one, if any.
The chronometer has to be running, othersize an IllegalStateException will be thrown.
label - Non-null label for the new lappublic long getLap(java.lang.String label)
label - Label of the lap to retrievepublic long getCurrentLap()
public static java.lang.String format(long time)
time - Elapsed time
public static java.lang.String format(long time,
Chronometer.Precision precision)
time - Elapsed timejava.lang.NullPointerException - If given precision is nullpublic java.lang.String dumpTimes()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(java.lang.String label)
label - The label associated with the desired lap
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||