diff options
Diffstat (limited to 'src/ch/epfl/maze/util')
-rw-r--r-- | src/ch/epfl/maze/util/Direction.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ch/epfl/maze/util/Direction.java b/src/ch/epfl/maze/util/Direction.java index ac172cb..b3f2e9c 100644 --- a/src/ch/epfl/maze/util/Direction.java +++ b/src/ch/epfl/maze/util/Direction.java | |||
@@ -1,5 +1,9 @@ | |||
1 | package ch.epfl.maze.util; | 1 | package ch.epfl.maze.util; |
2 | 2 | ||
3 | import java.util.Collections; | ||
4 | import java.util.EnumSet; | ||
5 | import java.util.Set; | ||
6 | |||
3 | /** | 7 | /** |
4 | * Directions that an animal can take to move. They represent the four cardinal | 8 | * Directions that an animal can take to move. They represent the four cardinal |
5 | * points ({@code DOWN, UP, RIGHT, LEFT}) from the frame of reference of the | 9 | * points ({@code DOWN, UP, RIGHT, LEFT}) from the frame of reference of the |
@@ -12,14 +16,14 @@ public enum Direction { | |||
12 | DOWN, UP, RIGHT, LEFT, NONE; | 16 | DOWN, UP, RIGHT, LEFT, NONE; |
13 | 17 | ||
14 | /** | 18 | /** |
15 | * An array of all the possible directions that can be taken. | 19 | * A set of all the possible directions that can be taken. |
16 | */ | 20 | */ |
17 | public static final Direction[] POSSIBLE_DIRECTIONS = new Direction[]{ | 21 | public static final Set<Direction> MOVING_DIRECTIONS = Collections.unmodifiableSet(EnumSet.of( |
18 | Direction.DOWN, | 22 | Direction.DOWN, |
19 | Direction.UP, | 23 | Direction.UP, |
20 | Direction.RIGHT, | 24 | Direction.RIGHT, |
21 | Direction.LEFT | 25 | Direction.LEFT |
22 | }; | 26 | )); |
23 | 27 | ||
24 | /** | 28 | /** |
25 | * Returns the integer value of the direction | 29 | * Returns the integer value of the direction |