pslib
Class PSTimer

java.lang.Object
  extended by pslib.PSTimer

public class PSTimer
extends java.lang.Object

PSTimer Class

The PSTimer object provides timer funtionality. The object also stores the delta time between updates.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.


Constructor Summary
PSTimer()
          Create a new object instance
 
Method Summary
 long delta()
          Return the time between calls to time() in milliseconds
 boolean isPaused()
          Return true if the timer is paused
 void pause(boolean p)
          Pause the timer
 void reset()
          Reset the timer to 0
 void reset(int t)
          Reset the timer to the specified value
 long time()
          Update the timer and return the current time in milliseconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSTimer

public PSTimer()
Create a new object instance

Method Detail

time

public final long time()
Update the timer and return the current time in milliseconds

Returns:
the current time in milliseconds

delta

public final long delta()
Return the time between calls to time() in milliseconds

Returns:
the time between calls to time() in milliseconds

reset

public final void reset()
Reset the timer to 0


reset

public final void reset(int t)
Reset the timer to the specified value

Parameters:
t - time in milliseconds

pause

public final void pause(boolean p)
Pause the timer

Parameters:
p - boolean

isPaused

public final boolean isPaused()
Return true if the timer is paused

Returns:
true if the timer is paused