Pr_robot_factory/domain/RobotBasics.java

51 lines
770 B
Java
Raw Normal View History

2022-12-09 00:29:00 +01:00
package domain;
public abstract class RobotBasics implements Robot {
private int id;
private String name;
private boolean power;
/**
* @see domain.RobotControl
*/
@Override
public int getId() {
return id;
}
/**
* @see domain.RobotControl
*/
@Override
public String getName() {
return name;
}
/**
* @see domain.RobotControl
*/
@Override
public void triggerPowerSwitch() {
toggle(power);
}
/**
* @see domain.RobotControl
*/
@Override
public boolean isPowerOn() {
return power;
}
/**
* @see domain.RobotControl
*/
public static void toggle(boolean b){
if(b == false){
b = true;
}else{
b = false;
}
}
}