Merge branch 'data-model-feature' of lab.si.usi.ch:sa4-2020/the-sanmarinoes/backend into data-model-feature

This commit is contained in:
Claudio Maggioni 2020-02-22 11:33:50 +01:00
commit 1359800845
6 changed files with 48 additions and 4 deletions

View File

@ -1,2 +1,2 @@
#Wed Feb 19 20:29:41 CET 2020
gradle.version=6.0.1
#Thu Feb 20 16:16:13 CET 2020
gradle.version=6.2

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_12" project-jdk-name="12.0.1" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="12.0.1" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

12
backend.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -14,7 +14,10 @@ public class DimmableLight extends Light {
return intensity;
}
public void setIntensity(int intensity) {
public void setIntensity(int intensity) throws IllegalArgumentException {
if (intensity < 0 || intensity > 100) {
throw new IllegalArgumentException("The intensity level can't go below 0 or above 100");
}
this.intensity = intensity;
}
}

View File

@ -0,0 +1,29 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import java.util.ArrayList;
public class house {
//a list of the rooms present in the house
private ArrayList<Room> rooms;
//Constructor
public house(){
this.rooms=new ArrayList<Room>();
}
//this method add a Room to the house
public void addRoom(Room room){
if(!this.rooms.contains(room)) {
this.rooms.add(room);
}
}
//this method removes the given room if it is present in the house
public void remove(Room room){
int a=this.rooms.indexOf(room);
if(a!=-1) {
this.rooms.remove(a);
}
}
}