Pr_robot_factory/domain/R2D2.java

55 lines
840 B
Java

package domain;
public class R2D2 implements Robot{
private int id;
private String name;
private boolean power;
/**
* Constructor
* @param id> int
* @param name> String
*/
public R2D2(int id, String name){
this.id = id;
this.name = name;
power = false;
}
/**
* @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() {
if(power == false){
power = true;
}else{
power = false;
}
}
/**
* @see domain.RobotControl
*/
@Override
public boolean isPowerOn() {
return power;
}
}