01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2003, Refractions Reserach Inc.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.graph.util.geom;
18:
19: public class Coordinate2D {
20: public double x;
21: public double y;
22:
23: public Coordinate2D(double x, double y) {
24: this .x = x;
25: this .y = y;
26: }
27:
28: public boolean equals(Object obj) {
29: if (obj instanceof Coordinate2D) {
30: Coordinate2D other = (Coordinate2D) obj;
31: return (x == other.x && y == other.y);
32: }
33: return (false);
34: }
35:
36: public int hashCode() {
37: long v = Double.doubleToLongBits(x + y);
38: return ((int) (v ^ (v >>> 32)));
39: }
40: }
|