net.ctdp.rfdynhud.gamedata
Class ScoringInfo

java.lang.Object
  extended by net.ctdp.rfdynhud.gamedata.ScoringInfo

public class ScoringInfo
extends java.lang.Object

Author:
Marvin Froehlich (CTDP)

Nested Class Summary
static interface ScoringInfo.ScoringInfoUpdateListener
           
 
Method Summary
 float getAmbientTemperature()
          Gets ambient temperature (Celsius)
 float getCloudDarkness()
          Gets cloud darkness?
 VehicleScoringInfo getCompareVSI()
           Gets the VehicleScoringInfo to compare against.
 float getEndTime()
          Gets session ending time.
 int getEstimatedMaxLaps(VehicleScoringInfo vsi)
          Gets the estimated max laps based on the session end time and average lap time.
 long getExtrapolationNanos()
          Returns the nano seconds since the last ScoringInfo update.
 float getExtrapolationTime()
          Returns the seconds since the last ScoringInfo update.
 Laptime getFastestLaptime()
          Gets the absolute fastes lap time.
 VehicleScoringInfo getFastestLapVSI()
          Gets the VehicleScoringInfo for the fastest lap.
 VehicleScoringInfo getFastestSector1VSI()
          Gets the VehicleScoringInfo for the fastest sector1.
 VehicleScoringInfo getFastestSector2VSI()
          Gets the VehicleScoringInfo for the fastest sector2.
 VehicleScoringInfo getFastestSector3VSI()
          Gets the VehicleScoringInfo for the fastest sector3.
 VehicleScoringInfo getFastestSectorVSI(int sector)
          Gets the VehicleScoringInfo for the fastest sector i.
 GamePhase getGamePhase()
          Gets the current game phase.
 VehicleScoringInfo getLeadersVehicleScoringInfo()
          Gets the leader's VehicleScoringInfo.
 int getMaxLaps()
          Gets maximum laps.
 int getNumRedLights()
          Gets the number of red lights in start sequence.
 int getNumVehicles()
          Gets the current number of vehicles.
 int getNumVehiclesInSameClass(VehicleScoringInfo vsi)
          Gets the number of vehicles in the same vehicle class as the given one.
 float getOffPathWetness()
          Gets wetness off main path 0.0-1.0
 float getOnPathWetness()
          Gets wetness on main path 0.0-1.0
 short getOwnPlace(boolean byClass)
          Gets the position of the player.
 java.lang.String getPlayerFilename()
          Gets the player's filename (PLR) (may be encoded to be a legal filename).
 java.lang.String getPlayerName()
          Gets the player name (including possible multiplayer override).
 VehicleScoringInfo getPlayersVehicleScoringInfo()
          Gets the player's VehicleScroingInfo.
 double getRaceLengthPercentage()
          Gets a multiplier in range [0, 1] for the race distance.
 float getRainingSeverity()
          Gets raining severity 0.0-1.0
 long getRealtimeEnteredTimestamp()
          Gets the system timestamp in nanoseconds, at which the player entered realtime mode.
 int getRealtimeEntredId()
          This ID is incremented each time, the player enters realtime mode.
 VehicleScoringInfo getSecondFastestLapVSI()
          Gets the VehicleScoringInfo for the second fastest lap (or null).
 boolean getSectorYellowFlag(int sector)
          Gets whether there are any local yellows at the moment in the sector.
 int getSessionId()
          This Session ID is incremented every time, a new session is started.
 long getSessionNanos()
          Gets the nano seconds, the current session is running.
 long getSessionStartTimestamp()
          Gets the system timestamp in nanoseconds, at which the current session was started.
 float getSessionTime()
          Gets current session time.
 SessionType getSessionType()
          Gets current session type.
 int getStartLightFrame()
          Gets the current start light frame (number depends on track).
 ThreeLetterCodeGenerator getThreeLetterCodeGenerator()
          Gets the generator to use to generate three-letter-codes and short forms from driver names.
 float getTrackLength()
          Gets the distance around track.
 java.lang.String getTrackName()
          Gets the current track name.
 float getTrackTemperature()
          Gets track temperature (Celsius)
 long getUpdateId()
          Gets an ID, that in incremented every time, this ScoringInfo object is filled with new data from the game.
 VehicleScoringInfo getVehicleScoringInfo(int i)
          Gets the i-th vehicle scoring info.
 int getVehicleScoringInfos(VehicleScoringInfo[] vsis)
          Gets all the current VehicleScoringInfos and writes them into the given array.
 VehicleScoringInfo getViewedVehicleScoringInfo()
          Gets the viewed's VehicleScroingInfo (this is just a guess, but should be correct).
 void getWindSpeed(TelemVect3 speed)
          Gets wind speed
 YellowFlagState getYellowFlagState()
          Gets the current yellow flag state (applies to full-course only).
 boolean isInRealtimeMode()
          Gets whether we're in realtime as opposed to at the monitor.
 boolean isSessionRunning()
          Gets whether a session is currently running or not.
 boolean isUpdatedInTimeScope()
          Gets, whether the last update of these data has been done while in running session resp. realtime mode.
 boolean isValid()
          Gets whether this data has been updated in the current session.
 void readFromStream(java.io.InputStream in)
           
 void registerListener(ScoringInfo.ScoringInfoUpdateListener l)
           
 void setThreeLetterCodeGenerator(ThreeLetterCodeGenerator tlcGenerator)
          Sets the generator to use to generate three-letter-codes and short forms from driver names.
 void unregisterListener(ScoringInfo.ScoringInfoUpdateListener l)
           
 void writeToStream(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerListener

public void registerListener(ScoringInfo.ScoringInfoUpdateListener l)

unregisterListener

public void unregisterListener(ScoringInfo.ScoringInfoUpdateListener l)

setThreeLetterCodeGenerator

public void setThreeLetterCodeGenerator(ThreeLetterCodeGenerator tlcGenerator)
Sets the generator to use to generate three-letter-codes and short forms from driver names.

Parameters:
tlcGenerator -

getThreeLetterCodeGenerator

public final ThreeLetterCodeGenerator getThreeLetterCodeGenerator()
Gets the generator to use to generate three-letter-codes and short forms from driver names.

Returns:
the generator to use to generate three-letter-codes and short forms from driver names.

getSessionNanos

public final long getSessionNanos()
Gets the nano seconds, the current session is running.

Returns:
the nano seconds, the current session is running.

getExtrapolationNanos

public final long getExtrapolationNanos()
Returns the nano seconds since the last ScoringInfo update.

Returns:
the nano seconds since the last ScoringInfo update.

getExtrapolationTime

public final float getExtrapolationTime()
Returns the seconds since the last ScoringInfo update.

Returns:
the seconds since the last ScoringInfo update.

isSessionRunning

public final boolean isSessionRunning()
Gets whether a session is currently running or not.

Returns:
whether a session is currently running or not.

getSessionStartTimestamp

public final long getSessionStartTimestamp()
Gets the system timestamp in nanoseconds, at which the current session was started.

Returns:
the system timestamp in nanoseconds, at which the current session was started.

getRealtimeEnteredTimestamp

public final long getRealtimeEnteredTimestamp()
Gets the system timestamp in nanoseconds, at which the player entered realtime mode.

Returns:
the system timestamp in nanoseconds, at which the player entered realtime mode.

getRealtimeEntredId

public final int getRealtimeEntredId()
This ID is incremented each time, the player enters realtime mode.

Returns:
the ID of realtime enter actions.

isUpdatedInTimeScope

public final boolean isUpdatedInTimeScope()
Gets, whether the last update of these data has been done while in running session resp. realtime mode.

Returns:
whether the last update of these data has been done while in running session resp. realtime mode.

isValid

public final boolean isValid()
Gets whether this data has been updated in the current session.

Returns:
whether this data has been updated in the current session.

getUpdateId

public final long getUpdateId()
Gets an ID, that in incremented every time, this ScoringInfo object is filled with new data from the game.

Returns:
an ID, that in incremented every time, this ScoringInfo object is filled with new data from the game.

getSessionId

public final int getSessionId()
This Session ID is incremented every time, a new session is started.

Returns:
a session ID unique for each started session.

readFromStream

public void readFromStream(java.io.InputStream in)
                    throws java.io.IOException
Throws:
java.io.IOException

writeToStream

public void writeToStream(java.io.OutputStream out)
                   throws java.io.IOException
Throws:
java.io.IOException

getRaceLengthPercentage

public final double getRaceLengthPercentage()
Gets a multiplier in range [0, 1] for the race distance.

Returns:
a multiplier in range [0, 1] for the race distance.

getTrackName

public final java.lang.String getTrackName()
Gets the current track name.

Returns:
the current track name.

getSessionType

public final SessionType getSessionType()
Gets current session type.

Returns:
current session type.

getSessionTime

public final float getSessionTime()
Gets current session time.

Returns:
current session time.

getEndTime

public final float getEndTime()
Gets session ending time.

Returns:
session ending time.

getMaxLaps

public final int getMaxLaps()
Gets maximum laps.

Returns:
maximum laps.

getEstimatedMaxLaps

public final int getEstimatedMaxLaps(VehicleScoringInfo vsi)
Gets the estimated max laps based on the session end time and average lap time. If the SessionLimit is defined to be LAPS, then max laps is known and returned. If the current session is a race, the estimated max laps of the leader are returned.

Parameters:
vsi - the vehicle (should be the leader)
Returns:
the estimated max laps.

getTrackLength

public final float getTrackLength()
Gets the distance around track.

Returns:
the distance around track.

getNumVehicles

public final int getNumVehicles()
Gets the current number of vehicles.

Returns:
the current number of vehicles.

getNumVehiclesInSameClass

public final int getNumVehiclesInSameClass(VehicleScoringInfo vsi)
Gets the number of vehicles in the same vehicle class as the given one. This method counts on every call.

Parameters:
vsi - the vehicle
Returns:
the number of vehicles in the same vehicle class as the given one.

getGamePhase

public final GamePhase getGamePhase()
Gets the current game phase.

Returns:
the current game phase.

getYellowFlagState

public final YellowFlagState getYellowFlagState()
Gets the current yellow flag state (applies to full-course only).

Returns:
the current yellow flag state.

getSectorYellowFlag

public final boolean getSectorYellowFlag(int sector)
Gets whether there are any local yellows at the moment in the sector.

Parameters:
sector - the queried sector (1,2,3)
Returns:
whether there are any local yellows at the moment in the sector

getStartLightFrame

public final int getStartLightFrame()
Gets the current start light frame (number depends on track).

Returns:
the current start light frame.

getNumRedLights

public final int getNumRedLights()
Gets the number of red lights in start sequence.

Returns:
the number of red lights in start sequence.

isInRealtimeMode

public final boolean isInRealtimeMode()
Gets whether we're in realtime as opposed to at the monitor.

Returns:
whether we're in realtime as opposed to at the monitor.

getPlayerName

public final java.lang.String getPlayerName()
Gets the player name (including possible multiplayer override).

Returns:
the player name.

getPlayerFilename

public final java.lang.String getPlayerFilename()
Gets the player's filename (PLR) (may be encoded to be a legal filename).

Returns:
the player's filename.

getCloudDarkness

public final float getCloudDarkness()
Gets cloud darkness? 0.0-1.0

Returns:
cloud darkness? 0.0-1.0

getRainingSeverity

public final float getRainingSeverity()
Gets raining severity 0.0-1.0

Returns:
raining severity 0.0-1.0

getAmbientTemperature

public final float getAmbientTemperature()
Gets ambient temperature (Celsius)

Returns:
ambient temperature (Celsius)

getTrackTemperature

public final float getTrackTemperature()
Gets track temperature (Celsius)

Returns:
track temperature (Celsius)

getWindSpeed

public final void getWindSpeed(TelemVect3 speed)
Gets wind speed

Parameters:
speed - output buffer

getOnPathWetness

public final float getOnPathWetness()
Gets wetness on main path 0.0-1.0

Returns:
wetness on main path 0.0-1.0

getOffPathWetness

public final float getOffPathWetness()
Gets wetness off main path 0.0-1.0

Returns:
wetness off main path 0.0-1.0

getVehicleScoringInfo

public final VehicleScoringInfo getVehicleScoringInfo(int i)
Gets the i-th vehicle scoring info.

Parameters:
i - the index
Returns:
the i-th vehicle scoring info.
See Also:
getNumVehicles()

getVehicleScoringInfos

public final int getVehicleScoringInfos(VehicleScoringInfo[] vsis)
Gets all the current VehicleScoringInfos and writes them into the given array.

Parameters:
vsis - the target array (must be of at least getNumVehicles() size.
Returns:
the number of VehicleScoringInfos.

getLeadersVehicleScoringInfo

public final VehicleScoringInfo getLeadersVehicleScoringInfo()
Gets the leader's VehicleScoringInfo. This is equivalent to getVehicleScoringInfo( 0 ).

Returns:
the leader's VehicleScoringInfo.

getPlayersVehicleScoringInfo

public final VehicleScoringInfo getPlayersVehicleScoringInfo()
Gets the player's VehicleScroingInfo.

Returns:
the player's VehicleScroingInfo.
See Also:
getOwnPlace(boolean)

getViewedVehicleScoringInfo

public final VehicleScoringInfo getViewedVehicleScoringInfo()
Gets the viewed's VehicleScroingInfo (this is just a guess, but should be correct).

Returns:
the viewed's VehicleScroingInfo.

getOwnPlace

public final short getOwnPlace(boolean byClass)
Gets the position of the player.

Parameters:
byClass - only consider vehicles in the same class
Returns:
the position of the player.

getFastestSector1VSI

public final VehicleScoringInfo getFastestSector1VSI()
Gets the VehicleScoringInfo for the fastest sector1.

Returns:
the VehicleScoringInfo for the fastest sector1.

getFastestSector2VSI

public final VehicleScoringInfo getFastestSector2VSI()
Gets the VehicleScoringInfo for the fastest sector2.

Returns:
the VehicleScoringInfo for the fastest sector2.

getFastestSector3VSI

public final VehicleScoringInfo getFastestSector3VSI()
Gets the VehicleScoringInfo for the fastest sector3.

Returns:
the VehicleScoringInfo for the fastest sector3.

getFastestSectorVSI

public final VehicleScoringInfo getFastestSectorVSI(int sector)
Gets the VehicleScoringInfo for the fastest sector i.

Parameters:
sector - the queried sector
Returns:
the VehicleScoringInfo for the fastest sector i.

getFastestLapVSI

public final VehicleScoringInfo getFastestLapVSI()
Gets the VehicleScoringInfo for the fastest lap.

Returns:
the VehicleScoringInfo for the fastest lap.

getSecondFastestLapVSI

public final VehicleScoringInfo getSecondFastestLapVSI()
Gets the VehicleScoringInfo for the second fastest lap (or null).

Returns:
the VehicleScoringInfo for the second fastest lap (or null).

getFastestLaptime

public final Laptime getFastestLaptime()
Gets the absolute fastes lap time.

Returns:
the absolute fastest lap time.

getCompareVSI

public final VehicleScoringInfo getCompareVSI()

Gets the VehicleScoringInfo to compare against.

By default this is null, which leads to default behavior. But a plugin can override this.

Returns:
the VehicleScoringInfo to compare laptimes against.