net.ctdp.rfdynhud.valuemanagers
Class TimeBasedClock

java.lang.Object
  extended by net.ctdp.rfdynhud.valuemanagers.Clock
      extended by net.ctdp.rfdynhud.valuemanagers.TimeBasedClock
All Implemented Interfaces:
ManagedValue

public class TimeBasedClock
extends Clock

The TimeBasedClock calculates frame gaps based on a given time delay to know, when to set the clock flag and when to reset.

Author:
Marvin Froehlich (CTDP)

Field Summary
static long DEFAULT_MIN_FRAMES
           
 
Fields inherited from class net.ctdp.rfdynhud.valuemanagers.Clock
ONE_SECOND_NANOS
 
Constructor Summary
TimeBasedClock(long delay)
           
TimeBasedClock(long delay, long minFrames)
           
 
Method Summary
protected  void initImpl(long nanoTime)
          Implementation specific code for initialization.
protected  boolean updateImpl(long nanoTime, long frameCounter, boolean force)
          Implementation of the update method.
 
Methods inherited from class net.ctdp.rfdynhud.valuemanagers.Clock
c, c, c2, c3, getTicks, init, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MIN_FRAMES

public static final long DEFAULT_MIN_FRAMES
See Also:
Constant Field Values
Constructor Detail

TimeBasedClock

public TimeBasedClock(long delay,
                      long minFrames)

TimeBasedClock

public TimeBasedClock(long delay)
Method Detail

initImpl

protected void initImpl(long nanoTime)
Implementation specific code for initialization.

Specified by:
initImpl in class Clock
Parameters:
nanoTime - the starting time stamp

updateImpl

protected boolean updateImpl(long nanoTime,
                             long frameCounter,
                             boolean force)
Implementation of the update method.

Specified by:
updateImpl in class Clock
Parameters:
nanoTime - the current timestamp in nano seconds
frameCounter - the current frame index
force - force clock to true.
Returns:
true to set the Clock flag to true.