@Test public void testEquals() { Outlier out1 = new Outlier(1.0, 2.0, 3.0); Outlier out2 = new Outlier(1.0, 2.0, 3.0); assertEquals(out1, out2); assertEquals(out2, out1); out1.setPoint(new Point2D.Double(2.0, 2.0)); assertFalse(out1.equals(out2)); out2.setPoint(new Point2D.Double(2.0, 2.0)); assertEquals(out1, out2); out1.setPoint(new Point2D.Double(2.0, 3.0)); assertFalse(out1.equals(out2)); out2.setPoint(new Point2D.Double(2.0, 3.0)); assertEquals(out1, out2); out1.setRadius(4.0); assertFalse(out1.equals(out2)); out2.setRadius(4.0); assertEquals(out1, out2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Outlier)) { return false; } Outlier that = (Outlier) obj; if (!this.point.equals(that.point)) { return false; } if (this.radius != that.radius) { return false; } return true; }
Outlier implements Comparable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Outlier)) { return false; } Outlier that = (Outlier) obj; if (!this.point.equals(that.point)) { return false; } if (this.radius != that.radius) { return false; } return true; } }
Outlier implements Comparable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Outlier)) { return false; } Outlier that = (Outlier) obj; if (!this.point.equals(that.point)) { return false; } if (this.radius != that.radius) { return false; } return true; } Outlier(double xCoord, double yCoord, double radius); }
Outlier implements Comparable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Outlier)) { return false; } Outlier that = (Outlier) obj; if (!this.point.equals(that.point)) { return false; } if (this.radius != that.radius) { return false; } return true; } Outlier(double xCoord, double yCoord, double radius); Point2D getPoint(); void setPoint(Point2D point); double getX(); double getY(); double getRadius(); void setRadius(double radius); @Override int compareTo(Object o); boolean overlaps(Outlier other); @Override boolean equals(Object obj); @Override String toString(); }
Outlier implements Comparable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Outlier)) { return false; } Outlier that = (Outlier) obj; if (!this.point.equals(that.point)) { return false; } if (this.radius != that.radius) { return false; } return true; } Outlier(double xCoord, double yCoord, double radius); Point2D getPoint(); void setPoint(Point2D point); double getX(); double getY(); double getRadius(); void setRadius(double radius); @Override int compareTo(Object o); boolean overlaps(Outlier other); @Override boolean equals(Object obj); @Override String toString();  }