nachos.threads
Class ElevatorController

java.lang.Object
  extended by nachos.threads.ElevatorController
All Implemented Interfaces:
Runnable, ElevatorControllerInterface

public class ElevatorController
extends Object
implements ElevatorControllerInterface

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


Field Summary
 
Fields inherited from interface nachos.machine.ElevatorControllerInterface
dirDown, dirNeither, dirUp, timeDoorsOpen
 
Constructor Summary
ElevatorController()
          Allocate a new elevator controller.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElevatorController

public ElevatorController()
Allocate a new elevator controller.

Method Detail

initialize

public 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.

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

run

public 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
Specified by:
run in interface ElevatorControllerInterface