diff --git a/.~lock.Cahier_des_charges.odt# b/.~lock.Cahier_des_charges.odt# deleted file mode 100644 index 5733deb..0000000 --- a/.~lock.Cahier_des_charges.odt# +++ /dev/null @@ -1 +0,0 @@ -,p16003795,L-662722FORM-16.salsa.univ-amu.fr,14.10.2019 13:17,file:///amuhome/p16003795/.config/libreoffice/4; \ No newline at end of file diff --git a/src/Requests/CallFromElevatorRequest.java b/src/Requests/CallFromElevatorRequest.java index ab3acad..677c543 100644 --- a/src/Requests/CallFromElevatorRequest.java +++ b/src/Requests/CallFromElevatorRequest.java @@ -3,8 +3,7 @@ package Requests; public class CallFromElevatorRequest extends Request { public CallFromElevatorRequest(int wantedFloor) { - super(); + super(RequestType.CALLFROMELEVATOR); this.wantedFloor = wantedFloor; - this.type = RequestType.CALLFROMELEVATOR; } } diff --git a/src/Requests/CallFromFloorRequest.java b/src/Requests/CallFromFloorRequest.java index 317662d..a6c3a93 100644 --- a/src/Requests/CallFromFloorRequest.java +++ b/src/Requests/CallFromFloorRequest.java @@ -6,10 +6,9 @@ public class CallFromFloorRequest extends Request { public CallFromFloorRequest(int sourceFloor, Direction direction) { - super(); + super(RequestType.CALLFROMFLOOR); this.sourceFloor = sourceFloor; this.direction = direction; - this.type = RequestType.CALLFROMFLOOR; } } diff --git a/src/Requests/CancelEmergencyStopRequest.java b/src/Requests/CancelEmergencyStopRequest.java new file mode 100644 index 0000000..02020a1 --- /dev/null +++ b/src/Requests/CancelEmergencyStopRequest.java @@ -0,0 +1,9 @@ +package Requests; + +public class CancelEmergencyStopRequest extends Request{ + + public CancelEmergencyStopRequest() { + super(RequestType.CANCELEMERGENCYSTOP); + } + +} diff --git a/src/Requests/EmergencyStopRequest.java b/src/Requests/EmergencyStopRequest.java index e0552dd..40d4fe8 100644 --- a/src/Requests/EmergencyStopRequest.java +++ b/src/Requests/EmergencyStopRequest.java @@ -3,7 +3,6 @@ package Requests; public class EmergencyStopRequest extends Request { public EmergencyStopRequest() { - super(); - this.type = RequestType.EMERGENCYSTOP; + super(RequestType.EMERGENCYSTOP); } } diff --git a/src/Requests/ReachedFloorSignal.java b/src/Requests/ReachedFloorSignal.java new file mode 100644 index 0000000..e6446d1 --- /dev/null +++ b/src/Requests/ReachedFloorSignal.java @@ -0,0 +1,10 @@ +package Requests; + +public class ReachedFloorSignal extends Request{ + public ReachedFloorSignal(int reachedFLoor) { + super(RequestType.REACHEDFLOORSIGNAL); + this.reachedFloor = reachedFLoor; + } + + +} diff --git a/src/Requests/Request.java b/src/Requests/Request.java index 4624e61..ca7499c 100644 --- a/src/Requests/Request.java +++ b/src/Requests/Request.java @@ -8,8 +8,11 @@ public abstract class Request { protected int wantedFloor; protected int sourceFloor; protected Direction direction; + protected int reachedFloor; - public Request() { + public Request(RequestType type) { + this.type = type; + this.reachedFloor = -1; this.wantedFloor = -1; this.sourceFloor = -1; this.direction = Direction.NONE; @@ -17,7 +20,7 @@ public abstract class Request { /** * - * @return the direction of the request, unconcerned extending classes return NONE + * @return the direction of the request, unconcerned extending classes return NONE. */ public Direction getDirection() { return direction; @@ -25,7 +28,7 @@ public abstract class Request { /** * - * @return the wished floor, unconcerned extending classes return -1 + * @return the wished floor, unconcerned extending classes return -1. */ public int getWantedFloor() { return wantedFloor; @@ -33,14 +36,25 @@ public abstract class Request { /** * - * @return the floor it was called from, unconcerned extending classes return -1 + * @return the floor it was called from, unconcerned extending classes return -1. */ public int getIncomingCallFloor() { return sourceFloor; } - + /** + * + * @return the RequestType of the request. + */ public RequestType getType() { return type; } + + /** + * + * @return the floor the elevator just reached, unconcerned extending classes return -1. + */ + public int getReachedFloor() { + return reachedFloor; + } } diff --git a/src/Requests/RequestType.java b/src/Requests/RequestType.java index 6d4dc8d..f8daaea 100644 --- a/src/Requests/RequestType.java +++ b/src/Requests/RequestType.java @@ -1,5 +1,5 @@ package Requests; public enum RequestType { - CALLFROMFLOOR, CALLFROMELEVATOR, EMERGENCYSTOP, CANCELEMERGENCYSTOP + CALLFROMFLOOR, CALLFROMELEVATOR, EMERGENCYSTOP, CANCELEMERGENCYSTOP, REACHEDFLOORSIGNAL }