public void setDirectionDisplay(int elevator, int direction) {
	    Lib.assertTrue(elevator >= 0 && elevator < numElevators);
	    elevators[elevator].direction = direction;

	    if (elevators[elevator].doorsOpen) {
		postRiderEvent(RiderEvent.eventDirectionChanged,
			       elevators[elevator].floor, elevator);
	    }

	    if (gui != null) {
		if (elevators[elevator].doorsOpen) {
		    if (direction == dirUp)
			gui.clearUpButton(elevators[elevator].floor);
		    else if (direction == dirDown)
			gui.clearDownButton(elevators[elevator].floor);
		}
	    
		gui.setDirectionDisplay(elevator, direction);
	    }
	}