File tree 9 files changed +27
-14
lines changed
artifact/environment/roomartifact
test/java/entity/actuator
9 files changed +27
-14
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class AmbientLight extends AbstractActuatorInRoomArtifact implements Dimm
29
29
*/
30
30
void init (final String roomId ) {
31
31
super .init (ActuatorType .AMBIENT_LIGHT , new RoomID (roomId ));
32
- this .actuator = new DimmableActuator (this .getActuatorID ());
32
+ this .actuator = new DimmableActuator (this .getActuatorID (), ActuatorType . AMBIENT_LIGHT );
33
33
this .wotInvoker = new WotInvoker ();
34
34
}
35
35
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class Cooler extends AbstractActuatorInRoomArtifact implements Switchable
29
29
*/
30
30
void init (final String roomId ) {
31
31
super .init (ActuatorType .COOLING , new RoomID (roomId ));
32
- this .actuator = new SwitchableActuator (this .getActuatorID ());
32
+ this .actuator = new SwitchableActuator (this .getActuatorID (), ActuatorType . COOLING );
33
33
this .wotInvoker = new WotInvoker ();
34
34
}
35
35
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class Heater extends AbstractActuatorInRoomArtifact implements Switchable
29
29
*/
30
30
void init (final String roomId ) {
31
31
super .init (ActuatorType .HEATING , new RoomID (roomId ));
32
- this .actuator = new SwitchableActuator (this .getActuatorID ());
32
+ this .actuator = new SwitchableActuator (this .getActuatorID (), ActuatorType . HEATING );
33
33
this .wotInvoker = new WotInvoker ();
34
34
}
35
35
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class SurgicalLight extends AbstractActuatorInRoomArtifact implements Dim
29
29
*/
30
30
void init (final String roomId ) {
31
31
super .init (ActuatorType .SURGICAL_LIGHT , new RoomID (roomId ));
32
- this .actuator = new DimmableActuator (this .getActuatorID ());
32
+ this .actuator = new DimmableActuator (this .getActuatorID (), ActuatorType . SURGICAL_LIGHT );
33
33
this .wotInvoker = new WotInvoker ();
34
34
}
35
35
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class Ventilation extends AbstractActuatorInRoomArtifact implements Dimma
29
29
*/
30
30
void init (final String roomId ) {
31
31
super .init (ActuatorType .VENTILATION , new RoomID (roomId ));
32
- this .actuator = new DimmableActuator (this .getActuatorID ());
32
+ this .actuator = new DimmableActuator (this .getActuatorID (), ActuatorType . VENTILATION );
33
33
this .wotInvoker = new WotInvoker ();
34
34
}
35
35
Original file line number Diff line number Diff line change 15
15
*/
16
16
public class Actuator {
17
17
private final ActuatorID actuatorID ;
18
+ private final ActuatorType actuatorType ;
18
19
19
20
/**
20
21
* Default constructor.
21
22
* @param actuatorID the actuator id.
23
+ * @param actuatorType the actuator type.
22
24
*/
23
- public Actuator (final ActuatorID actuatorID ) {
25
+ public Actuator (final ActuatorID actuatorID , final ActuatorType actuatorType ) {
24
26
this .actuatorID = actuatorID ;
27
+ this .actuatorType = actuatorType ;
25
28
}
26
29
27
30
/**
28
31
* Get the actuator id.
29
32
* @return the actuator id.
30
33
*/
31
- public final ActuatorID getId () {
34
+ public ActuatorID getId () {
32
35
return this .actuatorID ;
33
36
}
34
37
38
+ /**
39
+ * Get the actuator type.
40
+ * @return the actuator type.
41
+ */
42
+ public ActuatorType getActuatorType () {
43
+ return this .actuatorType ;
44
+ }
45
+
35
46
@ Override
36
47
public final boolean equals (final Object other ) {
37
48
if (this == other ) {
Original file line number Diff line number Diff line change @@ -17,9 +17,10 @@ public class DimmableActuator extends Actuator {
17
17
/**
18
18
* Default constructor.
19
19
* @param actuatorID the actuator id.
20
+ * @param actuatorType the actuator type.
20
21
*/
21
- public DimmableActuator (final ActuatorID actuatorID ) {
22
- super (actuatorID );
22
+ public DimmableActuator (final ActuatorID actuatorID , final ActuatorType actuatorType ) {
23
+ super (actuatorID , actuatorType );
23
24
}
24
25
25
26
/**
Original file line number Diff line number Diff line change @@ -17,9 +17,10 @@ public class SwitchableActuator extends Actuator {
17
17
/**
18
18
* Default constructor.
19
19
* @param actuatorID the actuator id.
20
+ * @param actuatorType the actuator type.
20
21
*/
21
- public SwitchableActuator (final ActuatorID actuatorID ) {
22
- super (actuatorID );
22
+ public SwitchableActuator (final ActuatorID actuatorID , final ActuatorType actuatorType ) {
23
+ super (actuatorID , actuatorType );
23
24
}
24
25
25
26
/**
Original file line number Diff line number Diff line change 20
20
* Test for {@link Actuator} entity.
21
21
*/
22
22
class ActuatorTest {
23
- private final Actuator actuator = new Actuator (new ActuatorID ("actuator1" ));
24
- private final Actuator actuatorDifferentRef = new Actuator (new ActuatorID ("actuator1" ));
25
- private final Actuator differentActuator = new Actuator (new ActuatorID ("actuator2" ));
23
+ private final Actuator actuator = new Actuator (new ActuatorID ("actuator1" ), ActuatorType . HEATING );
24
+ private final Actuator actuatorDifferentRef = new Actuator (new ActuatorID ("actuator1" ), ActuatorType . COOLING );
25
+ private final Actuator differentActuator = new Actuator (new ActuatorID ("actuator2" ), ActuatorType . HEATING );
26
26
27
27
@ Test
28
28
@ DisplayName ("An actuator must not be equal to other actuators with different id other classes" )
You can’t perform that action at this time.
0 commit comments