diff options
Diffstat (limited to 'src/ch/epfl/maze/util/Direction.java')
-rw-r--r-- | src/ch/epfl/maze/util/Direction.java | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/ch/epfl/maze/util/Direction.java b/src/ch/epfl/maze/util/Direction.java index 5f83c22..d2ee4e7 100644 --- a/src/ch/epfl/maze/util/Direction.java +++ b/src/ch/epfl/maze/util/Direction.java | |||
@@ -7,14 +7,12 @@ package ch.epfl.maze.util; | |||
7 | * | 7 | * |
8 | * @author Pacien TRAN-GIRARD | 8 | * @author Pacien TRAN-GIRARD |
9 | */ | 9 | */ |
10 | |||
11 | public enum Direction { | 10 | public enum Direction { |
12 | DOWN, UP, RIGHT, LEFT, NONE; | 11 | DOWN, UP, RIGHT, LEFT, NONE; |
13 | 12 | ||
14 | /** | 13 | /** |
15 | * An array of all the possible directions that can be taken. | 14 | * An array of all the possible directions that can be taken. |
16 | */ | 15 | */ |
17 | |||
18 | public static final Direction[] POSSIBLE_DIRECTIONS = new Direction[]{ | 16 | public static final Direction[] POSSIBLE_DIRECTIONS = new Direction[]{ |
19 | Direction.DOWN, | 17 | Direction.DOWN, |
20 | Direction.UP, | 18 | Direction.UP, |
@@ -27,7 +25,6 @@ public enum Direction { | |||
27 | * | 25 | * |
28 | * @return Integer value of the direction | 26 | * @return Integer value of the direction |
29 | */ | 27 | */ |
30 | |||
31 | public int intValue() { | 28 | public int intValue() { |
32 | switch (this) { | 29 | switch (this) { |
33 | case DOWN: | 30 | case DOWN: |
@@ -53,7 +50,6 @@ public enum Direction { | |||
53 | * | 50 | * |
54 | * @return Orthonormal {@code Vector2D} that represents the direction. | 51 | * @return Orthonormal {@code Vector2D} that represents the direction. |
55 | */ | 52 | */ |
56 | |||
57 | public Vector2D toVector() { | 53 | public Vector2D toVector() { |
58 | switch (this) { | 54 | switch (this) { |
59 | case DOWN: | 55 | case DOWN: |
@@ -79,7 +75,6 @@ public enum Direction { | |||
79 | * | 75 | * |
80 | * @return The opposite direction. | 76 | * @return The opposite direction. |
81 | */ | 77 | */ |
82 | |||
83 | public Direction reverse() { | 78 | public Direction reverse() { |
84 | switch (this) { | 79 | switch (this) { |
85 | case DOWN: | 80 | case DOWN: |
@@ -107,7 +102,6 @@ public enum Direction { | |||
107 | * @return <b>true</b> if the direction is the opposite the argument, | 102 | * @return <b>true</b> if the direction is the opposite the argument, |
108 | * <b>false</b> otherwise | 103 | * <b>false</b> otherwise |
109 | */ | 104 | */ |
110 | |||
111 | public boolean isOpposite(Direction d) { | 105 | public boolean isOpposite(Direction d) { |
112 | return this == d.reverse(); | 106 | return this == d.reverse(); |
113 | } | 107 | } |
@@ -120,7 +114,6 @@ public enum Direction { | |||
120 | * @return The direction converted to the frame of reference given by the | 114 | * @return The direction converted to the frame of reference given by the |
121 | * direction called. | 115 | * direction called. |
122 | */ | 116 | */ |
123 | |||
124 | public Direction relativeDirection(Direction dir) { | 117 | public Direction relativeDirection(Direction dir) { |
125 | switch (this) { | 118 | switch (this) { |
126 | case DOWN: | 119 | case DOWN: |
@@ -148,7 +141,6 @@ public enum Direction { | |||
148 | * @return The direction converted back to the frame of reference of the | 141 | * @return The direction converted back to the frame of reference of the |
149 | * labyrinth | 142 | * labyrinth |
150 | */ | 143 | */ |
151 | |||
152 | public Direction unRelativeDirection(Direction dir) { | 144 | public Direction unRelativeDirection(Direction dir) { |
153 | switch (this) { | 145 | switch (this) { |
154 | case DOWN: | 146 | case DOWN: |
@@ -174,7 +166,6 @@ public enum Direction { | |||
174 | * | 166 | * |
175 | * @return The rotated direction to the right | 167 | * @return The rotated direction to the right |
176 | */ | 168 | */ |
177 | |||
178 | public Direction rotateRight() { | 169 | public Direction rotateRight() { |
179 | switch (this) { | 170 | switch (this) { |
180 | case DOWN: | 171 | case DOWN: |
@@ -200,7 +191,6 @@ public enum Direction { | |||
200 | * | 191 | * |
201 | * @return The rotated direction to the left | 192 | * @return The rotated direction to the left |
202 | */ | 193 | */ |
203 | |||
204 | public Direction rotateLeft() { | 194 | public Direction rotateLeft() { |
205 | switch (this) { | 195 | switch (this) { |
206 | case DOWN: | 196 | case DOWN: |
@@ -230,7 +220,6 @@ public enum Direction { | |||
230 | * @return The directions converted to the frame of reference given by the | 220 | * @return The directions converted to the frame of reference given by the |
231 | * direction which calls the method | 221 | * direction which calls the method |
232 | */ | 222 | */ |
233 | |||
234 | public Direction[] relativeDirections(Direction[] dir) { | 223 | public Direction[] relativeDirections(Direction[] dir) { |
235 | Direction[] relativeDirections = new Direction[dir.length]; | 224 | Direction[] relativeDirections = new Direction[dir.length]; |
236 | 225 | ||
@@ -240,4 +229,5 @@ public enum Direction { | |||
240 | 229 | ||
241 | return relativeDirections; | 230 | return relativeDirections; |
242 | } | 231 | } |
232 | |||
243 | } | 233 | } |