/** * Indicates whether the specified <code>bounds</code> object is * equal to this BoundingBox object. They are equal if the * specified <code>bounds</code> object is an instance of * BoundingBox and all of the data * members of <code>bounds</code> are equal to the corresponding * data members in this BoundingBox. * @param bounds the object with which the comparison is made. * @return true if this BoundingBox is equal to <code>bounds</code>; * otherwise false * * @since Java 3D 1.2 */ @Override public boolean equals(Object bounds) { try { BoundingBox box = (BoundingBox)bounds; return (lower.equals(box.lower) && upper.equals(box.upper)); } catch (NullPointerException e) { return false; } catch (ClassCastException e) { return false; } }
/** * Indicates whether the specified <code>bounds</code> object is * equal to this BoundingSphere object. They are equal if the * specified <code>bounds</code> object is an instance of * BoundingSphere and all of the data * members of <code>bounds</code> are equal to the corresponding * data members in this BoundingSphere. * @param bounds the object with which the comparison is made. * @return true if this BoundingSphere is equal to <code>bounds</code>; * otherwise false * * @since Java 3D 1.2 */ @Override public boolean equals(Object bounds) { try { BoundingSphere sphere = (BoundingSphere)bounds; return (center.equals(sphere.center) && radius == sphere.radius); } catch (NullPointerException e) { return false; } catch (ClassCastException e) { return false; } }