ajout de requêtes
This commit is contained in:
parent
483a5a8189
commit
9a9c128f31
@ -1 +0,0 @@
|
||||
,p16003795,L-662722FORM-16.salsa.univ-amu.fr,14.10.2019 13:17,file:///amuhome/p16003795/.config/libreoffice/4;
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
9
src/Requests/CancelEmergencyStopRequest.java
Normal file
9
src/Requests/CancelEmergencyStopRequest.java
Normal file
@ -0,0 +1,9 @@
|
||||
package Requests;
|
||||
|
||||
public class CancelEmergencyStopRequest extends Request{
|
||||
|
||||
public CancelEmergencyStopRequest() {
|
||||
super(RequestType.CANCELEMERGENCYSTOP);
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,6 @@ package Requests;
|
||||
public class EmergencyStopRequest extends Request {
|
||||
|
||||
public EmergencyStopRequest() {
|
||||
super();
|
||||
this.type = RequestType.EMERGENCYSTOP;
|
||||
super(RequestType.EMERGENCYSTOP);
|
||||
}
|
||||
}
|
||||
|
10
src/Requests/ReachedFloorSignal.java
Normal file
10
src/Requests/ReachedFloorSignal.java
Normal file
@ -0,0 +1,10 @@
|
||||
package Requests;
|
||||
|
||||
public class ReachedFloorSignal extends Request{
|
||||
public ReachedFloorSignal(int reachedFLoor) {
|
||||
super(RequestType.REACHEDFLOORSIGNAL);
|
||||
this.reachedFloor = reachedFLoor;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
package Requests;
|
||||
|
||||
public enum RequestType {
|
||||
CALLFROMFLOOR, CALLFROMELEVATOR, EMERGENCYSTOP, CANCELEMERGENCYSTOP
|
||||
CALLFROMFLOOR, CALLFROMELEVATOR, EMERGENCYSTOP, CANCELEMERGENCYSTOP, REACHEDFLOORSIGNAL
|
||||
}
|
||||
|
Reference in New Issue
Block a user