nachos.machine
Interface ElevatorControllerInterface

All Superinterfaces:
Runnable
All Known Implementing Classes:
ElevatorController

public interface ElevatorControllerInterface
extends Runnable

A controller for all the elevators in an elevator bank. The controller accesses the elevator bank through an instance of ElevatorControls.


Field Summary
static int dirDown
          Indicates an elevator intends to move down.
static int dirNeither
          Indicates an elevator intends not to move.
static int dirUp
          Indicates an elevator intends to move up.
static int timeDoorsOpen
          The number of ticks doors should be held open before closing them.
 
Method Summary
 void initialize(ElevatorControls controls)
          Initialize this elevator controller.
 void run()
          Cause the controller to use the provided controls to receive and process requests from riders.
 

Field Detail

timeDoorsOpen

static final int timeDoorsOpen
The number of ticks doors should be held open before closing them.

See Also:
Constant Field Values

dirDown

static final int dirDown
Indicates an elevator intends to move down.

See Also:
Constant Field Values

dirNeither

static final int dirNeither
Indicates an elevator intends not to move.

See Also:
Constant Field Values

dirUp

static final int dirUp
Indicates an elevator intends to move up.

See Also:
Constant Field Values
Method Detail

initialize

void initialize(ElevatorControls controls)
Initialize this elevator controller. The controller will access the elevator bank through controls. This constructor should return immediately after this controller is initialized, but not until the interupt handler is set. The controller will start receiving events after this method returns, but potentially before run() is called.

Parameters:
controls - the controller's interface to the elevator bank. The controller must not attempt to access the elevator bank in any other way.

run

void run()
Cause the controller to use the provided controls to receive and process requests from riders. This method should not return, but instead should call controls.finish() when the controller is finished.

Specified by:
run in interface Runnable