Pr_robot_factory/domain/R2D2.java

47 lines
1.1 KiB
Java

package domain;
import safety.robot_exceptions.ExceptionStorage;
import safety.robot_exceptions.RobotException;
import safety.robot_exceptions.robotExceptions;
public class R2D2 extends RobotBasics {
/**
*
* @param id> int
* @param name> String
*/
public R2D2(int id, String name){
super(id, name);
}
/**
* @see safety.interfaces.RobotInstructions
*/
public int[] think(int[] input) throws RobotException {
if(isPowerOn()){
return selectionSort(input);
}else{
RobotException robotexception = new RobotException(robotExceptions.ILLEGALSTATE, getName());
this.exceptions = new ExceptionStorage(robotexception);
throw robotexception;
}
}
/**
* @see safety.interfaces.RobotInstructions
*/
@Override
public String speak(int[] input) throws RobotException {
if (isPowerOn()) {
return ausgabe(input, ";");
} else {
RobotException robotexception = new RobotException(robotExceptions.ILLEGALSTATE, getName());
this.exceptions = new ExceptionStorage(robotexception);
throw robotexception;
}
}
}