aboutsummaryrefslogtreecommitdiff
path: root/Week6/src/Direction.java
diff options
context:
space:
mode:
authorCamil Staps2015-03-11 10:50:52 +0100
committerCamil Staps2015-03-11 10:50:52 +0100
commitd0972c57cc23d7a6c913594e8166770fc1b28ff6 (patch)
treeb64f573920d6796ffc0612476ad25dbe4135b53f /Week6/src/Direction.java
parentWeek 6 framework (diff)
Added framework
Diffstat (limited to 'Week6/src/Direction.java')
-rw-r--r--Week6/src/Direction.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/Week6/src/Direction.java b/Week6/src/Direction.java
new file mode 100644
index 0000000..d4837b9
--- /dev/null
+++ b/Week6/src/Direction.java
@@ -0,0 +1,26 @@
+/**
+ * @author Sjaak Smetsers
+ * @version 1.2
+ * @date 28-02-2015
+ * An enumeration type for the 4 points of the compass
+ * Each constant has 2 (final) int attributes indicating
+ * the displacement of each direction on a 2-dimensional grid
+ * of which the origin is located in the upper left corner
+ */
+public enum Direction {
+ NORTH (0,-1), EAST (1,0), SOUTH(0,1), WEST(-1,0);
+
+ private final int dx, dy;
+ private Direction (int dx, int dy) {
+ this.dx = dx;
+ this.dy = dy;
+ }
+
+ public int GetDX () {
+ return dx;
+ }
+
+ public int GetDY () {
+ return dy;
+ }
+}