Added invert to Direction

This commit is contained in:
Bokros Bálint 2016-05-13 20:26:02 +02:00
parent 595d5d6048
commit d14ce39ee1

View File

@ -2,4 +2,19 @@ package cicaprojekt;
public enum Direction { public enum Direction {
NORTH, SOUTH, EAST, WEST; NORTH, SOUTH, EAST, WEST;
public static Direction invert(Direction direction) {
switch (direction) {
case NORTH:
return SOUTH;
case EAST:
return WEST;
case SOUTH:
return NORTH;
case WEST:
return EAST;
default:
return NORTH;
}
}
} }