/** * Check whether this error object equals to the other error object. The objects are equal if all * their respective fields are equal. * * @param thatErrorObject another error object * @return <b>true</b> if the objects are equal, <b>false</b> otherwise */ public boolean equals(ErrorObject thatErrorObject) { if (m_id != thatErrorObject.m_id) { if ((m_id == null) || (thatErrorObject.m_id == null)) { return false; } if (!m_id.equals(thatErrorObject.m_id)) { return false; } } if (m_severity != thatErrorObject.m_severity) { if ((m_severity == null) || (thatErrorObject.m_severity == null)) { return false; } if (!m_severity.equals(thatErrorObject.m_severity)) { return false; } } if (m_parameters != thatErrorObject.m_parameters) { if ((m_parameters == null) || (thatErrorObject.m_parameters == null)) { return false; } if (!m_parameters.equals(thatErrorObject.m_parameters)) { return false; } } if (m_correlations != thatErrorObject.m_correlations) { if ((m_correlations == null) || (thatErrorObject.m_correlations == null)) { return false; } if (!m_correlations.equals(thatErrorObject.m_correlations)) { return false; } } return true; }
/** * Overrides Object.hashCode() * * @return hash code */ public int hashCode() { int hash = 0; /* * We assume that id and severity * are non-null. * If they are null, then the class invariant is violated and * the NullPointerException will be rightfully thrown. */ hash ^= m_id.hashCode(); hash ^= m_severity.hashCode(); if (m_parameters != null) { hash ^= m_parameters.hashCode(); } if (m_correlations != null) { hash ^= m_correlations.hashCode(); } return hash; }