net.ctdp.rfdynhud.valuemanagers
Class ValueInterpolater

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

public class ValueInterpolater
extends java.lang.Object
implements ManagedValue

Interpolates a float value along time.

Author:
Marvin Froehlich (CTDP)

Nested Class Summary
static class ValueInterpolater.BoundaryType
           
 
Constructor Summary
ValueInterpolater(ValueInterpolater.BoundaryType boundaryType, float minValue, float maxValue, float startValue, float speed)
           
 
Method Summary
 ValueInterpolater.BoundaryType getBoundaryType()
          Gets the used ValueInterpolater.BoundaryType.
 float getMaxValue()
          Gets the maxmum value.
 float getMinValue()
          Gets the minimum value.
 float getSpeed()
          Gets the speed.
 float getStartValue()
          Gets the start value (set by the init(long) method).
 float getValue()
          Gets the current value.
 void init(long nanoTime)
          Initializes/resets the ManagedValue.
 void update(long nanoTime)
           
 void update(long nanoTime, long frameCounter, boolean force)
          Invokes the implementation specific update code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueInterpolater

public ValueInterpolater(ValueInterpolater.BoundaryType boundaryType,
                         float minValue,
                         float maxValue,
                         float startValue,
                         float speed)
Method Detail

getBoundaryType

public final ValueInterpolater.BoundaryType getBoundaryType()
Gets the used ValueInterpolater.BoundaryType.

Returns:
the used ValueInterpolater.BoundaryType.

getMinValue

public final float getMinValue()
Gets the minimum value.

Returns:
the minimum value.

getMaxValue

public final float getMaxValue()
Gets the maxmum value.

Returns:
the maxmum value.

getStartValue

public final float getStartValue()
Gets the start value (set by the init(long) method).

Returns:
the start value.

getSpeed

public final float getSpeed()
Gets the speed. This is the time in seconds for moving from minValue to maxValue.

Returns:
the speed in seconds.

getValue

public final float getValue()
Gets the current value.

Returns:
the interpolated value

init

public void init(long nanoTime)
Initializes/resets the ManagedValue.

Specified by:
init in interface ManagedValue
Parameters:
nanoTime - the starting time stamp

update

public void update(long nanoTime,
                   long frameCounter,
                   boolean force)
Invokes the implementation specific update code.

Specified by:
update in interface ManagedValue
Parameters:
nanoTime - the current timestamp in nano seconds
frameCounter - the current frame index
force - force clock to true.

update

public final void update(long nanoTime)