/* *************************************************************************************** * Copyright (C) 2006 EsperTech, Inc. All rights reserved. * * http://www.espertech.com/esper * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * *************************************************************************************** */ package com.espertech.esper.spatial.quadtree.mxcif; public class XYWHRectangle { protected final double x; protected final double y; protected final double w; protected final double h; public XYWHRectangle(double x, double y, double w, double h) { this.x = x; this.y = y; this.w = w; this.h = h; } public boolean coordinateEquals(double otherX, double otherY, double otherWidth, double otherHeight) { return x == otherX && y == otherY && w == otherWidth && h == otherHeight; } public double getX() { return x; } public double getY() { return y; } public double getW() { return w; } public double getH() { return h; } public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; XYWHRectangle that = (XYWHRectangle) o; if (Double.compare(that.x, x) != 0) return false; if (Double.compare(that.y, y) != 0) return false; if (Double.compare(that.w, w) != 0) return false; return Double.compare(that.h, h) == 0; } public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(x); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(y); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(w); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(h); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; } }