diff options
Diffstat (limited to 'src/ch/epfl/xblast/Direction.java')
-rw-r--r-- | src/ch/epfl/xblast/Direction.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ch/epfl/xblast/Direction.java b/src/ch/epfl/xblast/Direction.java index 030038b..e2df042 100644 --- a/src/ch/epfl/xblast/Direction.java +++ b/src/ch/epfl/xblast/Direction.java | |||
@@ -68,6 +68,25 @@ public enum Direction { | |||
68 | } | 68 | } |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * T(the current and given Directions are perpendicular). | ||
72 | * | ||
73 | * @param that a Direction to compare | ||
74 | * @return T(the current and given Directions are perpendicular) | ||
75 | */ | ||
76 | public boolean isPerpendicularTo(Direction that) { | ||
77 | switch (this) { | ||
78 | case N: | ||
79 | case S: | ||
80 | return that == E || that == W; | ||
81 | case E: | ||
82 | case W: | ||
83 | return that == N || that == S; | ||
84 | default: | ||
85 | return false; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | /** | ||
71 | * Returns the x-coordinate of the normed vector representation of the Direction. | 90 | * Returns the x-coordinate of the normed vector representation of the Direction. |
72 | * | 91 | * |
73 | * @return the x-coordinate | 92 | * @return the x-coordinate |