|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nachos.threads.Rider
public class Rider
A single rider. Each rider accesses the elevator bank through an instance of RiderControls.
Field Summary |
---|
Fields inherited from interface nachos.machine.RiderInterface |
---|
dirDown, dirNeither, dirUp |
Constructor Summary | |
---|---|
Rider()
Allocate a new rider. |
Method Summary | |
---|---|
void |
initialize(RiderControls controls,
int[] stops)
Initialize this rider. |
void |
run()
Cause the rider to use the provided controls to make the stops specified in the constructor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Rider()
Method Detail |
---|
public void initialize(RiderControls controls, int[] stops)
initialize
in interface RiderInterface
controls
- the rider's interface to the elevator bank. The
rider must not attempt to access the elevator
bank in any other way.stops
- an array of stops the rider should make; see
below.public void run()
For example, suppose the rider uses controls to determine that it is initially on floor 1, and suppose the stops array contains two elements: { 0, 2 }. Then the rider should get on an elevator, get off on floor 0, get on an elevator, and get off on floor 2, pushing buttons as necessary.
This method should not return, but instead should call controls.finish() when the rider is finished.
run
in interface Runnable
run
in interface RiderInterface
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |