-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElevatorDemo.java
More file actions
19 lines (19 loc) · 1.17 KB
/
ElevatorDemo.java
File metadata and controls
19 lines (19 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class ElevatorDemo {
public static void main(String[] args) {
ElevatorSystem elevatorSystem=ElevatorSystem.getInstance();
elevatorSystem.initializeTheElevators(10,2);
ElevatorManager elevatorManager=ElevatorManager.getElevatorManagerInstance();
elevatorSystem.sendExteralRequest(new ExternalRequest(5,ElevatorDirection.UP));
elevatorSystem.sendExteralRequest(new ExternalRequest(2,ElevatorDirection.UP));
elevatorSystem.sendInternalRequest(new InternalRequest(1,4));
elevatorSystem.sendInternalRequest(new InternalRequest(2,7));
elevatorSystem.sendInternalRequest(new InternalRequest(1,5));
for(int counter=0;counter<5;counter++){
System.out.println("----------------------------------------------------------");
elevatorSystem.processRequest();
}
elevatorSystem.sendExteralRequest(new ExternalRequest(5,ElevatorDirection.UP)); // Moving from same floor to same floor
elevatorSystem.sendInternalRequest(new InternalRequest(1,-1)); // Moving to Negative floor
elevatorSystem.sendInternalRequest(new InternalRequest(1,20)); // Moving to Higher Positive floor
}
}