File tree Expand file tree Collapse file tree 9 files changed +27
-14
lines changed
artifact/environment/roomartifact
test/java/entity/actuator Expand file tree Collapse file tree 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
2929 */
3030 void init (final String roomId ) {
3131 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 );
3333 this .wotInvoker = new WotInvoker ();
3434 }
3535
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class Cooler extends AbstractActuatorInRoomArtifact implements Switchable
2929 */
3030 void init (final String roomId ) {
3131 super .init (ActuatorType .COOLING , new RoomID (roomId ));
32- this .actuator = new SwitchableActuator (this .getActuatorID ());
32+ this .actuator = new SwitchableActuator (this .getActuatorID (), ActuatorType . COOLING );
3333 this .wotInvoker = new WotInvoker ();
3434 }
3535
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class Heater extends AbstractActuatorInRoomArtifact implements Switchable
2929 */
3030 void init (final String roomId ) {
3131 super .init (ActuatorType .HEATING , new RoomID (roomId ));
32- this .actuator = new SwitchableActuator (this .getActuatorID ());
32+ this .actuator = new SwitchableActuator (this .getActuatorID (), ActuatorType . HEATING );
3333 this .wotInvoker = new WotInvoker ();
3434 }
3535
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class SurgicalLight extends AbstractActuatorInRoomArtifact implements Dim
2929 */
3030 void init (final String roomId ) {
3131 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 );
3333 this .wotInvoker = new WotInvoker ();
3434 }
3535
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class Ventilation extends AbstractActuatorInRoomArtifact implements Dimma
2929 */
3030 void init (final String roomId ) {
3131 super .init (ActuatorType .VENTILATION , new RoomID (roomId ));
32- this .actuator = new DimmableActuator (this .getActuatorID ());
32+ this .actuator = new DimmableActuator (this .getActuatorID (), ActuatorType . VENTILATION );
3333 this .wotInvoker = new WotInvoker ();
3434 }
3535
Original file line number Diff line number Diff line change 1515 */
1616public class Actuator {
1717 private final ActuatorID actuatorID ;
18+ private final ActuatorType actuatorType ;
1819
1920 /**
2021 * Default constructor.
2122 * @param actuatorID the actuator id.
23+ * @param actuatorType the actuator type.
2224 */
23- public Actuator (final ActuatorID actuatorID ) {
25+ public Actuator (final ActuatorID actuatorID , final ActuatorType actuatorType ) {
2426 this .actuatorID = actuatorID ;
27+ this .actuatorType = actuatorType ;
2528 }
2629
2730 /**
2831 * Get the actuator id.
2932 * @return the actuator id.
3033 */
31- public final ActuatorID getId () {
34+ public ActuatorID getId () {
3235 return this .actuatorID ;
3336 }
3437
38+ /**
39+ * Get the actuator type.
40+ * @return the actuator type.
41+ */
42+ public ActuatorType getActuatorType () {
43+ return this .actuatorType ;
44+ }
45+
3546 @ Override
3647 public final boolean equals (final Object other ) {
3748 if (this == other ) {
Original file line number Diff line number Diff line change @@ -17,9 +17,10 @@ public class DimmableActuator extends Actuator {
1717 /**
1818 * Default constructor.
1919 * @param actuatorID the actuator id.
20+ * @param actuatorType the actuator type.
2021 */
21- public DimmableActuator (final ActuatorID actuatorID ) {
22- super (actuatorID );
22+ public DimmableActuator (final ActuatorID actuatorID , final ActuatorType actuatorType ) {
23+ super (actuatorID , actuatorType );
2324 }
2425
2526 /**
Original file line number Diff line number Diff line change @@ -17,9 +17,10 @@ public class SwitchableActuator extends Actuator {
1717 /**
1818 * Default constructor.
1919 * @param actuatorID the actuator id.
20+ * @param actuatorType the actuator type.
2021 */
21- public SwitchableActuator (final ActuatorID actuatorID ) {
22- super (actuatorID );
22+ public SwitchableActuator (final ActuatorID actuatorID , final ActuatorType actuatorType ) {
23+ super (actuatorID , actuatorType );
2324 }
2425
2526 /**
Original file line number Diff line number Diff line change 2020 * Test for {@link Actuator} entity.
2121 */
2222class 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 );
2626
2727 @ Test
2828 @ 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