// ELEVATOR EMERGENCIES public void elevatorEmerg(int id) { try { safety.passengerEmergencyRequest(id); } catch (BossLiftGeneralException e) { displayError(e.getCause() + "\n" + e.getMessage()); } }
/* * focusViewOnElevator(int id) * * Informs the ElevatorSimView class which elevator to focus the view on. */ public void focusViewOnElevator(int id) { try { view.focusViewOnElevator(id); } catch (BossLiftGeneralException e) { displayError(e.getMessage()); } }
public void createPassenger(int arrivalFloor, int destFloor, Boolean vip) { try { Passenger p = new Passenger(arrivalFloor, destFloor, 100, vip); controller.newPassengerRequest(p); } catch (BossLiftGeneralException e) { displayError(e.getMessage()); } }
public void createWorld( int numElevators, int numFloors, Boolean penthouse, Vector<Integer>[] bounds) { if (simStarted) destroyWorld(); try { controller.setFloors(numFloors); controller.createElevators(numElevators); if (penthouse) controller.addPenthouse(); for (int e = 0; e < bounds.length; e++) { for (int f = 0; f < bounds[e].size(); f++) controller.lockFloor(e, bounds[e].get(f)); } view.createWorld(numElevators, numFloors, penthouse, bounds); controller.setSimView(this, view); controller.start(); safety.start(); randomEventGen.start(); postGeneralEventMsg("Welcome to BOSS LIFT Elevator Simulator!"); postGeneralEventMsg("The simulation is PAUSED"); simStatusLabel.setText("PAUSED"); simStatusLabel.setForeground(new java.awt.Color(255, 0, 0)); elevatorTabs = new ElevatorInfoPanel[numElevators]; for (int i = 0; i < numElevators; i++) { elevatorTabs[i] = new ElevatorInfoPanel(); if (bounds[i].size() > 0) elevatorTabs[i].setElevatorBounds(controller.getElevatorBounds(i)); JScrollPane p = new JScrollPane(); p.setViewportView(elevatorTabs[i]); ElevatorPane.addTab("E" + i, p); } setGUIEnabled(true); populateElevatorMenus(numElevators); for (int i = 0; i < numFloors; i++) { floorDropDownList.addItem(i); } simStarted = true; controller.setAlgorithm(AlgorithmDropList.getSelectedIndex()); } catch (BossLiftGeneralException e1) { displayError(e1.getMessage()); } }