/** * Compares the specified object with this parameter group for equality. * * @param object The object to compare to {@code this}. * @param compareMetadata {@code true} for performing a strict comparaison, or {@code false} for * comparing only properties relevant to transformations. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final AbstractIdentifiedObject object, final boolean compareMetadata) { if (object == this) { // Slight optimization return true; } if (super.equals(object, compareMetadata)) { final DefaultParameterDescriptorGroup that = (DefaultParameterDescriptorGroup) object; return Arrays.equals(this.parameters, that.parameters); } return false; }
/** * Returns a hash value for this parameter. * * @return The hash code value. This value doesn't need to be the same in past or future * versions of this class. */ @Override @SuppressWarnings("PMD.OverrideBothEqualsAndHashcode") public int hashCode() { int code = super.hashCode(); // TODO: We should use Arrays.deepHashCode instead in J2SE 1.5. for (int i = 0; i < parameters.length; i++) { code = code * 37 + parameters[i].hashCode(); } return code; } }
/** * Returns a hash value for this parameter. * * @return The hash code value. This value doesn't need to be the same in past or future * versions of this class. */ @Override @SuppressWarnings("PMD.OverrideBothEqualsAndHashcode") public int hashCode() { int code = super.hashCode() * 37 + valueClass.hashCode(); if (defaultValue != null) code += (37) * defaultValue.hashCode(); if (minimum != null) code += (37 * 37) * minimum.hashCode(); if (maximum != null) code += (37 * 37 * 37) * maximum.hashCode(); if (unit != null) code += unit.hashCode(); return code; } }
return true; if (super.equals(object, compareMetadata)) { if (!compareMetadata) {