Skip to content

Commit 31effc5

Browse files
feat: implement cooler actions
1 parent 7500b95 commit 31effc5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/env/artifact/environment/roomartifact/Cooler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
import cartago.OPERATION;
1212
import entity.actuator.ActuatorType;
13+
import entity.actuator.SwitchableActuator;
1314
import entity.room.RoomID;
15+
import infrastructure.wot.WotInvoker;
1416

1517
import java.util.logging.Logger;
1618

@@ -19,23 +21,29 @@
1921
* to the cooling part.
2022
*/
2123
public class Cooler extends AbstractActuatorInRoomArtifact implements SwitchableArtifact {
24+
private SwitchableActuator actuator;
25+
private WotInvoker wotInvoker;
2226
/**
2327
* Initialize the cooler artifact.
2428
* @param roomId the room id where the cooler is placed.
2529
*/
2630
void init(final String roomId) {
2731
super.init(ActuatorType.COOLING, new RoomID(roomId));
32+
this.actuator = new SwitchableActuator(this.getActuatorID());
33+
this.wotInvoker = new WotInvoker();
2834
}
2935

3036
@Override
3137
@OPERATION
3238
public final void turnOn() {
3339
Logger.getLogger(Cooler.class.toString()).info("[" + this.getRoomId() + "] " + this.getActuatorID().getId() + " ON");
40+
this.actuator.turnOn(this.wotInvoker);
3441
}
3542

3643
@Override
3744
@OPERATION
3845
public final void turnOff() {
3946
Logger.getLogger(Cooler.class.toString()).info("[" + this.getRoomId() + "] " + this.getActuatorID().getId() + " OFF");
47+
this.actuator.turnOff(this.wotInvoker);
4048
}
4149
}

0 commit comments

Comments
 (0)