Skip to content
Snippets Groups Projects
Commit 80e17ab1 authored by FurWaz's avatar FurWaz
Browse files

Added new required data structures

parent 01904462
No related branches found
No related tags found
No related merge requests found
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;
}
}
package Structures;
public class PathDoor extends PathInfo {
public PathDoor() {
super(PathType.DOOR);
}
public PathDoor(RoomInfo destination) {
super(destination, PathType.DOOR);
}
}
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;
}
}
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;
}
}
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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment