< prev index next >

src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java

Print this page

        

*** 2925,2948 **** raster.getHeight(), x, y, band); } /** ! * Compares this color model with another for equality. ! * ! * @param obj The object to compare with this color model. ! * @return {@code true} if the color model objects are equal, ! * {@code false} if they are not. */ public boolean equals(Object obj) { ! if (!super.equals(obj)) { ! return false; } ! if (obj.getClass() != getClass()) { return false; } - return true; } } --- 2925,2964 ---- raster.getHeight(), x, y, band); } /** ! * Tests if the specified {@code Object} is an instance ! * of {@code ComponentColorModel} and equals this ! * {@code ComponentColorModel}. ! * @param obj the {@code Object} to test for equality ! * @return {@code true} if the specified {@code Object} ! * is an instance of {@code ComponentColorModel} and equals this ! * {@code ComponentColorModel}; {@code false} otherwise. */ + @Override public boolean equals(Object obj) { ! ! ComponentColorModel cm = (ComponentColorModel) obj; ! if (this == cm) { ! return true; } ! if (!super.equals(obj)) { return false; } return true; } + /** + * Returns the hash code for this ComponentColorModel. + * + * @return a hash code for this ComponentColorModel. + */ + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + super.hashCode(); + return hash; + } + }
< prev index next >