@Test public void testEquals() { Crosshair c1 = new Crosshair(1.0, Color.BLUE, new BasicStroke(1.0f)); Crosshair c2 = new Crosshair(1.0, Color.BLUE, new BasicStroke(1.0f)); assertEquals(c1, c1); assertEquals(c2, c1); c1.setVisible(false); assertFalse(c1.equals(c2)); c2.setVisible(false); assertEquals(c1, c2); c1.setValue(2.0); assertFalse(c1.equals(c2)); c2.setValue(2.0); assertEquals(c1, c2); c1.setPaint(Color.RED); assertFalse(c1.equals(c2)); c2.setPaint(Color.RED); assertEquals(c1, c2); c1.setStroke(new BasicStroke(1.1f)); assertFalse(c1.equals(c2)); c2.setStroke(new BasicStroke(1.1f)); assertEquals(c1, c2); c1.setLabelVisible(true); assertFalse(c1.equals(c2)); c2.setLabelVisible(true); assertEquals(c1, c2); c1.setLabelAnchor(RectangleAnchor.TOP_LEFT); assertFalse(c1.equals(c2)); c2.setLabelAnchor(RectangleAnchor.TOP_LEFT); assertEquals(c1, c2); c1.setLabelGenerator(new StandardCrosshairLabelGenerator("Value = {0}", NumberFormat.getNumberInstance())); assertFalse(c1.equals(c2)); c2.setLabelGenerator(new StandardCrosshairLabelGenerator("Value = {0}", NumberFormat.getNumberInstance())); assertEquals(c1, c2); c1.setLabelXOffset(11); assertFalse(c1.equals(c2)); c2.setLabelXOffset(11); assertEquals(c1, c2); c1.setLabelYOffset(22); assertFalse(c1.equals(c2)); c2.setLabelYOffset(22); assertEquals(c1, c2); c1.setLabelFont(new Font("Dialog", Font.PLAIN, 8)); assertFalse(c1.equals(c2)); c2.setLabelFont(new Font("Dialog", Font.PLAIN, 8)); assertEquals(c1, c2); c1.setLabelPaint(Color.RED); assertFalse(c1.equals(c2)); c2.setLabelPaint(Color.RED); assertEquals(c1, c2); c1.setLabelBackgroundPaint(Color.yellow); assertFalse(c1.equals(c2)); c2.setLabelBackgroundPaint(Color.yellow); assertEquals(c1, c2); c1.setLabelOutlineVisible(false); assertFalse(c1.equals(c2)); c2.setLabelOutlineVisible(false); assertEquals(c1, c2); c1.setLabelOutlineStroke(new BasicStroke(2.0f)); assertFalse(c1.equals(c2)); c2.setLabelOutlineStroke(new BasicStroke(2.0f)); assertEquals(c1, c2); c1.setLabelOutlinePaint(Color.darkGray); assertFalse(c1.equals(c2)); c2.setLabelOutlinePaint(Color.darkGray); assertEquals(c1, c2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Crosshair)) { return false; } Crosshair that = (Crosshair) obj; if (this.visible != that.visible) { return false; } if (this.value != that.value) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.stroke.equals(that.stroke)) { return false; } if (this.labelVisible != that.labelVisible) { return false; } if (!this.labelGenerator.equals(that.labelGenerator)) { return false; } if (!this.labelAnchor.equals(that.labelAnchor)) { return false; } if (this.labelXOffset != that.labelXOffset) { return false; } if (this.labelYOffset != that.labelYOffset) { return false; } if (!this.labelFont.equals(that.labelFont)) { return false; } if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) { return false; } if (!PaintUtilities.equal(this.labelBackgroundPaint, that.labelBackgroundPaint)) { return false; } if (this.labelOutlineVisible != that.labelOutlineVisible) { return false; } if (!PaintUtilities.equal(this.labelOutlinePaint, that.labelOutlinePaint)) { return false; } if (!this.labelOutlineStroke.equals(that.labelOutlineStroke)) { return false; } return true; }
Crosshair implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Crosshair)) { return false; } Crosshair that = (Crosshair) obj; if (this.visible != that.visible) { return false; } if (this.value != that.value) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.stroke.equals(that.stroke)) { return false; } if (this.labelVisible != that.labelVisible) { return false; } if (!this.labelGenerator.equals(that.labelGenerator)) { return false; } if (!this.labelAnchor.equals(that.labelAnchor)) { return false; } if (this.labelXOffset != that.labelXOffset) { return false; } if (this.labelYOffset != that.labelYOffset) { return false; } if (!this.labelFont.equals(that.labelFont)) { return false; } if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) { return false; } if (!PaintUtilities.equal(this.labelBackgroundPaint, that.labelBackgroundPaint)) { return false; } if (this.labelOutlineVisible != that.labelOutlineVisible) { return false; } if (!PaintUtilities.equal(this.labelOutlinePaint, that.labelOutlinePaint)) { return false; } if (!this.labelOutlineStroke.equals(that.labelOutlineStroke)) { return false; } return true; } }
Crosshair implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Crosshair)) { return false; } Crosshair that = (Crosshair) obj; if (this.visible != that.visible) { return false; } if (this.value != that.value) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.stroke.equals(that.stroke)) { return false; } if (this.labelVisible != that.labelVisible) { return false; } if (!this.labelGenerator.equals(that.labelGenerator)) { return false; } if (!this.labelAnchor.equals(that.labelAnchor)) { return false; } if (this.labelXOffset != that.labelXOffset) { return false; } if (this.labelYOffset != that.labelYOffset) { return false; } if (!this.labelFont.equals(that.labelFont)) { return false; } if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) { return false; } if (!PaintUtilities.equal(this.labelBackgroundPaint, that.labelBackgroundPaint)) { return false; } if (this.labelOutlineVisible != that.labelOutlineVisible) { return false; } if (!PaintUtilities.equal(this.labelOutlinePaint, that.labelOutlinePaint)) { return false; } if (!this.labelOutlineStroke.equals(that.labelOutlineStroke)) { return false; } return true; } Crosshair();  Crosshair(double value);  Crosshair(double value, Paint paint, Stroke stroke); }
Crosshair implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Crosshair)) { return false; } Crosshair that = (Crosshair) obj; if (this.visible != that.visible) { return false; } if (this.value != that.value) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.stroke.equals(that.stroke)) { return false; } if (this.labelVisible != that.labelVisible) { return false; } if (!this.labelGenerator.equals(that.labelGenerator)) { return false; } if (!this.labelAnchor.equals(that.labelAnchor)) { return false; } if (this.labelXOffset != that.labelXOffset) { return false; } if (this.labelYOffset != that.labelYOffset) { return false; } if (!this.labelFont.equals(that.labelFont)) { return false; } if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) { return false; } if (!PaintUtilities.equal(this.labelBackgroundPaint, that.labelBackgroundPaint)) { return false; } if (this.labelOutlineVisible != that.labelOutlineVisible) { return false; } if (!PaintUtilities.equal(this.labelOutlinePaint, that.labelOutlinePaint)) { return false; } if (!this.labelOutlineStroke.equals(that.labelOutlineStroke)) { return false; } return true; } Crosshair();  Crosshair(double value);  Crosshair(double value, Paint paint, Stroke stroke); boolean isVisible(); void setVisible(boolean visible); double getValue(); void setValue(double value); Paint getPaint(); void setPaint(Paint paint); Stroke getStroke(); void setStroke(Stroke stroke); boolean isLabelVisible(); void setLabelVisible(boolean visible); CrosshairLabelGenerator getLabelGenerator(); void setLabelGenerator(CrosshairLabelGenerator generator); RectangleAnchor getLabelAnchor(); void setLabelAnchor(RectangleAnchor anchor); double getLabelXOffset(); void setLabelXOffset(double offset); double getLabelYOffset(); void setLabelYOffset(double offset); Font getLabelFont(); void setLabelFont(Font font); Paint getLabelPaint(); void setLabelPaint(Paint paint); Paint getLabelBackgroundPaint(); void setLabelBackgroundPaint(Paint paint); boolean isLabelOutlineVisible(); void setLabelOutlineVisible(boolean visible); Paint getLabelOutlinePaint(); void setLabelOutlinePaint(Paint paint); Stroke getLabelOutlineStroke(); void setLabelOutlineStroke(Stroke stroke); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); void addPropertyChangeListener(PropertyChangeListener l); void removePropertyChangeListener(PropertyChangeListener l); }
Crosshair implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Crosshair)) { return false; } Crosshair that = (Crosshair) obj; if (this.visible != that.visible) { return false; } if (this.value != that.value) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.stroke.equals(that.stroke)) { return false; } if (this.labelVisible != that.labelVisible) { return false; } if (!this.labelGenerator.equals(that.labelGenerator)) { return false; } if (!this.labelAnchor.equals(that.labelAnchor)) { return false; } if (this.labelXOffset != that.labelXOffset) { return false; } if (this.labelYOffset != that.labelYOffset) { return false; } if (!this.labelFont.equals(that.labelFont)) { return false; } if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) { return false; } if (!PaintUtilities.equal(this.labelBackgroundPaint, that.labelBackgroundPaint)) { return false; } if (this.labelOutlineVisible != that.labelOutlineVisible) { return false; } if (!PaintUtilities.equal(this.labelOutlinePaint, that.labelOutlinePaint)) { return false; } if (!this.labelOutlineStroke.equals(that.labelOutlineStroke)) { return false; } return true; } Crosshair();  Crosshair(double value);  Crosshair(double value, Paint paint, Stroke stroke); boolean isVisible(); void setVisible(boolean visible); double getValue(); void setValue(double value); Paint getPaint(); void setPaint(Paint paint); Stroke getStroke(); void setStroke(Stroke stroke); boolean isLabelVisible(); void setLabelVisible(boolean visible); CrosshairLabelGenerator getLabelGenerator(); void setLabelGenerator(CrosshairLabelGenerator generator); RectangleAnchor getLabelAnchor(); void setLabelAnchor(RectangleAnchor anchor); double getLabelXOffset(); void setLabelXOffset(double offset); double getLabelYOffset(); void setLabelYOffset(double offset); Font getLabelFont(); void setLabelFont(Font font); Paint getLabelPaint(); void setLabelPaint(Paint paint); Paint getLabelBackgroundPaint(); void setLabelBackgroundPaint(Paint paint); boolean isLabelOutlineVisible(); void setLabelOutlineVisible(boolean visible); Paint getLabelOutlinePaint(); void setLabelOutlinePaint(Paint paint); Stroke getLabelOutlineStroke(); void setLabelOutlineStroke(Stroke stroke); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); void addPropertyChangeListener(PropertyChangeListener l); void removePropertyChangeListener(PropertyChangeListener l);  }