PIbd-22_Petrushin_E.A._Self.../SelfPropelledArtilleryUnit/NumbeRollers.java

28 lines
681 B
Java
Raw Normal View History

2023-11-08 20:01:23 +04:00
package SelfPropelledArtilleryUnit;
2023-11-06 15:52:02 +04:00
public enum NumbeRollers {
Min(4),
Mid(5),
Max(6);
private final int NumbeRollersCode;
private NumbeRollers(int NumbeRollersCode) {
this.NumbeRollersCode = NumbeRollersCode;
}
public int getNumbeRollersCode() {
return this.NumbeRollersCode;
}
public static NumbeRollers fromNumberToEnum(int number) {
try{
for (NumbeRollers numbeRoller : NumbeRollers.values()) {
if (numbeRoller.getNumbeRollersCode() == number) {
return numbeRoller;
}
}
}catch(NumberFormatException e){
}
return Min;
}
}