net.ctdp.rfdynhud.gamedata
Class VehicleScoringInfo

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

public class VehicleScoringInfo
extends java.lang.Object

Author:
Marvin Froehlich (CTDP)

Nested Class Summary
static class VehicleScoringInfo.VSIPlaceComparator
          Comparator to sort by place.
 
Method Summary
 boolean equals(java.lang.Object o)
          
 Laptime getAverageLaptime()
          Gets the average laptime of the current session.
 float getBestLapTime()
          Gets the best lap time best lap time.
 float getBestSector1()
          Gets the best sector 1 time.
 float getBestSector2(boolean includingSector1)
          Gets the best sector 2 time.
 float getBestSector3()
          Gets the best sector 3 time.
 int getCurrentGear()
          Gets the current gear.
 short getCurrentLap()
          Gets the current lap index (one based).
 float getCurrentLaptime()
          The current laptime (may be incomplete).
 float getCurrentSector1()
          Gets the current sector 1 (if valid).
 float getCurrentSector2(boolean includingSector1)
          Gets current sector 2 time.
 int getDriverId()
          Uniquely identifes this vehicle's driver.
 java.lang.Integer getDriverID()
          Uniquely identifes this vehicle's driver.
 java.lang.String getDriverName()
          Gets the full name of the driver driving this vehicle.
 java.lang.String getDriverName(boolean upperCase)
          Gets the full name of the driver driving this vehicle.
 java.lang.String getDriverNameShort()
          Gets driver name (short form)
 java.lang.String getDriverNameShort(boolean upperCase)
          Gets driver name (short form)
 java.lang.String getDriverNameTLC()
          Gets driver name (three letter code)
 java.lang.String getDriverNameTLC(boolean upperCase)
          Gets driver name (three letter code)
 int getEngineBoostMapping()
          Gets the current engine boost mapping.
 float getEngineMaxRPM()
          Gets the current engine' max RPM.
 float getEngineRPM()
          Gets the current engine RPM.
 int getEstimatedMaxLaps()
          Gets the estimated max laps based on the session end time and average lap time.
 Laptime getFastestLaptime()
          Gets this driver's fastest Laptime.
 FinishStatus getFinishStatus()
          Gets the current finish status.
 float getLapDistance()
          Gets the current distance around track in meters.
 int getLapsBehindLeader(boolean byClass)
          Gets the laps behind leader.
 int getLapsBehindNextInFront(boolean byClass)
          Gets the laps behind vehicle in next higher place.
 short getLapsCompleted()
          Gets the number of laps completed.
 float getLapsRemaining(int maxLaps)
          Gets the number of remaining laps (with fractions).
 float getLapStartTime()
          Gets the time this lap was started at.
 Laptime getLaptime(int lap)
          Gets the Laptime object for the given lap.
 Laptime getLastLaptime()
          Gets the last lap time.
 float getLastLapTime()
          Gets the last lap time.
 float getLastSector1()
          Gets the last sector 1 time.
 float getLastSector2(boolean includingSector1)
          Gets the last sector 2 time.
 float getLastSector3()
          Gets the last sector 3 time.
 VehicleScoringInfo getLeaderByClass()
          Gets the VehicleScoringInfo, that leads the same class.
 void getLocalAcceleration(TelemVect3 localAccel)
          acceleration (meters/sec^2) in local vehicle coordinates
 void getLocalRotation(TelemVect3 localRot)
          rotation (radians/sec) in local vehicle coordinates
 void getLocalRotationalAcceleration(TelemVect3 localRotAccel)
          rotational acceleration (radians/sec^2) in local vehicle coordinates
 void getLocalVelocity(TelemVect3 localVel)
          velocity (meters/sec) in local vehicle coordinates
 VehicleScoringInfo getNextBehind(boolean byClass)
          Gets the VehicleScoringInfo, that is next behind.
 VehicleScoringInfo getNextInFront(boolean byClass)
          Gets the VehicleScoringInfo, that is next in front.
 float getNormalizedLapDistance()
          Gets current distance around track as a fraction [0,1].
 short getNumberOfScheduledPitstops()
          Gets the number of scheduled pitstops (only valid for the player).
 short getNumOutstandingPenalties()
          Gets the number of outstanding penalties.
 short getNumPitstopsMade()
          Gets the number of pitstops made.
 int getNumVehiclesInSameClass()
          Gets the number of vehicles in the same vehicle class.
 Laptime getOldAverageLaptime()
          Gets the average laptime of the current session excluding the last timed lap.
 void getOrientationX(TelemVect3 oriX)
          top row of orientation matrix (also converts local vehicle vectors into world X using dot product)
 void getOrientationY(TelemVect3 oriY)
          mid row of orientation matrix (also converts local vehicle vectors into world Y using dot product)
 void getOrientationZ(TelemVect3 oriZ)
          bot row of orientation matrix (also converts local vehicle vectors into world Z using dot product)
 float getPathLateral()
          Gets lateral position with respect to *very approximate* "center" path.
 short getPlace(boolean byClass)
          1-based position
 float getScalarVelocity()
          Gets velocity in the units selected in the PLR.
 float getScalarVelocityKPH()
          Gets velocity (km/h).
 float getScalarVelocityMPH()
          Gets velocity (mph).
 float getScalarVelocityMPS()
          Gets velocity (meters/sec) in local vehicle coordinates.
 ScoringInfo getScoringInfo()
           
 byte getSector()
          Gets the current sector (1,2,3).
 SessionLimit getSessionLimit()
          Gets the SessionLimit of the current session.
 SessionLimit getSessionLimit(SessionLimit preference)
          Gets the SessionLimit of the current session.
 float getStintLength()
          Gets the current stint length with fractions.
 int getStintStartLap()
          Gets the lap, at which we started the current stint.
 float getTimeBehindLeader(boolean byClass)
          Gets the time behind leader.
 float getTimeBehindNextInFront(boolean byClass)
          Gets the time behind vehicle in next higher place.
 float getTopspeed()
          Gets topspeed in km/h.
 float getTrackEdge()
          Gets track edge (w.r.t.
 java.lang.String getVehicleClass()
          Gets the vehicle class.
 int getVehicleClassId()
          Gets the vehicle class id.
 java.lang.Integer getVehicleClassID()
          Gets the vehicle class id.
 VehicleControl getVehicleControl()
           
 VehicleInfo getVehicleInfo()
           
 java.lang.String getVehicleName()
          Gets the vehicle's name.
 void getWorldPosition(TelemVect3 position)
          Gets world position in meters.
 float getWorldPositionX()
          Gets world position in meters.
 float getWorldPositionY()
          Gets world position in meters.
 float getWorldPositionZ()
          Gets world position in meters.
 int hashCode()
          
 boolean isInPits()
          between pit entrance and pit exit (not always accurate for remote vehicles)
 boolean isLapJustStarted()
          Gets, whether the current lap has just been stared.
 boolean isPlayer()
           
 boolean isValid()
           
 void readFromStream(java.io.InputStream in)
           
 java.lang.String toString()
          
 void writeToStream(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getScoringInfo

public final ScoringInfo getScoringInfo()

isValid

public final boolean isValid()

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

getDriverName

public final java.lang.String getDriverName(boolean upperCase)
Gets the full name of the driver driving this vehicle.

Parameters:
upperCase - whether the name should be in all upper case
Returns:
the full name of the driver driving this vehicle.

getDriverName

public final java.lang.String getDriverName()
Gets the full name of the driver driving this vehicle.

Returns:
the full name of the driver driving this vehicle.

getDriverNameShort

public final java.lang.String getDriverNameShort(boolean upperCase)
Gets driver name (short form)

Parameters:
upperCase - whether the name should be in all upper case
Returns:
driver name (short form)

getDriverNameShort

public final java.lang.String getDriverNameShort()
Gets driver name (short form)

Returns:
driver name (short form)

getDriverNameTLC

public final java.lang.String getDriverNameTLC(boolean upperCase)
Gets driver name (three letter code)

Parameters:
upperCase - whether the name should be in all upper case
Returns:
driver name (three letter code)

getDriverNameTLC

public final java.lang.String getDriverNameTLC()
Gets driver name (three letter code)

Returns:
driver name (three letter code)

getDriverId

public final int getDriverId()
Uniquely identifes this vehicle's driver. It returns the same value as getDriverID(), but as a primitive int.

Returns:
the driver's id.

getDriverID

public final java.lang.Integer getDriverID()
Uniquely identifes this vehicle's driver. It returns the same value as getDriverId(), but as an Integer instance.

Returns:
the driver's id.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

getVehicleName

public final java.lang.String getVehicleName()
Gets the vehicle's name.

Returns:
the vehicle's name.

getVehicleInfo

public final VehicleInfo getVehicleInfo()

getLapsCompleted

public final short getLapsCompleted()
Gets the number of laps completed.

Returns:
the number of laps completed.

getCurrentLap

public final short getCurrentLap()
Gets the current lap index (one based).

Returns:
the current lap index (one based)

isLapJustStarted

public final boolean isLapJustStarted()
Gets, whether the current lap has just been stared. This is true for just one single time at the beginning of the lap.

Returns:
whether the current lap has just been stared

getSessionLimit

public final SessionLimit getSessionLimit(SessionLimit preference)
Gets the SessionLimit of the current session. If the session limit is defined to be LAPS, LAPS is returned. If it is defined to be timed, TIME is returned. Otherwise the method tries to guess the limit based on the average laptime.

Parameters:
preference - if both TIME and LAPS are possible, preference is returned.
Returns:
the SessionLimit.

getSessionLimit

public final SessionLimit getSessionLimit()
Gets the SessionLimit of the current session. If the session limit is defined to be LAPS, LAPS is returned. If it is defined to be timed, TIME is returned. Otherwise the method tries to guess the limit based on the average laptime.

Returns:
the SessionLimit.

getEstimatedMaxLaps

public final int getEstimatedMaxLaps()
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.

Returns:
the estimated max laps.

getLapsRemaining

public final float getLapsRemaining(int maxLaps)
Gets the number of remaining laps (with fractions).

Parameters:
maxLaps - the maximum laps in the race
Returns:
the number of remaining laps.

getSector

public final byte getSector()
Gets the current sector (1,2,3).

Returns:
the current sector.

getFinishStatus

public final FinishStatus getFinishStatus()
Gets the current finish status.

Returns:
the current finish status.

getLapDistance

public final float getLapDistance()
Gets the current distance around track in meters.

Returns:
the current distance around track in meters.

getNormalizedLapDistance

public final float getNormalizedLapDistance()
Gets current distance around track as a fraction [0,1].

Returns:
current distance around track as a fraction [0,1].

getStintStartLap

public final int getStintStartLap()
Gets the lap, at which we started the current stint.

Returns:
the lap, at which we started the current stint.

getStintLength

public final float getStintLength()
Gets the current stint length with fractions.

Returns:
the current stint length with fractions.

getLaptime

public final Laptime getLaptime(int lap)
Gets the Laptime object for the given lap.

Parameters:
lap - the lap
Returns:
the Laptime object for the given lap.

getFastestLaptime

public final Laptime getFastestLaptime()
Gets this driver's fastest Laptime.

Returns:
this driver's fastest Laptime.

getOldAverageLaptime

public final Laptime getOldAverageLaptime()
Gets the average laptime of the current session excluding the last timed lap. Inlaps, outlaps and laps slower than (1.06 * fastest) are ignored.

Returns:
the average laptime or -1.

getAverageLaptime

public final Laptime getAverageLaptime()
Gets the average laptime of the current session. Inlaps, outlaps and laps slower than (1.06 * fastest) are ignored.

Returns:
the average laptime or -1.

getPathLateral

public final float getPathLateral()
Gets lateral position with respect to *very approximate* "center" path.

Returns:
lateral position with respect to *very approximate* "center" path.

getTrackEdge

public final float getTrackEdge()
Gets track edge (w.r.t. "center" path) on same side of track as vehicle.

Returns:
track edge (w.r.t. "center" path) on same side of track as vehicle.

getBestSector1

public final float getBestSector1()
Gets the best sector 1 time. This is not necessarily the sector time of the best lap.

Returns:
the best sector 1 time.

getBestSector2

public final float getBestSector2(boolean includingSector1)
Gets the best sector 2 time. This is not necessarily the sector time of the best lap.

Parameters:
includingSector1 - return sum of sector1 and 2?
Returns:
the best sector 2 time.

getBestLapTime

public final float getBestLapTime()
Gets the best lap time best lap time.

Returns:
the best lap time best lap time.

getBestSector3

public final float getBestSector3()
Gets the best sector 3 time. This is not necessarily the sector time of the best lap.

Returns:
the best sector 3 time.

getLastSector1

public final float getLastSector1()
Gets the last sector 1 time.

Returns:
the last sector 1 time.

getLastSector2

public final float getLastSector2(boolean includingSector1)
Gets the last sector 2 time.

Parameters:
includingSector1 - return sum of sector1 and 2?
Returns:
the last sector 2 time.

getLastLapTime

public final float getLastLapTime()
Gets the last lap time.

Returns:
the last lap time.

getLastLaptime

public final Laptime getLastLaptime()
Gets the last lap time.

Returns:
the last lap time.

getLastSector3

public final float getLastSector3()
Gets the last sector 3 time.

Returns:
the last sector 3 time.

getCurrentSector1

public final float getCurrentSector1()
Gets the current sector 1 (if valid).

Returns:
the current sector 1 (if valid)

getCurrentSector2

public final float getCurrentSector2(boolean includingSector1)
Gets current sector 2 time.

Parameters:
includingSector1 - only affects result if sector1 is valid
Returns:
current sector 2 time.

getCurrentLaptime

public final float getCurrentLaptime()
The current laptime (may be incomplete).

Returns:
current laptime.

getNumPitstopsMade

public final short getNumPitstopsMade()
Gets the number of pitstops made.

Returns:
the number of pitstops made.

getNumberOfScheduledPitstops

public short getNumberOfScheduledPitstops()
Gets the number of scheduled pitstops (only valid for the player).

Returns:
the number of scheduled pitstops.

getNumOutstandingPenalties

public final short getNumOutstandingPenalties()
Gets the number of outstanding penalties.

Returns:
the number of outstanding penalties.

isPlayer

public final boolean isPlayer()
Returns:
is this the player's vehicle?

getVehicleControl

public final VehicleControl getVehicleControl()
Returns:
who's in control?

isInPits

public final boolean isInPits()
between pit entrance and pit exit (not always accurate for remote vehicles)

Returns:
is this vehicle in the pit lane?

getNumVehiclesInSameClass

public final int getNumVehiclesInSameClass()
Gets the number of vehicles in the same vehicle class.

Returns:
the number of vehicles in the same vehicle class.

getPlace

public final short getPlace(boolean byClass)
1-based position

Parameters:
byClass - only consider vehicles in the same class
Returns:
1-based position

getLeaderByClass

public final VehicleScoringInfo getLeaderByClass()
Gets the VehicleScoringInfo, that leads the same class.

Returns:
the VehicleScoringInfo, that leads the same class.

getNextInFront

public final VehicleScoringInfo getNextInFront(boolean byClass)
Gets the VehicleScoringInfo, that is next in front.

Parameters:
byClass - only consider vehicles in the same class
Returns:
the VehicleScoringInfo, that is next in front.

getNextBehind

public final VehicleScoringInfo getNextBehind(boolean byClass)
Gets the VehicleScoringInfo, that is next behind.

Parameters:
byClass - only consider vehicles in the same class
Returns:
the VehicleScoringInfo, that is next behind.

getVehicleClass

public final java.lang.String getVehicleClass()
Gets the vehicle class.

Returns:
the vehicle class.

getVehicleClassId

public final int getVehicleClassId()
Gets the vehicle class id.

Returns:
the vehicle class id.

getVehicleClassID

public final java.lang.Integer getVehicleClassID()
Gets the vehicle class id.

Returns:
the vehicle class id.

getTimeBehindNextInFront

public final float getTimeBehindNextInFront(boolean byClass)
Gets the time behind vehicle in next higher place.

Parameters:
byClass - only consider vehicles in the same class
Returns:
the time behind vehicle in next higher place.

getLapsBehindNextInFront

public final int getLapsBehindNextInFront(boolean byClass)
Gets the laps behind vehicle in next higher place.

Parameters:
byClass - only consider vehicles in the same class
Returns:
the laps behind vehicle in next higher place.

getTimeBehindLeader

public final float getTimeBehindLeader(boolean byClass)
Gets the time behind leader.

Parameters:
byClass - only consider vehicles in the same class
Returns:
the time behind leader.

getLapsBehindLeader

public final int getLapsBehindLeader(boolean byClass)
Gets the laps behind leader.

Parameters:
byClass - only consider vehicles in the same class
Returns:
the laps behind leader.

getLapStartTime

public final float getLapStartTime()
Gets the time this lap was started at.

Returns:
the time this lap was started at.

getWorldPosition

public final void getWorldPosition(TelemVect3 position)
Gets world position in meters.

Parameters:
position - output buffer

getWorldPositionX

public final float getWorldPositionX()
Gets world position in meters.

Returns:
world position in meters.

getWorldPositionY

public final float getWorldPositionY()
Gets world position in meters.

Returns:
world position in meters.

getWorldPositionZ

public final float getWorldPositionZ()
Gets world position in meters.

Returns:
world position in meters.

getEngineRPM

public final float getEngineRPM()
Gets the current engine RPM.
This is only valid, if set by a LiveGameDataController.

Returns:
the current engine RPM or -1, if unknown.

getEngineMaxRPM

public final float getEngineMaxRPM()
Gets the current engine' max RPM.
This is only valid, if set by a LiveGameDataController.

Returns:
the current engine max RPM or -1, if unknown.

getEngineBoostMapping

public final int getEngineBoostMapping()
Gets the current engine boost mapping.
This is only valid, if set by a LiveGameDataController.

Returns:
the current engine boost mapping or -1, if unknown.

getCurrentGear

public final int getCurrentGear()
Gets the current gear.
This is only valid, if set by a LiveGameDataController.

Returns:
the current gear or -1000, if unknown.

getLocalVelocity

public final void getLocalVelocity(TelemVect3 localVel)
velocity (meters/sec) in local vehicle coordinates

Parameters:
localVel - output buffer

getScalarVelocityMPS

public final float getScalarVelocityMPS()
Gets velocity (meters/sec) in local vehicle coordinates.

Returns:
velocity (meters/sec) in local vehicle coordinates.

getScalarVelocityMPH

public final float getScalarVelocityMPH()
Gets velocity (mph).

Returns:
velocity (mph).

getScalarVelocityKPH

public final float getScalarVelocityKPH()
Gets velocity (km/h).

Returns:
velocity (km/h).

getScalarVelocity

public final float getScalarVelocity()
Gets velocity in the units selected in the PLR.

Returns:
velocity in the units selected in the PLR.

getTopspeed

public final float getTopspeed()
Gets topspeed in km/h.

Returns:
topspeed in km/h.

getLocalAcceleration

public final void getLocalAcceleration(TelemVect3 localAccel)
acceleration (meters/sec^2) in local vehicle coordinates

Parameters:
localAccel - output buffer

getOrientationX

public final void getOrientationX(TelemVect3 oriX)
top row of orientation matrix (also converts local vehicle vectors into world X using dot product)

Parameters:
oriX - output buffer

getOrientationY

public final void getOrientationY(TelemVect3 oriY)
mid row of orientation matrix (also converts local vehicle vectors into world Y using dot product)

Parameters:
oriY - output buffer

getOrientationZ

public final void getOrientationZ(TelemVect3 oriZ)
bot row of orientation matrix (also converts local vehicle vectors into world Z using dot product)

Parameters:
oriZ - output buffer

getLocalRotation

public final void getLocalRotation(TelemVect3 localRot)
rotation (radians/sec) in local vehicle coordinates

Parameters:
localRot - output buffer

getLocalRotationalAcceleration

public final void getLocalRotationalAcceleration(TelemVect3 localRotAccel)
rotational acceleration (radians/sec^2) in local vehicle coordinates

Parameters:
localRotAccel - output buffer

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object