From 01ccf6d968b09228d5c6341587f290976ca0199c Mon Sep 17 00:00:00 2001 From: tommi27 Date: Fri, 28 Feb 2020 15:28:55 +0100 Subject: [PATCH] wip --- .idea/codeStyles/codeStyleConfig.xml | 5 +++++ .idea/misc.xml | 2 +- .../smarthut/models/ButtonDimmer.java | 2 +- .../smarthut/models/KnobDimmer.java | 2 +- .../sanmarinoes/smarthut/models/Switch.java | 18 ++++++++++++++++++ 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 7c6191b..c2c3244 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ButtonDimmer.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ButtonDimmer.java index e44e990..23a69f8 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ButtonDimmer.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ButtonDimmer.java @@ -11,7 +11,7 @@ import javax.persistence.OneToMany; */ @Entity public class ButtonDimmer extends Dimmer { - @OneToMany(mappedBy = "") + @OneToMany(mappedBy = "button_dimmer") private Set lights = new HashSet(); public ButtonDimmer() { diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java index e34ef76..5c5c603 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/KnobDimmer.java @@ -11,7 +11,7 @@ import javax.persistence.OneToMany; */ @Entity public class KnobDimmer extends Dimmer { - @OneToMany(mappedBy = "") + @OneToMany(mappedBy = "knob_dimmer") private Set lights = new HashSet(); public KnobDimmer() { diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Switch.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Switch.java index fbf1eed..cdc6a35 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Switch.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Switch.java @@ -1,11 +1,29 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models; +import javax.persistence.Column; import javax.persistence.Entity; /** A switch input device TODO: define switch behaviour (push button vs on/off state) */ @Entity public class Switch extends InputDevice { + + /** The state of this switch */ + @Column private boolean switchState = false; + public Switch() { super("switch"); } + + /** + * Setter method for Switch + * + * @param state The state to be set + */ + void setState(boolean state) { + switchState = state; + } + + boolean getState() { + return switchState; + } }