Skip to content

Commit

Permalink
Merge pull request #62 from mlee97/#41-refactor/house_context_manipul…
Browse files Browse the repository at this point in the history
…ation

#41 refactor/house context manipulation
  • Loading branch information
NJLprograms authored Dec 6, 2020
2 parents 3153681 + 7eb6f31 commit d68d229
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 377 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;


@RestController
Expand Down Expand Up @@ -270,5 +271,12 @@ public String displayConsoleOutput(){
}
return messages;
}
@PostMapping(value="/HouseParameters")
public ArrayList<Room> houseStatus(@Validated @ModelAttribute("profile") final Profile profile, @Validated @ModelAttribute("simulator") final Simulator simulator){

return Simulator.roomsOfHouse;
}



}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

public class Room {
private String roomName;
private List<Door> doors = new ArrayList<>();
private List<Window> windows = new ArrayList<>();
private List<Light> lights = new ArrayList<>();
private final List<Door> doors = new ArrayList<>();
private final List<Window> windows = new ArrayList<>();
private final List<Light> lights = new ArrayList<>();
private int blockedWindows;
private int blockedDoors;
private double temperature;
private boolean overridden;
private Zone zone;

public int getOpenLights() {
int count = 0;

Expand Down Expand Up @@ -156,74 +156,6 @@ public void initLights(int numOfLights) {
public void setRoomName(String roomName) { this.roomName=roomName; }

public String getRoomName() { return this.roomName; }

public boolean canEnter() {

boolean canEnter = false;

for(int i=0; i>=doors.size(); i++) {
if(canEnter == true) {
break;
}
if(doors.get(i).isOpen()) {
canEnter = true;
}
}

return canEnter;

}

public boolean isWindy() {
boolean windy = false;

for(int i=0; i>=windows.size(); i++) {
if(windy == true) {
break;
}
if(windows.get(i).isOpen()) {
windy = true;
}
}
return windy;
}

public boolean isBright() {

boolean bright = false;

for(int i=0; i>=lights.size(); i++) {
if(bright == true) {
break;
}
if(lights.get(i).isOn()) {
bright = true;
}
}

return bright;
}

public boolean findDoors() {
if (doors.size() == 0) {
return false;
}else
return true;
}

public boolean findLights() {
if (lights.size() == 0) {
return false;
}else
return true;
}

public boolean findWindows() {
if (windows.size() == 0) {
return false;
}else
return true;
}

public List<Window> getWindows() {
return this.windows;
Expand Down Expand Up @@ -275,15 +207,6 @@ public void setBlockedWindows(int windowsToBlock) {
}

}

public String Status() {
String status = "There are currently ";
String blockStatus = this.getBlockedDoors()+" blocked doors and "+this.getBlockedWindows()+" blocked windows, ";
String closeStatus = this.getClosedDoors()+" closed doors, "+this.getClosedWindows()
+" closed windows, and "+this.getClosedLights()+" closed lights.";

return status+blockStatus+closeStatus;
}

public double getTemperature() {
return temperature;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ input:checked + .slider:before {
}

.houseLayout {
display: none;
width: 100%;
height: 725px;
}
Expand All @@ -140,6 +141,3 @@ input:checked + .slider:before {
height: 30px;

}
.houseSimulatorOnOff{
display: none;
}
Loading

0 comments on commit d68d229

Please sign in to comment.