another simplification

This commit is contained in:
digitalsanctum 2012-11-27 21:29:31 -05:00
parent 2b56393f0a
commit 4953d6c8e2
1 changed files with 2 additions and 29 deletions

View File

@ -401,39 +401,12 @@ public class Task extends Entity {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
Task that = Task.class.cast(o); Task that = Task.class.cast(o);
return super.equals(that) && return super.equals(that) && equal(this.getHref(), that.getHref());
equal(this.error, that.error) && equal(this.org, that.org) &&
equal(this.progress, that.progress) && equal(this.status, that.status) &&
equal(this.operation, that.operation) && equal(this.operationName, that.operationName) &&
datesEqual(this.startTime, that.startTime) &&
datesEqual(this.endTime, that.endTime) &&
datesEqual(this.expiryTime, that.expiryTime);
}
private boolean datesEqual(Date date1, Date date2) {
Date cDate1 = null;
if (date1 != null) {
Calendar c1 = Calendar.getInstance();
c1.setTime(date1);
c1.clear(Calendar.MILLISECOND);
cDate1 = c1.getTime();
}
Date cDate2 = null;
if (date2 != null) {
Calendar c2 = Calendar.getInstance();
c2.setTime(date2);
c2.clear(Calendar.MILLISECOND);
cDate2 = c2.getTime();
}
return equal(cDate1, cDate2);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), error, org, progress, status, operation, operationName, return Objects.hashCode(super.hashCode(), getHref());
startTime, endTime, expiryTime);
} }
@Override @Override