51 lines
770 B
Java
51 lines
770 B
Java
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;
|
|
}
|
|
}
|
|
}
|