From ab6d34088e9ad5bae6efe3aba88781f1d401228d Mon Sep 17 00:00:00 2001 From: Mur4ik Date: Fri, 15 Sep 2017 23:03:59 +0300 Subject: [PATCH 1/3] make Elevator id public --- .../java1.8_client/client/src/main/java/core/API/Elevator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/java1.8_client/client/src/main/java/core/API/Elevator.java b/clients/java1.8_client/client/src/main/java/core/API/Elevator.java index 2fbb132..70f64be 100644 --- a/clients/java1.8_client/client/src/main/java/core/API/Elevator.java +++ b/clients/java1.8_client/client/src/main/java/core/API/Elevator.java @@ -50,7 +50,7 @@ public List getPassengers() { return this.passengers; } - Integer getId() { + public Integer getId() { return this.id; } From 3fd3c60b3568c9a3c2408aabf3eefd56d88fe391 Mon Sep 17 00:00:00 2001 From: Mur4ik Date: Sat, 16 Sep 2017 14:29:00 +0300 Subject: [PATCH 2/3] add x value to Elevator --- .../client/src/main/java/core/API/Elevator.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clients/java1.8_client/client/src/main/java/core/API/Elevator.java b/clients/java1.8_client/client/src/main/java/core/API/Elevator.java index 70f64be..8eef6df 100644 --- a/clients/java1.8_client/client/src/main/java/core/API/Elevator.java +++ b/clients/java1.8_client/client/src/main/java/core/API/Elevator.java @@ -10,6 +10,7 @@ */ public class Elevator implements MessagesInterface { private Integer id; + private Double x; private Double y; private List passengers; private Integer state; @@ -42,6 +43,10 @@ public String getType() { return this.type; } + public Double getX() { + return this.x; + } + public Double getY() { return this.y; } @@ -60,6 +65,11 @@ public List getMessages(){ public Elevator(JSONObject elevator) { id = (int) (long) elevator.get("id"); + if (elevator.get("x") instanceof Long) { + x = ((Long) elevator.get("x")).doubleValue(); + } else { + x = (double) elevator.get("x"); + } if (elevator.get("y") instanceof Long) { y = ((Long) elevator.get("y")).doubleValue(); } else { From cfd38f67a2f3a305fc96712c22ceae1d1e6b429f Mon Sep 17 00:00:00 2001 From: Mur4ik Date: Sat, 16 Sep 2017 23:01:29 +0300 Subject: [PATCH 3/3] add elevator getter to Passenger --- .../client/src/main/java/core/API/Passenger.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clients/java1.8_client/client/src/main/java/core/API/Passenger.java b/clients/java1.8_client/client/src/main/java/core/API/Passenger.java index e9d9577..ca7d0d9 100644 --- a/clients/java1.8_client/client/src/main/java/core/API/Passenger.java +++ b/clients/java1.8_client/client/src/main/java/core/API/Passenger.java @@ -25,6 +25,10 @@ public Boolean hasElevator() { return this.elevator != null; } + public Integer getElevator() { + return this.elevator; + } + public List getMessages() { return this.messages; } @@ -80,6 +84,7 @@ public Passenger(JSONObject passenger) { y = (double) passenger.get("y"); } } + public void setElevator(Elevator elevator) { this.elevator = elevator.getId(); JSONObject jo = new JSONObject(); @@ -90,5 +95,4 @@ public void setElevator(Elevator elevator) { jo.put("args", args); this.messages.add(jo); } - }