-
Notifications
You must be signed in to change notification settings - Fork 2
/
ElevatorCar.java
101 lines (79 loc) · 2.25 KB
/
ElevatorCar.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package Undergraduate_Project;
import Undergraduate_Project.Door;
import Undergraduate_Project.Display;
//import Undergraduate_Project.ElevatorCarPiston;
import Undergraduate_Project.ElevatorCarPanel;
public class ElevatorCar {
// private Door floorDoor;
private Door elevatorDoor;
private Display elevatorDisplay;
//private ElevatorCarPiston elevatorPiston;
private ElevatorCarPanel elevatorCarPanel;
private int currentFloor;
private int destinationFloor;
public static final int MOVING_UP = 1;
public static final int NO_DIRECTION = 0;
public static final int MOVING_DOWN = -1;
public static final int MOVING = 1;
public static final int STOPPED = 0;
public static boolean EMERGENCY_MODE = false;
public static boolean MAINTENANCE_MODE = false;
public static boolean PERSON_MODE = true;
public static final int MAX_LOAD = 3500;
// Default constructor
ElevatorCar() {
// floorDoor = new Door();
elevatorDoor = new Door();
elevatorDisplay = new Display();
//elevatorPiston = new ElevatorCarPiston();
elevatorCarPanel = new ElevatorCarPanel();
currentFloor = 1;
}
// Accessors
// public Door getFloorDoor() {
// return floorDoor;
// }
public Door getElevatorDoor() {
return elevatorDoor;
}
public void openElevatorDoor()throws InterruptedException{
elevatorDoor.setDoorOpen(true);
}
public void closeElevatorDoor()throws InterruptedException{
elevatorDoor.setDoorOpen(false);
}
public Display getElevatorDisplay() {
return elevatorDisplay;
}
/*public ElevatorCarPiston getElevatorCarPiston() {
return elevatorPiston;
}*/
public ElevatorCarPanel getElevatorCarPanel() {
return elevatorCarPanel;
}
public int currentFloor() {
return currentFloor;
}
public int getDestinationFloor() {
return destinationFloor;
}
public int getPanelCall(){
return elevatorCarPanel.getNextFloor();
}
// Mutators
public static void setEmergencyMode(Boolean state){
EMERGENCY_MODE = state;
}
public static void setMaintenanceMode(Boolean state) {
MAINTENANCE_MODE = state;
}
public static void setPersonMode(Boolean state) {
PERSON_MODE = state;
}
public void setDetinationFloor(int n) {
destinationFloor = n;
}
// private int doorState;
// private int motionState;
// private int motionDirection;
}