Skip to content
This repository has been archived by the owner on Sep 27, 2018. It is now read-only.

Commit

Permalink
Issue #92. Fix occurrence equals/hashCode to take game into account.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent Biville committed Feb 16, 2013
1 parent 05f7697 commit e5bafe4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/tv/esporx/domain/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,26 @@ public String getIconUrl() {
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}

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

Game game = (Game) o;

if (description != null ? !description.equals(game.description) : game.description != null) return false;
if (iconUrl != null ? !iconUrl.equals(game.iconUrl) : game.iconUrl != null) return false;
if (title != null ? !title.equals(game.title) : game.title != null) return false;

return true;
}

@Override
public int hashCode() {
int result = description != null ? description.hashCode() : 0;
result = 31 * result + (title != null ? title.hashCode() : 0);
result = 31 * result + (iconUrl != null ? iconUrl.hashCode() : 0);
return result;
}
}
2 changes: 2 additions & 0 deletions src/main/java/tv/esporx/domain/Occurrence.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public boolean equals(final Object obj) {
return equal(startDate, other.startDate) //
&& equal(endDate, other.endDate) //
&& equal(frequencyType, other.frequencyType) //
&& equal(game, other.game) //
&& equal(channels, other.channels);
}

Expand All @@ -198,6 +199,7 @@ public int hashCode() {
result = prime * result + ((startDate == null) ? 0 : startDate.hashCode());
result = prime * result + ((endDate == null) ? 0 : endDate.hashCode());
result = prime * result + ((frequencyType == null) ? 0 : frequencyType.hashCode());
result = prime * result + ((game == null) ? 0 : game.hashCode());
result = prime * result + ((channels == null) ? 0 : channels.hashCode());
return result;
}
Expand Down

0 comments on commit e5bafe4

Please sign in to comment.