summaryrefslogtreecommitdiff
path: root/src/tetris/model
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2012-12-13 22:14:24 -0800
committerJesse Morgan <jesse@jesterpm.net>2012-12-13 22:14:24 -0800
commit87e98e00e0ca5ac4229091aa9bb0e5c09093f50f (patch)
treeb3e73ba3a22d1e04a6dd87111db27ac7d698d5f3 /src/tetris/model
Tetris project from TCSS305 class.
Original project was in SVN on the school servers, so the versioning history is gone.
Diffstat (limited to 'src/tetris/model')
-rw-r--r--src/tetris/model/IntPoint.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/tetris/model/IntPoint.java b/src/tetris/model/IntPoint.java
new file mode 100644
index 0000000..73bf07c
--- /dev/null
+++ b/src/tetris/model/IntPoint.java
@@ -0,0 +1,83 @@
+/*
+ * Jesse Morgan <jesterpm@u.washington.edu>
+ *
+ * TCSS 305 Ð Autumn 2009
+ * Tetris Project
+ * 17 November 2009
+ */
+
+package tetris.model;
+
+/**
+ * Class to represent an int point in two-space.
+ *
+ * @author Jesse Morgan <jesterpm@u.washington.edu>
+ * @version 1.0 17 November 2009
+ */
+public class IntPoint {
+ /**
+ * The x-coordinate.
+ */
+ private final int my_x;
+
+ /**
+ * The y-coordinate.
+ */
+ private final int my_y;
+
+ /**
+ * Create a new point.
+ *
+ * @param the_x The x-coordinate.
+ * @param the_y The y-coordinate.
+ */
+ public IntPoint(final int the_x, final int the_y) {
+ my_x = the_x;
+ my_y = the_y;
+ }
+
+ /**
+ * @return The x-coordinate.
+ */
+ public int getX() {
+ return my_x;
+ }
+
+ /**
+ * @return The y-coordinate.
+ */
+ public int getY() {
+ return my_y;
+ }
+
+ /**
+ * Compare IntPoint to another object.
+ * @param the_other The object to compare to.
+ * @return True if x and y are the same. False otherwise.
+ */
+ public boolean equals(final Object the_other) {
+ boolean result = false;
+
+ if (the_other != null && the_other.getClass() == getClass()) {
+ final IntPoint other_point = (IntPoint) the_other;
+
+ if (getX() == other_point.getX() && getY() == other_point.getY()) {
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return toString().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "(" + getX() + "," + getY() + ")";
+ }
+
+
+}