abstract Superclass for Robot

main
Philipp3107 2022-12-09 00:29:00 +01:00
parent 4e569529f5
commit c5c665a9f3
1 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,50 @@
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;
}
}
}