24 lines
544 B
Java
24 lines
544 B
Java
package ch.fritteli.maze.generator.model;
|
|
|
|
public enum Direction {
|
|
TOP,
|
|
RIGHT,
|
|
BOTTOM,
|
|
LEFT;
|
|
|
|
public Direction invert() {
|
|
switch (this) {
|
|
case TOP:
|
|
return BOTTOM;
|
|
case RIGHT:
|
|
return LEFT;
|
|
case BOTTOM:
|
|
return TOP;
|
|
case LEFT:
|
|
return RIGHT;
|
|
default:
|
|
throw new IllegalStateException("Programming error: Not all enum values covered in enum Direction#invert()!");
|
|
}
|
|
}
|
|
}
|