diff options
author | Pacien TRAN-GIRARD | 2015-11-26 10:00:43 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-11-26 10:00:43 +0100 |
commit | 1e2eff1e9829f8ffa694f3258433c91c804ab473 (patch) | |
tree | 0b0b8b7d7c07cf8ab3b26a1316d54199c18fd5b6 /src/ch/epfl/maze/util | |
parent | e326c2759d6529048d19c2c913b2b1c264f74485 (diff) | |
download | maze-solver-1e2eff1e9829f8ffa694f3258433c91c804ab473.tar.gz |
Improve choice filtering
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 |