Skip to content

Commit

Permalink
HWKALERTS-67 Add missing fields on equals/hashCode
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce committed Jul 16, 2015
1 parent 9026738 commit 2872c56
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,16 @@ public String getLog() {

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;

CompareConditionEval that = (CompareConditionEval) o;

if (condition != null ? !condition.equals(that.condition) : that.condition != null)
return false;
if (value1 != null ? !value1.equals(that.value1) : that.value1 != null)
return false;
if (value2 != null ? !value2.equals(that.value2) : that.value2 != null)
return false;

return true;
if (condition != null ? !condition.equals(that.condition) : that.condition != null) return false;
if (value1 != null ? !value1.equals(that.value1) : that.value1 != null) return false;
if (value2 != null ? !value2.equals(that.value2) : that.value2 != null) return false;
return !(context2 != null ? !context2.equals(that.context2) : that.context2 != null);
}

@Override
Expand All @@ -144,6 +137,7 @@ public int hashCode() {
result = 31 * result + (condition != null ? condition.hashCode() : 0);
result = 31 * result + (value1 != null ? value1.hashCode() : 0);
result = 31 * result + (value2 != null ? value2.hashCode() : 0);
result = 31 * result + (context2 != null ? context2.hashCode() : 0);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,37 +138,28 @@ public void addProperty(String name, String value) {
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + (int)(timestamp ^ (timestamp >>> 32));
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

Data data = (Data) o;

if (timestamp != data.timestamp) return false;
if (id != null ? !id.equals(data.id) : data.id != null) return false;
if (value != null ? !value.equals(data.value) : data.value != null) return false;
if (type != data.type) return false;
return !(context != null ? !context.equals(data.context) : data.context != null);

}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Data other = (Data)obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (timestamp != other.timestamp)
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (int) (timestamp ^ (timestamp >>> 32));
result = 31 * result + (value != null ? value.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (context != null ? context.hashCode() : 0);
return result;
}

@Override
Expand Down

0 comments on commit 2872c56

Please sign in to comment.