edu.wpi.cs.DSRG.xmldb.Utils
Class Timer

java.lang.Object
  |
  +--edu.wpi.cs.DSRG.xmldb.Utils.Timer

public class Timer
extends java.lang.Object

It used to calculate the time between two calls. It will simulates the sports timer.


Field Summary
(package private)  java.lang.String name
          Keep the name of this timer.
(package private)  boolean start
          Keep track of the status of the timer.
(package private)  long start_millis
           
(package private)  long stop_millis
           
(package private)  long stored_millis
           
 
Constructor Summary
Timer()
          Create a timer object.
Timer(java.lang.String name)
          Create a timer object with a name.
 
Method Summary
 long get()
          Get the time passed.
static java.lang.String getSystemTime()
          Give back System Time.
 void reset()
          Reset the timer.
 long start_stop()
          Start or stop the timer.
 java.lang.String toString()
          Return the time passed in a specific format.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

start_millis

long start_millis

stop_millis

long stop_millis

stored_millis

long stored_millis

name

java.lang.String name
Keep the name of this timer. It could be empty.

start

boolean start
Keep track of the status of the timer. True means the timer starts, otherwise, timer stopped.
Constructor Detail

Timer

public Timer()
Create a timer object.

Timer

public Timer(java.lang.String name)
Create a timer object with a name.
Method Detail

start_stop

public long start_stop()
Start or stop the timer.
Returns:
It will return the current system time of when this function is called.

reset

public void reset()
Reset the timer.

get

public long get()
Get the time passed. If the time is started, then return the current passed time + the stored time, otherwise return the stored time.
Returns:
the time recored by the timer in millis.

toString

public java.lang.String toString()
Return the time passed in a specific format.
Overrides:
toString in class java.lang.Object

getSystemTime

public static java.lang.String getSystemTime()
Give back System Time.