@Test public void testEquals() { Marker m1 = new ValueMarker(45.0); Marker m2 = new ValueMarker(45.0); assertEquals(m1, m2); assertEquals(m2, m1); m1.setPaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.RED)); assertFalse(m1.equals(m2)); m2.setPaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.RED)); assertEquals(m1, m2); BasicStroke stroke = new BasicStroke(2.2f); m1.setStroke(stroke); assertFalse(m1.equals(m2)); m2.setStroke(stroke); assertEquals(m1, m2); m1.setOutlinePaint(new GradientPaint(4.0f, 3.0f, Color.yellow, 2.0f, 1.0f, Color.WHITE)); assertFalse(m1.equals(m2)); m2.setOutlinePaint(new GradientPaint(4.0f, 3.0f, Color.yellow, 2.0f, 1.0f, Color.WHITE)); assertEquals(m1, m2); m1.setOutlineStroke(stroke); assertFalse(m1.equals(m2)); m2.setOutlineStroke(stroke); assertEquals(m1, m2); m1.setAlpha(0.1f); assertFalse(m1.equals(m2)); m2.setAlpha(0.1f); assertEquals(m1, m2); m1.setLabel("New Label"); assertFalse(m1.equals(m2)); m2.setLabel("New Label"); assertEquals(m1, m2); m1.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); assertFalse(m1.equals(m2)); m2.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); assertEquals(m1, m2); m1.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.BLUE, 3.0f, 4.0f, Color.yellow)); assertFalse(m1.equals(m2)); m2.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.BLUE, 3.0f, 4.0f, Color.yellow)); assertEquals(m1, m2); m1.setLabelAnchor(RectangleAnchor.TOP_RIGHT); assertFalse(m1.equals(m2)); m2.setLabelAnchor(RectangleAnchor.TOP_RIGHT); assertEquals(m1, m2); m1.setLabelTextAnchor(TextAnchor.BASELINE_RIGHT); assertFalse(m1.equals(m2)); m2.setLabelTextAnchor(TextAnchor.BASELINE_RIGHT); assertEquals(m1, m2); m1.setLabelOffset(new RectangleInsets(10.0, 10.0, 10.0, 10.0)); assertFalse(m1.equals(m2)); m2.setLabelOffset(new RectangleInsets(10.0, 10.0, 10.0, 10.0)); assertEquals(m1, m2); m1.setLabelOffsetType(LengthAdjustmentType.EXPAND); assertFalse(m1.equals(m2)); m2.setLabelOffsetType(LengthAdjustmentType.EXPAND); assertEquals(m1, m2); m1 = new ValueMarker(12.3); m2 = new ValueMarker(45.6); assertFalse(m1.equals(m2)); m2 = new ValueMarker(12.3); assertEquals(m1, m2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof ValueMarker)) { return false; } ValueMarker that = (ValueMarker) obj; if (this.value != that.value) { return false; } return true; }
ValueMarker extends Marker { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof ValueMarker)) { return false; } ValueMarker that = (ValueMarker) obj; if (this.value != that.value) { return false; } return true; } }
ValueMarker extends Marker { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof ValueMarker)) { return false; } ValueMarker that = (ValueMarker) obj; if (this.value != that.value) { return false; } return true; } ValueMarker(double value);  ValueMarker(double value, Paint paint, Stroke stroke);  ValueMarker(double value, Paint paint, Stroke stroke,
                       Paint outlinePaint, Stroke outlineStroke, float alpha); }
ValueMarker extends Marker { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof ValueMarker)) { return false; } ValueMarker that = (ValueMarker) obj; if (this.value != that.value) { return false; } return true; } ValueMarker(double value);  ValueMarker(double value, Paint paint, Stroke stroke);  ValueMarker(double value, Paint paint, Stroke stroke,
                       Paint outlinePaint, Stroke outlineStroke, float alpha); double getValue(); void setValue(double value); @Override boolean equals(Object obj); }
ValueMarker extends Marker { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof ValueMarker)) { return false; } ValueMarker that = (ValueMarker) obj; if (this.value != that.value) { return false; } return true; } ValueMarker(double value);  ValueMarker(double value, Paint paint, Stroke stroke);  ValueMarker(double value, Paint paint, Stroke stroke,
                       Paint outlinePaint, Stroke outlineStroke, float alpha); double getValue(); void setValue(double value); @Override boolean equals(Object obj);  }