net.ctdp.rfdynhud.gamedata
Class FuelUsageRecorder

java.lang.Object
  extended by net.ctdp.rfdynhud.gamedata.FuelUsageRecorder
All Implemented Interfaces:
LiveGameData.GameDataUpdateListener, ScoringInfo.ScoringInfoUpdateListener

public class FuelUsageRecorder
extends java.lang.Object
implements ScoringInfo.ScoringInfoUpdateListener

Records fuel usages per lap.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
FuelUsageRecorder()
           
 
Method Summary
 float getAverage()
          Gets the average fuel usage of all recorded (timed) laps.
 int getFuelRelevantLaps()
          Gets the number of recorded (timed) laps.
 float getLastLap()
          Gets the fuel usage of the last (timed) lap.
 void liveReset(LiveGameData gameData)
          Call this to reset the recorder while in cockpit.
 void onGamePauseStateChanged(LiveGameData gameData, boolean isEditorMode, boolean isPaused)
          
 void onPlayerJoined(LiveGameData gameData, VehicleScoringInfo joinedVSI, boolean rejoined)
           
 void onPlayerLeft(LiveGameData gameData, java.lang.Integer vsiID)
           
 void onRealtimeEntered(LiveGameData gameData, boolean isEditorMode)
          
 void onRealtimeExited(LiveGameData gameData, boolean isEditorMode)
          
 void onScoringInfoUpdated(LiveGameData gameData, boolean isEditorMode)
          
 void onSessionStarted(LiveGameData gameData, boolean isEditorMode)
          
protected  void onValuesUpdated(LiveGameData gameData, int fuelRelevantLaps, float relevantFuel, float lastLap, float average)
          This event is invoked when the key values have been updated.
 void reset(LiveGameData gameData)
          Call this to reset the whole thing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FuelUsageRecorder

public FuelUsageRecorder()
Method Detail

getLastLap

public final float getLastLap()
Gets the fuel usage of the last (timed) lap.

Returns:
the fuel usage of the last (timed) lap.

getAverage

public final float getAverage()
Gets the average fuel usage of all recorded (timed) laps.

Returns:
the average fuel usage of all recorded (timed) laps.

getFuelRelevantLaps

public final int getFuelRelevantLaps()
Gets the number of recorded (timed) laps.

Returns:
the number of recorded (timed) laps.

onValuesUpdated

protected void onValuesUpdated(LiveGameData gameData,
                               int fuelRelevantLaps,
                               float relevantFuel,
                               float lastLap,
                               float average)
This event is invoked when the key values have been updated.

Parameters:
gameData - the game data
fuelRelevantLaps - the fuel relevant laps
relevantFuel - the relevant fuel
lastLap - the last lap's fuel usage
average - the average fuel usage

reset

public void reset(LiveGameData gameData)
Call this to reset the whole thing.

Parameters:
gameData - the game data

liveReset

public void liveReset(LiveGameData gameData)
Call this to reset the recorder while in cockpit.

Parameters:
gameData - the game data

onSessionStarted

public void onSessionStarted(LiveGameData gameData,
                             boolean isEditorMode)

Specified by:
onSessionStarted in interface LiveGameData.GameDataUpdateListener

onRealtimeEntered

public void onRealtimeEntered(LiveGameData gameData,
                              boolean isEditorMode)

Specified by:
onRealtimeEntered in interface LiveGameData.GameDataUpdateListener

onScoringInfoUpdated

public void onScoringInfoUpdated(LiveGameData gameData,
                                 boolean isEditorMode)

Specified by:
onScoringInfoUpdated in interface ScoringInfo.ScoringInfoUpdateListener

onPlayerJoined

public void onPlayerJoined(LiveGameData gameData,
                           VehicleScoringInfo joinedVSI,
                           boolean rejoined)
Specified by:
onPlayerJoined in interface ScoringInfo.ScoringInfoUpdateListener

onPlayerLeft

public void onPlayerLeft(LiveGameData gameData,
                         java.lang.Integer vsiID)
Specified by:
onPlayerLeft in interface ScoringInfo.ScoringInfoUpdateListener

onGamePauseStateChanged

public void onGamePauseStateChanged(LiveGameData gameData,
                                    boolean isEditorMode,
                                    boolean isPaused)

Specified by:
onGamePauseStateChanged in interface LiveGameData.GameDataUpdateListener

onRealtimeExited

public void onRealtimeExited(LiveGameData gameData,
                             boolean isEditorMode)

Specified by:
onRealtimeExited in interface LiveGameData.GameDataUpdateListener