@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof Float32Bounds)) { return false; } if (obj == this) { return true; } Float32Bounds other = (Float32Bounds) obj; if (other.isNull() && this.isNull()) return true; if (other.isNull() != this.isNull()) return false; return other.xmin == this.xmin && other.ymin == this.ymin && other.xmax == this.xmax && other.ymax == this.ymax; }
@Override public int hashCode() { if (isNull()) return 1; return Float.floatToRawIntBits(xmin) ^ Float.floatToRawIntBits(ymin) ^ Float.floatToRawIntBits(xmax) ^ Float.floatToRawIntBits(ymax); }
public @Override Optional<Envelope> bounds() { return fromNullable(bounds.isNull() ? null : bounds.asEnvelope()); }
public Envelope asEnvelope() { if (isNull()) return new Envelope(); return new Envelope(xmin, xmax, ymin, ymax); }
@Override public Optional<Envelope> bounds() { return fromNullable(boundsInternal().isNull() ? null : boundsInternal().asEnvelope()); }
public boolean intersects(Envelope env) { if (isNull() || env.isNull()) { return false; } // make the intersects check here matching the logic in Envelope and avoid creating lots of // Envelope objects since this method is going to be called for each Node in a tree // traversal return !(env.getMinX() > xmax || // env.getMaxX() < xmin || // env.getMinY() > ymax || // env.getMaxY() < ymin); }
public void expand(Envelope env) { if (isNull()) return; env.expandToInclude(xmin, ymin); env.expandToInclude(xmax, ymax); Float32Bounds newEnv = Float32Bounds.valueOf(env); Envelope float32Version = newEnv.asEnvelope(); env.init(float32Version); }