Class TimeCounter

java.lang.Object
  |
  +--TimeCounter

public class TimeCounter
extends java.lang.Object

This class stores elapsed time. The time is recorded in 10ths of a second. Methods exist to convert the stored time into standard minute, second, hours format.


Constructor Summary
TimeCounter()
          Create a TimeCounter that is initialized to 0.
TimeCounter(int tenthSecs)
          Create a TimeCounter set to a specified value.
 
Method Summary
 int getHours()
          If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of hours (or HH above).
 int getMinutes()
          If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of minutes (or MM above).
 int getSeconds()
          If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of seconds (or SS above).
 int getTime()
          Get the elapsed time in 10ths of a second.
 int getTSeconds()
          If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of 10ths of seconds (or T above).
 void reset()
          Resets the elapsed time to 0.
 void setTime(int tenthSecs)
          Set the elapsed time.
 void tick()
          Add a 10th of a second to the elapsed time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeCounter

public TimeCounter()
Create a TimeCounter that is initialized to 0.

TimeCounter

public TimeCounter(int tenthSecs)
Create a TimeCounter set to a specified value.
Parameters:
tenthSecs - number of 10ths of a second to record. Must be a positive value.
Method Detail

getTime

public int getTime()
Get the elapsed time in 10ths of a second.
Returns:
the time in 10ths of a second

setTime

public void setTime(int tenthSecs)
Set the elapsed time.
Parameters:
tenthSecs - Elapsed time in 10ths of a second

tick

public void tick()
Add a 10th of a second to the elapsed time.

getTSeconds

public int getTSeconds()
If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of 10ths of seconds (or T above).
Returns:
the number of 10ths of a second past the second represented by this time

getSeconds

public int getSeconds()
If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of seconds (or SS above).
Returns:
the number of seconds past the minute stored by this TimeCounter

getMinutes

public int getMinutes()
If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of minutes (or MM above).
Returns:
the number of minutes past the hour stored by this TimeCounter

getHours

public int getHours()
If the elapsed time was written in HH:MM:SS.T form (where HH==hours, MM==minutes, SS==seconds, and T==10ths of seconds), this method returns the number of hours (or HH above).
Returns:
the number of hours stored by this TimeCounter

reset

public void reset()
Resets the elapsed time to 0.