|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.realtime.test.airplane.Airplane
Class modeling the airplane -- a central part of the embedding code for this example
Field Summary | |
protected Normal |
gearChangeDelay
Pseudo random normal number generator, used for landing gear change delays. |
AbsoluteTime |
lastSpeedChange
Time at which speed was last set. |
boolean |
localizerAlive
True iff the localizer alive event has happened. |
boolean |
onGround
True iff the airplane is on the ground. |
boolean |
spoilersArmed
True iff spoilers are armed. |
Constructor Summary | |
Airplane(int altitude)
Constructor |
Method Summary | |
void |
changeFlaps(int newDegrees,
AsyncEvent lightIndicator)
Change the current flaps setting. |
void |
changeGear(AsyncEvent gearIndicator)
Invert state of landing gear, i.e., from up to down, or vice-versa. |
int |
feetCovered(RelativeTime interval)
Feet covered at current speed for given time interval |
java.lang.String |
gearString(boolean invert)
Create a string conveying the status of the landing gear. |
int |
getFlapsDegrees()
Return the current flaps setting in degrees |
boolean |
getGearDown()
Return the state of the landing gear; true iff gear is down. |
long |
millisToCoverFeetAtCurrentSpeed(int feet)
Calculate the time to cover a specified distance at the current speed. |
void |
printTimeDistanceAndAltitude()
Prints prefix to log lines, including simulated time, distance to runway, and current altitude. |
int |
readAltitude()
Read the airplane's current altitude. |
int |
readFeetToRunway()
Make a dynamic calculation of the current feet to the runway. |
void |
setAltitude(int altitude)
Set the airplane's current altitude, at level flight. |
void |
setAltitudePlan(int plannedAltitude,
AbsoluteTime plannedAltitudeTime)
Set the airplane's current altitude plan, i.e., to ascend or descend |
void |
setFeetToRunway(int feet)
Sets the current feet to runway. |
void |
setFlaps(int degrees)
Set flaps degrees directly, without simulating delay. |
void |
setGearDown(boolean gearDown)
Set the state of the landing gear, without simulating delay. |
void |
setSpeed(int feetPerSecond)
Set the current ground speed of the airplane. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public AbsoluteTime lastSpeedChange
null
.
protected Normal gearChangeDelay
public boolean spoilersArmed
public boolean localizerAlive
public boolean onGround
false
.
Constructor Detail |
public Airplane(int altitude)
altitude
- current altitude of the airplaneMethod Detail |
public void setAltitudePlan(int plannedAltitude, AbsoluteTime plannedAltitudeTime)
plannedAltitude
- the target altitudeplannedAltitudeTime
- the time at which the target altitude will be reachedpublic void setAltitude(int altitude)
altitude
- the current altitudepublic int readAltitude()
public int getFlapsDegrees()
public void changeFlaps(int newDegrees, AsyncEvent lightIndicator) throws java.lang.InterruptedException
RealtimeThread
, because
actuation is not instantaneous.
newDegrees
- the desired new flaps settinglightIndicator
- an event to fire when the flaps attain the desired setting; if
null
, simply return after the delay
java.lang.InterruptedException
public void changeGear(AsyncEvent gearIndicator) throws java.lang.InterruptedException
Note this will require a delay, which figures significantly in the accident scenario.
gearIndicator
- an event to fire when gear change and door retraction
are completed; if
null
, simply return after the delay.
java.lang.InterruptedException
public void setFlaps(int degrees)
degrees
- the current flaps degreespublic boolean getGearDown()
true
iff gear is down.
public void setGearDown(boolean gearDown)
gearDown
- public java.lang.String gearString(boolean invert)
invert
- if true
, invert the state for reporting. This is
handy for printing state requested before it is attained.
up
or down
public void printTimeDistanceAndAltitude()
public void setFeetToRunway(int feet)
feet
- the current feet to the runway.public int readFeetToRunway()
public void setSpeed(int feetPerSecond)
feetPerSecond
- the new speed in feet per secondpublic long millisToCoverFeetAtCurrentSpeed(int feet)
feet
- the specified distance in feet
public int feetCovered(RelativeTime interval)
interval
- the time interval
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |