Skip to content

Commit df372ab

Browse files
chore: add actuator id on actions invocation
1 parent 40ac0e5 commit df372ab

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/env/entity/actuator/DimmableActuator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ public DimmableActuator(final ActuatorID actuatorID) {
2828
* @param invoker the invoker to call
2929
*/
3030
public void setIntensity(final int intensity, final DimmableInvoker invoker) {
31-
invoker.setIntensity(intensity);
31+
invoker.setIntensity(this.getId(), intensity);
3232
}
3333
}

src/env/entity/actuator/SwitchableActuator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public SwitchableActuator(final ActuatorID actuatorID) {
2727
* @param invoker the invoker to call.
2828
*/
2929
public void turnOn(final SwitchableInvoker invoker) {
30-
invoker.turnOn();
30+
invoker.turnOn(this.getId());
3131
}
3232

3333
/**
3434
* Turn off the actuator.
3535
* @param invoker the invoker to call.
3636
*/
3737
public void turnOff(final SwitchableInvoker invoker) {
38-
invoker.turnOff();
38+
invoker.turnOff(this.getId());
3939
}
4040
}

src/env/entity/actuator/invoker/DimmableInvoker.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88

99
package entity.actuator.invoker;
1010

11+
import entity.actuator.ActuatorID;
12+
1113
/**
1214
* Interface that models an actuator invoker that ca be turned on with an intensity.
1315
*/
1416
public interface DimmableInvoker {
1517
/**
1618
* Set the intensity of the actuator.
19+
* @param actuatorID the id of the actuator.
1720
* @param intensity the intensity to set in the actuator.
1821
*/
19-
void setIntensity(int intensity);
22+
void setIntensity(ActuatorID actuatorID, int intensity);
2023
}

src/env/entity/actuator/invoker/SwitchableInvoker.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@
88

99
package entity.actuator.invoker;
1010

11+
import entity.actuator.ActuatorID;
12+
1113
/**
1214
* Interface that models an actuator invoker that can be turned on and off.
1315
*/
1416
public interface SwitchableInvoker {
1517
/**
1618
* Turn the actuator on.
19+
* @param actuatorID the id of the actuator.
1720
*/
18-
void turnOn();
21+
void turnOn(ActuatorID actuatorID);
1922

2023
/**
2124
* Turn the actuator off.
25+
* @param actuatorID the id of the actuator.
2226
*/
23-
void turnOff();
27+
void turnOff(ActuatorID actuatorID);
2428
}

0 commit comments

Comments
 (0)