www.pudn.com > GMapViewer-src.zip > XYZ.java



package org.sreid.j2me.gmapviewer;

/** Represents x,y,z coordinates (z == zoom). This identifies a single map tile. */
class XYZ {
	final int x;
	final int y;
	final int z;

	XYZ(int x, int y, int z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}

	public boolean equals(Object o) {
		if (o == this) return true;
		if (o == null || !(o instanceof XYZ)) return false;
		XYZ xyz = (XYZ)o;
		return xyz.x == x && xyz.y == y && xyz.z == z;
	}

	public int hashCode() {
		return x*2357 + y*257 + z*101;
	}

	public String toString() {
		return "XYZ[" + x + "," + y + "," + z + "]";
	}

}