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 {
|
2022-12-08 23:34:47 +01:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
* @param id> int
|
|
|
|
* @param name> String
|
|
|
|
*/
|
2022-12-08 23:13:22 +01:00
|
|
|
public R2D2(int id, String name){
|
2022-12-09 01:38:11 +01:00
|
|
|
super(id, name);
|
|
|
|
|
2022-12-08 23:13:22 +01:00
|
|
|
}
|
2022-12-08 23:34:47 +01:00
|
|
|
|
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
|
|
|
}
|