2022-12-08 14:58:44 +01:00
|
|
|
package domain;
|
|
|
|
|
2022-12-08 23:13:22 +01:00
|
|
|
public class R2D2 implements Robot{
|
|
|
|
private int id;
|
|
|
|
private String name;
|
|
|
|
private boolean power;
|
|
|
|
|
2022-12-08 23:34:47 +01:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
* @param id> int
|
|
|
|
* @param name> String
|
|
|
|
*/
|
2022-12-08 23:13:22 +01:00
|
|
|
public R2D2(int id, String name){
|
|
|
|
this.id = id;
|
|
|
|
this.name = name;
|
|
|
|
power = false;
|
|
|
|
}
|
2022-12-08 23:34:47 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see domain.RobotControl
|
|
|
|
*/
|
2022-12-08 23:13:22 +01:00
|
|
|
@Override
|
|
|
|
public int getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2022-12-08 23:34:47 +01:00
|
|
|
/**
|
|
|
|
* @see domain.RobotControl
|
|
|
|
*/
|
2022-12-08 23:13:22 +01:00
|
|
|
@Override
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2022-12-08 23:34:47 +01:00
|
|
|
/**
|
|
|
|
* @see domain.RobotControl
|
|
|
|
*/
|
2022-12-08 23:13:22 +01:00
|
|
|
@Override
|
|
|
|
public void triggerPowerSwitch() {
|
2022-12-08 23:34:47 +01:00
|
|
|
if(power == false){
|
2022-12-08 23:13:22 +01:00
|
|
|
power = true;
|
|
|
|
}else{
|
|
|
|
power = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-08 23:34:47 +01:00
|
|
|
/**
|
|
|
|
* @see domain.RobotControl
|
|
|
|
*/
|
2022-12-08 23:13:22 +01:00
|
|
|
@Override
|
|
|
|
public boolean isPowerOn() {
|
|
|
|
return power;
|
|
|
|
}
|
2022-12-08 14:58:44 +01:00
|
|
|
}
|