/** * Tests the entity for equality with an arbitrary object. * * @param obj the object to test against ({@code null} permitted). * * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof PlotEntity)) { return false; } PlotEntity that = (PlotEntity) obj; if (!getArea().equals(that.getArea())) { return false; } if (!ObjectUtils.equal(getToolTipText(), that.getToolTipText())) { return false; } if (!ObjectUtils.equal(getURLText(), that.getURLText())) { return false; } if (!(this.plot.equals(that.plot))) { return false; } return true; }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); setArea(SerialUtils.readShape(stream)); }
/** * Returns a hash code for this instance. * * @return A hash code. */ @Override public int hashCode() { int result = 39; result = HashUtils.hashCode(result, getToolTipText()); result = HashUtils.hashCode(result, getURLText()); return result; }
/** * Provides serialization support. * * @param stream the output stream. * * @throws IOException if there is an I/O error. */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtils.writeShape(getArea(), stream); }
/** * Returns a string representation of the plot entity, useful for * debugging. * * @return A string. */ public String toString() { StringBuffer buf = new StringBuffer("PlotEntity: "); buf.append("tooltip = "); buf.append(getToolTipText()); return buf.toString(); }
/** * Creates a plot entity that contains a reference to the plot and the * data area as shape. * * @param dataArea the data area used as hot spot for the entity. * @param plotState the plot rendering info containing a reference to the * EntityCollection. * @param toolTip the tool tip (defined in the respective Plot * subclass) ({@code null} permitted). * @param urlText the url (defined in the respective Plot subclass) * ({@code null} permitted). * * @since 1.0.13 */ protected void createAndAddEntity(Rectangle2D dataArea, PlotRenderingInfo plotState, String toolTip, String urlText) { if (plotState != null && plotState.getOwner() != null) { EntityCollection e = plotState.getOwner().getEntityCollection(); if (e != null) { e.add(new PlotEntity(dataArea, this, toolTip, urlText)); } } }
/** * Returns a hash code for this instance. * * @return A hash code. */ public int hashCode() { int result = 39; result = HashUtilities.hashCode(result, getToolTipText()); result = HashUtilities.hashCode(result, getURLText()); return result; }
/** * Provides serialization support. * * @param stream the output stream. * * @throws IOException if there is an I/O error. */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtilities.writeShape(getArea(), stream); }
/** * Returns a string representation of the plot entity, useful for * debugging. * * @return A string. */ @Override public String toString() { StringBuilder sb = new StringBuilder("PlotEntity: "); sb.append("tooltip = "); sb.append(getToolTipText()); return sb.toString(); }
/** * Creates a plot entity that contains a reference to the plot and the * data area as shape. * * @param dataArea the data area used as hot spot for the entity. * @param plotState the plot rendering info containing a reference to the * EntityCollection. * @param toolTip the tool tip (defined in the respective Plot * subclass) (<code>null</code> permitted). * @param urlText the url (defined in the respective Plot subclass) * (<code>null</code> permitted). * * @since 1.0.13 */ protected void createAndAddEntity(Rectangle2D dataArea, PlotRenderingInfo plotState, String toolTip, String urlText) { if (plotState != null && plotState.getOwner() != null) { EntityCollection e = plotState.getOwner().getEntityCollection(); if (e != null) { e.add(new PlotEntity(dataArea, this, toolTip, urlText)); } } }
/** * Tests the entity for equality with an arbitrary object. * * @param obj the object to test against (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof PlotEntity)) { return false; } PlotEntity that = (PlotEntity) obj; if (!getArea().equals(that.getArea())) { return false; } if (!ObjectUtilities.equal(getToolTipText(), that.getToolTipText())) { return false; } if (!ObjectUtilities.equal(getURLText(), that.getURLText())) { return false; } if (!(this.plot.equals(that.plot))) { return false; } return true; }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); setArea(SerialUtilities.readShape(stream)); }