From 5767486e8317c22eee028606c49f2a4a8909de3c Mon Sep 17 00:00:00 2001 From: Bennet Gerlach Date: Mon, 9 May 2011 21:56:29 +0200 Subject: Test simple dropping on Hand git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@198 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/model/Position.java | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/jrummikub') diff --git a/src/jrummikub/model/Position.java b/src/jrummikub/model/Position.java index 35cf45e..7396120 100644 --- a/src/jrummikub/model/Position.java +++ b/src/jrummikub/model/Position.java @@ -6,6 +6,7 @@ package jrummikub.model; */ public class Position { + private float x; private float y; @@ -13,9 +14,9 @@ public class Position { * Create a new position by specifying the coordinates * * @param x - * x coordinate + * x coordinate * @param y - * y coordinate + * y coordinate */ public Position(float x, float y) { this.x = x; @@ -45,4 +46,29 @@ public class Position { return "Position[x=" + x + ",y=" + y + "]"; } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Position other = (Position) obj; + if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x)) + return false; + if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Float.floatToIntBits(x); + result = prime * result + Float.floatToIntBits(y); + return result; + } + } -- cgit v1.2.3