@Test public void testEquals() { circle1 = new Circle(4); circle2 = new Circle(4); Assert.assertEquals(true, circle1.equals(circle2)); circle1 = new Circle(1, 1, 4); circle2 = new Circle(1, 1, 4); Assert.assertEquals(true, circle1.equals(circle2)); circle1 = new Circle(4); circle2 = new Circle(4.00001f); Assert.assertEquals(false, circle1.equals(circle2)); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Circle other = (Circle) obj; if (Float.floatToIntBits(getX()) != Float.floatToIntBits(other.getX())) return false; if (Float.floatToIntBits(getY()) != Float.floatToIntBits(other.getY())) return false; if (Float.floatToIntBits(getRadius()) != Float.floatToIntBits(other.getRadius())) return false; return true; }
Circle extends Shape { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Circle other = (Circle) obj; if (Float.floatToIntBits(getX()) != Float.floatToIntBits(other.getX())) return false; if (Float.floatToIntBits(getY()) != Float.floatToIntBits(other.getY())) return false; if (Float.floatToIntBits(getRadius()) != Float.floatToIntBits(other.getRadius())) return false; return true; } }
Circle extends Shape { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Circle other = (Circle) obj; if (Float.floatToIntBits(getX()) != Float.floatToIntBits(other.getX())) return false; if (Float.floatToIntBits(getY()) != Float.floatToIntBits(other.getY())) return false; if (Float.floatToIntBits(getRadius()) != Float.floatToIntBits(other.getRadius())) return false; return true; } Circle(Geometry geometry);  Circle(float radius);  Circle(float centerX, float centerY, float radius);  Circle(Circle circle); }
Circle extends Shape { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Circle other = (Circle) obj; if (Float.floatToIntBits(getX()) != Float.floatToIntBits(other.getX())) return false; if (Float.floatToIntBits(getY()) != Float.floatToIntBits(other.getY())) return false; if (Float.floatToIntBits(getRadius()) != Float.floatToIntBits(other.getRadius())) return false; return true; } Circle(Geometry geometry);  Circle(float radius);  Circle(float centerX, float centerY, float radius);  Circle(Circle circle); @Override void dispose(); @Override Shape copy(); Circle lerp(Circle target, float alpha); void lerp(Circle result, Circle target, float alpha); static void lerp(Circle result, Circle from, Circle target, float alpha); @Override boolean contains(Vector2 point); @Override boolean contains(float x, float y); @Override boolean contains(Sizeable shape); boolean contains(Circle circle); boolean contains(Rectangle rectangle); boolean contains(Polygon polygon); @Override boolean intersects(Sizeable shape); @Override boolean intersectsLineSegment(Vector2 pointA, Vector2 pointB); @Override boolean intersectsLineSegment(float x1, float y1, float x2, float y2); @Override float getWidth(); @Override float getHeight(); boolean intersects(Rectangle rectangle); boolean intersects(Circle circle); float getDistanceTo(float x, float y); float getDistanceFromCenter(Vector2 point); float getDistanceFromCenter(float x, float y); @Override int getNumberOfSides(); @Override void draw(Graphics g); @Override void fill(Graphics g); void set(Circle circle); @Override float getX(); @Override float getY(); @Override void setX(float x); @Override void setY(float y); @Override float getCenterX(); @Override float getCenterY(); @Override void setCenter(float x, float y); @Override void setCenterX(float x); @Override void setCenterY(float y); @Override void setXY(float x, float y); @Override float getMinX(); @Override float getMinY(); @Override float getMaxX(); @Override float getMaxY(); float getRadius(); void setRadius(float radius); @Override void scale(float scale); @Override void translate(float translateX, float translateY); @Override EdgeIterator edgeIterator(); Rectangle getBoundingBox(); @Override float getRotation(); @Override void setRotation(float degrees); @Override void setRotationAround(float centerX, float centerY, float degrees); @Override void rotate(float degrees); @Override void rotateAround(float centerX, float centerY, float degrees); @Override boolean isCircle(); @Override Polygon getPolygon(); @Override int hashCode(); @Override boolean equals(Object obj); }
Circle extends Shape { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Circle other = (Circle) obj; if (Float.floatToIntBits(getX()) != Float.floatToIntBits(other.getX())) return false; if (Float.floatToIntBits(getY()) != Float.floatToIntBits(other.getY())) return false; if (Float.floatToIntBits(getRadius()) != Float.floatToIntBits(other.getRadius())) return false; return true; } Circle(Geometry geometry);  Circle(float radius);  Circle(float centerX, float centerY, float radius);  Circle(Circle circle); @Override void dispose(); @Override Shape copy(); Circle lerp(Circle target, float alpha); void lerp(Circle result, Circle target, float alpha); static void lerp(Circle result, Circle from, Circle target, float alpha); @Override boolean contains(Vector2 point); @Override boolean contains(float x, float y); @Override boolean contains(Sizeable shape); boolean contains(Circle circle); boolean contains(Rectangle rectangle); boolean contains(Polygon polygon); @Override boolean intersects(Sizeable shape); @Override boolean intersectsLineSegment(Vector2 pointA, Vector2 pointB); @Override boolean intersectsLineSegment(float x1, float y1, float x2, float y2); @Override float getWidth(); @Override float getHeight(); boolean intersects(Rectangle rectangle); boolean intersects(Circle circle); float getDistanceTo(float x, float y); float getDistanceFromCenter(Vector2 point); float getDistanceFromCenter(float x, float y); @Override int getNumberOfSides(); @Override void draw(Graphics g); @Override void fill(Graphics g); void set(Circle circle); @Override float getX(); @Override float getY(); @Override void setX(float x); @Override void setY(float y); @Override float getCenterX(); @Override float getCenterY(); @Override void setCenter(float x, float y); @Override void setCenterX(float x); @Override void setCenterY(float y); @Override void setXY(float x, float y); @Override float getMinX(); @Override float getMinY(); @Override float getMaxX(); @Override float getMaxY(); float getRadius(); void setRadius(float radius); @Override void scale(float scale); @Override void translate(float translateX, float translateY); @Override EdgeIterator edgeIterator(); Rectangle getBoundingBox(); @Override float getRotation(); @Override void setRotation(float degrees); @Override void setRotationAround(float centerX, float centerY, float degrees); @Override void rotate(float degrees); @Override void rotateAround(float centerX, float centerY, float degrees); @Override boolean isCircle(); @Override Polygon getPolygon(); @Override int hashCode(); @Override boolean equals(Object obj);  }