2020-04-14 15:54:09 +02:00
|
|
|
package inf112.fiasko.roborally.elementproperties;
|
2020-02-22 23:12:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class represents an id for marking specific robots
|
|
|
|
*/
|
|
|
|
public enum RobotID {
|
2020-04-20 13:10:13 +02:00
|
|
|
ROBOT_1(1),
|
|
|
|
ROBOT_2(2),
|
|
|
|
ROBOT_3(3),
|
|
|
|
ROBOT_4(4),
|
|
|
|
ROBOT_5(5),
|
|
|
|
ROBOT_6(6),
|
|
|
|
ROBOT_7(7),
|
|
|
|
ROBOT_8(8);
|
2020-03-19 11:47:35 +01:00
|
|
|
|
|
|
|
private final int robotID;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor to let a robotID be represented by a numerical identifier
|
2020-04-20 13:10:13 +02:00
|
|
|
*
|
|
|
|
* @param robotID The numerical identifier assigned to the robot ID
|
2020-03-19 11:47:35 +01:00
|
|
|
*/
|
|
|
|
RobotID(int robotID) {
|
|
|
|
this.robotID = robotID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a robot ID value from its numerical representation
|
2020-04-20 13:10:13 +02:00
|
|
|
*
|
|
|
|
* @param robotID The numerical representation of a robot id
|
|
|
|
* @return The enum value representing the robot ID, or null if the id is invalid
|
2020-03-19 11:47:35 +01:00
|
|
|
*/
|
|
|
|
public static RobotID getRobotIDFromID(int robotID) {
|
|
|
|
for (RobotID type : RobotID.values()) {
|
|
|
|
if (type.robotID == robotID) {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2020-04-20 13:10:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the numerical id used for identification of a robot id
|
|
|
|
*
|
|
|
|
* @return The numerical id of the robot id
|
|
|
|
*/
|
|
|
|
public int getRobotIDID() {
|
|
|
|
return this.robotID;
|
|
|
|
}
|
2020-02-22 23:12:51 +01:00
|
|
|
}
|