25 lines
491 B
Java
25 lines
491 B
Java
|
public enum Direction {
|
||
|
Up,
|
||
|
Down,
|
||
|
Left,
|
||
|
Right;
|
||
|
|
||
|
public static Direction FromInteger(int intValue)
|
||
|
{
|
||
|
switch(intValue)
|
||
|
{
|
||
|
case 1:
|
||
|
return Up;
|
||
|
case 2:
|
||
|
return Down;
|
||
|
case 3:
|
||
|
return Left;
|
||
|
case 4:
|
||
|
return Right;
|
||
|
default:
|
||
|
System.out.println("Error: incorrect value for enum");
|
||
|
return Up;
|
||
|
}
|
||
|
}
|
||
|
}
|