diff options
Diffstat (limited to 'src/com/fourisland/fourpuzzle/Direction.java')
-rw-r--r-- | src/com/fourisland/fourpuzzle/Direction.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/com/fourisland/fourpuzzle/Direction.java b/src/com/fourisland/fourpuzzle/Direction.java index e3a6cb8..948b024 100644 --- a/src/com/fourisland/fourpuzzle/Direction.java +++ b/src/com/fourisland/fourpuzzle/Direction.java | |||
@@ -13,5 +13,22 @@ public enum Direction { | |||
13 | North, | 13 | North, |
14 | East, | 14 | East, |
15 | South, | 15 | South, |
16 | West | 16 | West; |
17 | |||
18 | /** | ||
19 | * Returns the direction opposite from the current one | ||
20 | * @return A Direction representing the opposite direction | ||
21 | */ | ||
22 | public Direction oppositeDirection() | ||
23 | { | ||
24 | switch (this) | ||
25 | { | ||
26 | case North: return Direction.South; | ||
27 | case West: return Direction.East; | ||
28 | case South: return Direction.North; | ||
29 | case East: return Direction.West; | ||
30 | } | ||
31 | |||
32 | return null; | ||
33 | } | ||
17 | } | 34 | } |