PIbd-22_Petrushin_E.A._Self.../NumbeRollers.java
2023-11-06 15:52:02 +04:00

28 lines
646 B
Java

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;
}
}