légères modif

This commit is contained in:
MathieuPietri 2019-10-16 18:10:29 +02:00
parent ca166b8853
commit 733fd2a75e
2 changed files with 13 additions and 5 deletions

View File

@ -39,8 +39,9 @@ public class BasicInstructionQueue implements InstructionQueue {
* direction the call is directed to.
*/
case CALLFROMFLOOR:
if (currentFloor == event.getIncomingCallFloor())
break;
switch (event.getRequestedDirection()) {
/*
* Adds the instruction to the upQueue then sorts it.
*/
@ -89,7 +90,7 @@ public class BasicInstructionQueue implements InstructionQueue {
emergencyState = false;
break;
/*
* Refreshes the local values of current floor and current direction with the
* Refreshes the local values of current floor and current rrentFloodirection with the
* ones given by the event. These values will
*/
case REACHEDFLOORSIGNAL:
@ -112,7 +113,7 @@ public class BasicInstructionQueue implements InstructionQueue {
public int getNextInstruction() {
int nextFloor = -1;
//System.out.println("" + upQueue + downQueue);
System.out.println("we go " + currentDirection + " current floor: " + currentFloor + " queues: " + upQueue + downQueue);
switch (currentDirection) {
// get the first element of upQueue that is ABOVE the elevator's current floor
@ -127,6 +128,9 @@ public class BasicInstructionQueue implements InstructionQueue {
if (nextFloor < 0 && downQueue.size() > 0) {
nextFloor = downQueue.get(0);
}
if (nextFloor < 0 && upQueue.size() > 0) {
nextFloor = upQueue.get(0);
}
break;
// get the first element of downQueue that is UNDER the elevator's current floor
@ -141,6 +145,9 @@ public class BasicInstructionQueue implements InstructionQueue {
if (nextFloor < 0 && upQueue.size() > 0) {
nextFloor = upQueue.get(0);
}
if (nextFloor < 0 && downQueue.size() > 0) {
nextFloor = downQueue.get(0);
}
break;
default:
break;
@ -173,7 +180,8 @@ public class BasicInstructionQueue implements InstructionQueue {
private void removeInstruction(int floor) {
switch (currentDirection) {
/*
/* current floor: 0 queues: [0, 1, 2, 3][4, 3, 2, 1]
Next instruction: 0
* Elevator is headed upwards.
*/
case UP:

View File

@ -8,7 +8,7 @@ import commandSystem.ElevatorListener;
public class Elevator {
static final int PRECISION = 10;
static final int PRECISION = 100;
private double floorHeight;
private double step;
private double height;