Pr_robot_factory/domain/R2D2.java

37 lines
748 B
Java
Raw Normal View History

2022-12-08 14:58:44 +01:00
package domain;
2022-12-14 09:54:18 +01:00
import robot.exceptions.RobotException;
import robot.exceptions.RobotIllegalStateException;
import robot.interfaces.Sorting;
2022-12-09 00:30:35 +01:00
public class R2D2 extends RobotBasics {
/**
* Constructor
* @param id> int
* @param name> String
*/
public R2D2(int id, String name){
super(id, name);
}
2022-12-14 09:54:18 +01:00
@Override
public int[] think(int[] zahlen) throws RobotException {
if(isPowerOn() == true){
return selectionsSort.sorting(zahlen);
}else{
throw new RobotIllegalStateException(getName() + " is turned off.");
}
}
//Selectionsort...
Sorting selectionsSort = (int[] input) -> {
System.out.println("ich sortiere mit selection-Sort");
return input;
};
2022-12-08 14:58:44 +01:00
}