This commit is contained in:
COLIN Cyril 2019-10-14 14:03:21 +02:00
commit 864419c22e
8 changed files with 42 additions and 13 deletions

View File

@ -1 +0,0 @@
,p16003795,L-662722FORM-16.salsa.univ-amu.fr,14.10.2019 13:17,file:///amuhome/p16003795/.config/libreoffice/4;

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,9 @@
package Requests;
public class CancelEmergencyStopRequest extends Request{
public CancelEmergencyStopRequest() {
super(RequestType.CANCELEMERGENCYSTOP);
}
}

View File

@ -3,7 +3,6 @@ package Requests;
public class EmergencyStopRequest extends Request {
public EmergencyStopRequest() {
super();
this.type = RequestType.EMERGENCYSTOP;
super(RequestType.EMERGENCYSTOP);
}
}

View File

@ -0,0 +1,10 @@
package Requests;
public class ReachedFloorSignal extends Request{
public ReachedFloorSignal(int reachedFLoor) {
super(RequestType.REACHEDFLOORSIGNAL);
this.reachedFloor = reachedFLoor;
}
}

View File

@ -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;
}
}

View File

@ -1,5 +1,5 @@
package Requests;
public enum RequestType {
CALLFROMFLOOR, CALLFROMELEVATOR, EMERGENCYSTOP, CANCELEMERGENCYSTOP
CALLFROMFLOOR, CALLFROMELEVATOR, EMERGENCYSTOP, CANCELEMERGENCYSTOP, REACHEDFLOORSIGNAL
}