public class GearBox
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Logger |
logger
message logger for this class
|
| Constructor and Description |
|---|
GearBox(int numForwardGears,
int numReverseGears)
Instantiate a GearBox with the specified numbers of gears.
|
| Modifier and Type | Method and Description |
|---|---|
int |
countForwardGears()
Count the forward gears.
|
int |
countReverseGears()
Count the reverse gears.
|
void |
engageGearNum(int gearNum)
Alter which gear is engaged.
|
Gear |
getEngagedGear()
Access the Gear that's currently engaged.
|
int |
getEngagedGearNum()
Determine which Gear is currently engaged.
|
Gear |
getGear(int gearNum)
Access a gear by number.
|
boolean |
isInReverse()
Test whether this GearBox is in reverse.
|
java.util.List<java.lang.String> |
listAutomaticModes()
Enumerate all available modes of the automatic transmission.
|
float |
maxForwardSpeed(SpeedUnit speedUnit)
Determine the maximum forward speed.
|
float |
maxReverseSpeed(SpeedUnit speedUnit)
Determine the maximum reverse speed.
|
void |
setReversing(boolean reverse)
Convenience method to switch between forward and reverse.
|
public static final java.util.logging.Logger logger
public GearBox(int numForwardGears,
int numReverseGears)
numForwardGears - the number of forward gears (≥1)numReverseGears - the number of reverse gears (≥0, typically 1)public int countForwardGears()
public int countReverseGears()
public void engageGearNum(int gearNum)
gearNum - the number of the desired gearpublic Gear getEngagedGear()
public int getEngagedGearNum()
public Gear getGear(int gearNum)
gearNum - the number of the gearpublic boolean isInReverse()
public java.util.List<java.lang.String> listAutomaticModes()
public float maxForwardSpeed(SpeedUnit speedUnit)
speedUnit - (not null)public float maxReverseSpeed(SpeedUnit speedUnit)
speedUnit - (not null)public void setReversing(boolean reverse)
reverse - true for reverse, false for forward