Pr_robot_factory/domain/R2D2.java

47 lines
1.1 KiB
Java

package domain;
import robot.exceptions.ExceptionStorage;
import robot.exceptions.RobotException;
import robot.exceptions.robotExceptions;
public class R2D2 extends RobotBasics {
/**
*
* @param id> int
* @param name> String
*/
public R2D2(int id, String name){
super(id, name);
}
/**
* @see robot.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 robot.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;
}
}
}