/** * Tests the series for equality with another object. * * @param obj the object (<code>null</code> permitted). * * @return <code>true</code> or <code>false</code>. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Series)) { return false; } Series that = (Series) obj; if (!getKey().equals(that.getKey())) { return false; } if (!ObjectUtilities.equal(getDescription(), that.getDescription())) { return false; } return true; }
/** * Tests the series for equality with another object. * * @param obj the object ({@code null} permitted). * * @return {@code true} or {@code false}. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Series)) { return false; } Series that = (Series) obj; if (!getKey().equals(that.getKey())) { return false; } if (!ObjectUtils.equal(getDescription(), that.getDescription())) { return false; } return true; }
/** * Receives notification that the key for one of the series in the * collection has changed, and vetos it if the key is already present in * the collection. * * @param e the event. * * @since 1.0.17 */ @Override public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException { // if it is not the series name, then we have no interest if (!"Key".equals(e.getPropertyName())) { return; } // to be defensive, let's check that the source series does in fact // belong to this collection Series s = (Series) e.getSource(); if (getSeriesIndex(s.getKey()) == -1) { throw new IllegalStateException("Receiving events from a series " + "that does not belong to this collection."); } // check if the new series name already exists for another series Comparable key = (Comparable) e.getNewValue(); if (getSeriesIndex(key) >= 0) { throw new PropertyVetoException("Duplicate key2", e); } }
/** * Receives notification that the key for one of the series in the * collection has changed, and vetos it if the key is already present in * the collection. * * @param e the event. * * @since 1.0.14 */ @Override public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException { // if it is not the series name, then we have no interest if (!"Key".equals(e.getPropertyName())) { return; } // to be defensive, let's check that the source series does in fact // belong to this collection Series s = (Series) e.getSource(); if (getSeriesIndex(s.getKey()) == -1) { throw new IllegalStateException("Receiving events from a series " + "that does not belong to this collection."); } // check if the new series name already exists for another series Comparable key = (Comparable) e.getNewValue(); if (getSeriesIndex(key) >= 0) { throw new PropertyVetoException("Duplicate key2", e); } }