From 80e17ab1df5cffff952e78b157a5eb7ae3ec31e1 Mon Sep 17 00:00:00 2001 From: FurWaz <fur.waz06@gmail.com> Date: Sun, 16 Oct 2022 21:01:08 +0200 Subject: [PATCH] Added new required data structures --- .../src/main/java/Structures/MeteoInfo.java | 41 ++++++++++++++++ .../src/main/java/Structures/PathDoor.java | 11 +++++ .../src/main/java/Structures/PathInfo.java | 44 +++++++++++++++++ .../src/main/java/Structures/PathStairs.java | 26 ++++++++++ .../src/main/java/Structures/PathView.java | 49 +++++++++++++++++++ 5 files changed, 171 insertions(+) create mode 100644 Sources/app/src/main/java/Structures/MeteoInfo.java create mode 100644 Sources/app/src/main/java/Structures/PathDoor.java create mode 100644 Sources/app/src/main/java/Structures/PathInfo.java create mode 100644 Sources/app/src/main/java/Structures/PathStairs.java create mode 100644 Sources/app/src/main/java/Structures/PathView.java diff --git a/Sources/app/src/main/java/Structures/MeteoInfo.java b/Sources/app/src/main/java/Structures/MeteoInfo.java new file mode 100644 index 0000000..4b3b76b --- /dev/null +++ b/Sources/app/src/main/java/Structures/MeteoInfo.java @@ -0,0 +1,41 @@ +package Structures; + +public class MeteoInfo { + float temperature = 0f; + float humidity = 0f; + float pressure = 1000f; + + public MeteoInfo() { + + } + + public MeteoInfo(float temp, float humi, float pres) { + this.temperature = temp; + this.humidity = humi; + this.pressure = pres; + } + + public float getTemperature() { + return temperature; + } + + public float getHumidity() { + return humidity; + } + + public float getPressure() { + return pressure; + } + + public void setTemperature(float temperature) { + this.temperature = temperature; + } + + public void setHumidity(float humidity) { + this.humidity = humidity; + } + + public void setPressure(float pressure) { + this.pressure = pressure; + } +} diff --git a/Sources/app/src/main/java/Structures/PathDoor.java b/Sources/app/src/main/java/Structures/PathDoor.java new file mode 100644 index 0000000..da6de88 --- /dev/null +++ b/Sources/app/src/main/java/Structures/PathDoor.java @@ -0,0 +1,11 @@ +package Structures; + +public class PathDoor extends PathInfo { + public PathDoor() { + super(PathType.DOOR); + } + + public PathDoor(RoomInfo destination) { + super(destination, PathType.DOOR); + } +} diff --git a/Sources/app/src/main/java/Structures/PathInfo.java b/Sources/app/src/main/java/Structures/PathInfo.java new file mode 100644 index 0000000..6ed7507 --- /dev/null +++ b/Sources/app/src/main/java/Structures/PathInfo.java @@ -0,0 +1,44 @@ +package Structures; + +enum PathType { + STAIRS, + DOOR +} + +public class PathInfo { + PathType type = PathType.DOOR; + RoomInfo destination; + + public PathInfo() { + + } + + public PathInfo(RoomInfo destination) { + this.destination = destination; + } + + public PathInfo(PathType type) { + this.type = type; + } + + public PathInfo(RoomInfo destination, PathType type) { + this.destination = destination; + this.type = type; + } + + public PathType getType() { + return type; + } + + public void setType(PathType type) { + this.type = type; + } + + public RoomInfo getDestination() { + return destination; + } + + public void setDestination(RoomInfo destination) { + this.destination = destination; + } +} diff --git a/Sources/app/src/main/java/Structures/PathStairs.java b/Sources/app/src/main/java/Structures/PathStairs.java new file mode 100644 index 0000000..099c428 --- /dev/null +++ b/Sources/app/src/main/java/Structures/PathStairs.java @@ -0,0 +1,26 @@ +package Structures; + +enum StairsDirection { + UP, + DOWN, + BOTH +} + +public class PathStairs extends PathInfo { + RoomInfo roomDown; + + public PathStairs() { + super(PathType.STAIRS); + } + + public PathStairs(RoomInfo roomUp, RoomInfo roomDown, StairsDirection direction) { + super(roomUp, PathType.STAIRS); + this.roomDown = roomDown; + } + + public RoomInfo getDestination(StairsDirection direction) { + if (direction == StairsDirection.BOTH) return null; // can't go in both directions ! + if (direction == StairsDirection.UP) return this.destination; + return this.roomDown; + } +} diff --git a/Sources/app/src/main/java/Structures/PathView.java b/Sources/app/src/main/java/Structures/PathView.java new file mode 100644 index 0000000..ce1de81 --- /dev/null +++ b/Sources/app/src/main/java/Structures/PathView.java @@ -0,0 +1,49 @@ +package Structures; + +public class PathView { + int x, y, width, height; + PathInfo path; + + public PathView() { + + } + + public PathView(int x, int y, int width, int height) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public PathView(int x, int y, int width, int height, PathInfo path) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.path = path; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public PathInfo getPath() { + return path; + } + + public void setPath(PathInfo path) { + this.path = path; + } +} -- GitLab