public class Gauge
extends java.lang.Object
Current = (real-time, pit stall) Next = (fixed, real-time, pit stall) Historical = The value of Current stored by lap when measured in the pit stall.A Change Flag to indicate you want to apply the Next value at the next valid change point (real-time,pit stall). Changing the Next value will automatically set the Dirty Flag and the Change Flag if not equal Current.
It will have Capacity Minimum,Maximum and Increment values that will constrain what you can change the Next value to. It will have Minimum and Maximum values that a gauge would display. It will have Major and Minor Increments that can be used by a gauge for display.
A gauge doesn't have to be on the car, it could be in the pits (such as a tire pressure or temperature gauge). A gauge could represent an object that gets replaced when pitting or when reset that may not output a value (such as the wind-shield tear-off).
A gauge can have several attributes to allow clients to build adaptable software representations of a gauge. It has min and max values on the gauge. It has min and max values(capacity) that it can have. It has an increment that all values will be rounded to when changing it.
A gauge can also have "State", which is defined range(s) of values.
Standard States are "NOTAVAILABLE", "OFF", "ERROR" and "NORMAL".
Clients can choose to display different colors, blink, or other visual effects based on the state.
Many gauges also have additional states.
See Gauge.Type
for each gauges documentation for the states it supports.
Modifier and Type | Class and Description |
---|---|
static class |
Gauge.Type
This defines all the possible gauge types.
|
Constructor and Description |
---|
Gauge(java.lang.String type,
Car car,
Track track,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>> simGaugesBefore,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>> simGaugesAfter)
Constructor for the Gauge class.
|
Modifier and Type | Method and Description |
---|---|
void |
_addStateRange(Gauge gauge)
Adds all the states from the passed in gauge to this gauge.
|
void |
_addStateRange(java.lang.String stateName,
java.lang.String name,
double start,
double end,
java.lang.String UOM) |
void |
_addStateRange(java.lang.String stateName,
java.lang.String name,
double start,
double end,
java.lang.String UOM,
Data d) |
void |
_removeStateRange(java.lang.String stateName,
java.lang.String name) |
Data |
_setCapacityIncrement(double d,
java.lang.String uom) |
Data |
_setCapacityMaximum(double d,
java.lang.String uom) |
Data |
_setCapacityMinimum(double d,
java.lang.String uom) |
Data |
_setIsChangable(boolean b) |
Data |
_setIsDirty(boolean b) |
Data |
_setIsFixed(boolean b) |
Data |
_setMajorIncrement(double d,
java.lang.String uom) |
Data |
_setMaximum(double d,
java.lang.String uom) |
Data |
_setMinimum(double d,
java.lang.String uom) |
Data |
_setMinorIncrement(double d,
java.lang.String uom) |
Data |
_setOnResetChange(boolean b) |
Data |
decrementValueNext() |
Data |
decrementValueNext(java.lang.String UOM)
Decrements the next value, to be applied at the next pit stop, according to the value set by
_setCapacityIncrement(double,String) . |
Data |
getCapacityIncrement() |
Data |
getCapacityIncrement(java.lang.String UOM)
Returns the increment value that the gauge uses when you call
incrementValueNext(String)
or decrementValueNext(String) . |
Data |
getCapacityMaximum() |
Data |
getCapacityMaximum(java.lang.String UOM)
Returns the maximum number that this gauge will accept when calling
setValueNext(double,String)
or incrementValueNext(String) |
Data |
getCapacityMaximumRaw() |
Data |
getCapacityMinimum() |
Data |
getCapacityMinimum(java.lang.String UOM)
Returns the minimum number that this gauge will accept when calling
setValueNext(double,String)
or decrementValueNext(String) |
Data |
getCapacityMinimumRaw() |
Data |
getChangeFlag()
Returns Y if the object for this gauge is flagged for changed on the next pit stop.
|
Data |
getCount()
Returns the number of times this gauge was used.
|
Data |
getIsChangeable()
Returns true if this gauge represents an object that can be replaced/changed at the next pit stop (i.e.
|
Data |
getIsDirty()
Returns Y if the next value of the gauge is different from the current value.
|
Data |
getIsFixed()
Returns false if this gauge's next value can be changed via
setValueNext(double,String) ,
incrementValueNext(String) or decrementValueNext(String) . |
Data |
getLapChanged()
Returns the lap when the object for this gauge was changed.
|
Data |
getLaps() |
Data |
getLaps(int currentLap)
Returns the number of laps since the object for this gauge was changed.
|
Data |
getLaps(java.lang.String currentLap) |
Data |
getLapsHistorical()
Returns the number of laps since the last change.
|
Data |
getMajorIncrement() |
Data |
getMajorIncrement(java.lang.String UOM)
Returns how often to show major tick marks between the minimum and the maximum.
|
Data |
getMaxCount()
Returns the number of times this gauge can be changed.
|
Data |
getMaximum() |
Data |
getMaximum(java.lang.String UOM)
Returns the maximum value of where this gauge should end with the last tick mark (i.e.
|
Data |
getMinimum() |
Data |
getMinimum(java.lang.String UOM)
Returns the minimum value of where this gauge should start with the first tick mark (i.e.
|
Data |
getMinorIncrement() |
Data |
getMinorIncrement(java.lang.String UOM)
Returns how often to show minor tick marks between the minimum and the maximum.
|
Data |
getMultiplier()
Return a multiplier to be used when calculating the major and minor tick marks.
|
Data |
getName()
Returns the untranslated name to display on the gauge.
|
Data |
getOnResetChange()
Returns true if this gauge is changed on a reset.
|
Data |
getType()
Returns the type of gauge as defined by
Gauge.Type |
Data |
getTypeName()
Returns farther explanation of the gauge (i.e.
|
Data |
getUOM()
Returns the Unit of Measure for this gauge (i.e.
|
Data |
getValue() |
Data |
getValue(double value,
java.lang.String UOM,
java.lang.String gear,
java.lang.String enginePower)
Returns the value passed in.
|
Data |
getValue(java.lang.String value) |
Data |
getValue(java.lang.String value,
java.lang.String UOM) |
Data |
getValue(java.lang.String value,
java.lang.String UOM,
java.lang.String gear) |
Data |
getValue(java.lang.String value,
java.lang.String UOM,
java.lang.String gear,
java.lang.String enginePower) |
Data |
getValueCurrent() |
Data |
getValueCurrent(java.lang.String UOM)
Returns the current value of the gauge.
|
Data |
getValueHistorical() |
Data |
getValueHistorical(java.lang.String UOM)
Returns the historical value of the gauge taken at the time it was changed.
|
Data |
getValueNext() |
Data |
getValueNext(java.lang.String UOM)
Returns the value of the next value that the object will be at the next pit stop.
|
Data |
incrementValueNext() |
Data |
incrementValueNext(java.lang.String UOM)
Increments the next value, to be applied at the next pit stop, according to the value set by
_setCapacityIncrement(double,String) . |
Data |
setChangeFlag(boolean flag)
Sets the change flag for this gauge and all the gauges grouped with it.
|
Data |
setChangeFlag(java.lang.String flag) |
Data |
setValueNext() |
Data |
setValueNext(double value,
java.lang.String UOM)
Sets the next value to be applied at the next pit stop.
|
Data |
setValueNext(java.lang.String value) |
Data |
setValueNext(java.lang.String value,
java.lang.String UOM) |
java.lang.String |
toString() |
public Gauge(java.lang.String type, Car car, Track track, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>> simGaugesBefore, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>> simGaugesAfter)
type
- The type of gauge as defined by Gauge.Type
car
- The car to associate this gauge with.track
- The track the car will be running on.simGaugesBefore
- A map that contains gauge data from the SIM to be applied first. The files can then override those values if needed.simGaugesAfter
- A map that contains gauge data from the SIM to be applied after the files are processed to override any values in them.public Data getType()
Gauge.Type
public Data getName()
public Data getTypeName()
public Data getUOM()
public Data getMultiplier()
public Data getMinimum(java.lang.String UOM)
UOM
- (Optional) The UOM to convert the value to, defaults to the gauge's UOM.public Data getMinimum()
public Data getMaximum(java.lang.String UOM)
UOM
- (Optional) The UOM to convert the value to, defaults to the gauge's UOM.public Data getMaximum()
public Data getMajorIncrement(java.lang.String UOM)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/MajorIncrement/(UOM)
UOM
- (Optional) The UOM to convert the value to, defaults to the gauge's UOM.public Data getMajorIncrement()
public Data getMinorIncrement(java.lang.String UOM)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/MinorIncrement/(UOM)
UOM
- (Optional) The UOM to convert the value to, defaults to the gauge's UOM.public Data getMinorIncrement()
public Data getCapacityMaximum(java.lang.String UOM)
setValueNext(double,String)
or incrementValueNext(String)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/CapacityMaximum/(UOM)
UOM
- (Optional) The UOM to convert the value to, defaults to the gauge's UOM.public Data getCapacityMaximum()
public Data getCapacityMaximumRaw()
public Data getCapacityMinimum(java.lang.String UOM)
setValueNext(double,String)
or decrementValueNext(String)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/CapacityMinimum/(UOM)
UOM
- (Optional) The UOM to convert the value to, defaults to the gauge's UOM.public Data getCapacityMinimum()
public Data getCapacityMinimumRaw()
public Data getCapacityIncrement(java.lang.String UOM)
incrementValueNext(String)
or decrementValueNext(String)
.
Also, all values passed to setValueNext(double,String)
are rounded up to the the
closest multiple of this value.
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/CapacityIncrement/(UOM)
UOM
- (Optional) The UOM to convert the value to, defaults to the gauge's UOM.public Data getCapacityIncrement()
public Data getIsFixed()
setValueNext(double,String)
,
incrementValueNext(String)
or decrementValueNext(String)
.
A client could use this value to grey out or hide the buttons for changing it.
public Data getIsChangeable()
public Data getOnResetChange()
public Data getIsDirty()
public Data getValue(double value, java.lang.String UOM, java.lang.String gear, java.lang.String enginePower)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/Value/(VALUE)/(UOM)/(GEAR)/(ENGINEPOWER)
1.22
enginePower
- (Optional) The engine power to usegear
- (Optional) The gear to useUOM
- (Optional) The unit of measure to return, default to the gauges UOM.value
- (Optional) The value to return. Defaults to the Capacity Minimumpublic Data getValue(java.lang.String value, java.lang.String UOM, java.lang.String gear, java.lang.String enginePower)
public Data getValue(java.lang.String value, java.lang.String UOM, java.lang.String gear)
public Data getValue(java.lang.String value, java.lang.String UOM)
public Data getValue(java.lang.String value)
public Data getValue()
public Data getValueCurrent(java.lang.String UOM)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/ValueCurrent/(UOM)
UOM
- (Optional) The unit of measure to return, default to the gauges UOM.public Data getValueCurrent()
public Data getLapChanged()
public Data getCount()
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/Count
1.2
public Data getMaxCount()
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/MaxCount
1.13
public Data getLaps(int currentLap)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/Laps/(CURRENTLAP)
currentLap
- (Optional) The lap you are currently on, defaults to current lap.public Data getLaps(java.lang.String currentLap)
public Data getLaps()
public Data getValueHistorical(java.lang.String UOM)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/ValueHistorical/(UOM)
UOM
- (Optional) The unit of measure to return it in, defaults to the gauges UOM.public Data getValueHistorical()
public Data getLapsHistorical()
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/LapsHistorical
public Data getValueNext(java.lang.String UOM)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/ValueNext/(UOM)
UOM
- The unit of value to return.public Data getValueNext()
public Data getChangeFlag()
public Data setChangeFlag(boolean flag)
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/setChangeFlag/(FLAG)
flag
- Y or N to change or not to changepublic Data setChangeFlag(java.lang.String flag)
public Data decrementValueNext(java.lang.String UOM)
_setCapacityIncrement(double,String)
.
If the gauge is fixed, then only the change flag will be set and the next value will not be changed.
The change flag is set to Y even if the new value and the old value are the same.
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/decrementValueNext/(UOM)
UOM
- (Optional) The unit of measure to return the new value in. Default gauge's UOM.public Data decrementValueNext()
public Data incrementValueNext(java.lang.String UOM)
_setCapacityIncrement(double,String)
.
If the gauge is fixed, then only the change flag will be set and the next value will not be changed.
If increments above the maximum capacity, then it sets it to the maximum capacity.
The change flag is set to Y even if the new value and the old value are the same.
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/incrementValueNext/(UOM)
UOM
- (Optional) The unit of measure to return the new value in. Default to gauge's UOM.public Data incrementValueNext()
public Data setValueNext(double value, java.lang.String UOM)
_setCapacityIncrement(double,String)
.
The change flag is set to Y even if the new value and the old value are the same.
PATH = /Car/(CARIDENTIFIER)/Gauge/(GAUGETYPE)/setValueNext/(VALUE)/(UOM)
value
- (Optional) The value to be set. Default 0.UOM
- (Optional) The unit of measure the new measure to be set is in. Also affects return value. Default to gauge's UOM.public Data setValueNext(java.lang.String value, java.lang.String UOM)
public Data setValueNext(java.lang.String value)
public Data setValueNext()
public void _addStateRange(Gauge gauge)
gauge
- The gauge to copy the states frompublic void _addStateRange(java.lang.String stateName, java.lang.String name, double start, double end, java.lang.String UOM)
public void _addStateRange(java.lang.String stateName, java.lang.String name, double start, double end, java.lang.String UOM, Data d)
public void _removeStateRange(java.lang.String stateName, java.lang.String name)
public Data _setMinimum(double d, java.lang.String uom)
public Data _setMaximum(double d, java.lang.String uom)
public Data _setMajorIncrement(double d, java.lang.String uom)
public Data _setMinorIncrement(double d, java.lang.String uom)
public Data _setCapacityMinimum(double d, java.lang.String uom)
public Data _setCapacityMaximum(double d, java.lang.String uom)
public Data _setCapacityIncrement(double d, java.lang.String uom)
public Data _setIsFixed(boolean b)
public Data _setIsChangable(boolean b)
public Data _setIsDirty(boolean b)
public Data _setOnResetChange(boolean b)
public java.lang.String toString()
toString
in class java.lang.Object