Added hashCode and equal to main server objects

This commit is contained in:
magenoxx 2017-04-20 20:06:52 +03:00
parent 21eb420c16
commit 27a454f042
14 changed files with 614 additions and 31 deletions

View file

@ -83,5 +83,38 @@ public class SimpleCardView implements Serializable {
public boolean isGameObject() {
return gameObject;
}
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final SimpleCardView that = (SimpleCardView) o;
if (getUsesVariousArt() != that.getUsesVariousArt()) return false;
if (isGameObject() != that.isGameObject()) return false;
if (!getId().equals(that.getId())) return false;
if (!getExpansionSetCode().equals(that.getExpansionSetCode())) return false;
if (getTokenSetCode() != null ? !getTokenSetCode().equals(that.getTokenSetCode()) : that
.getTokenSetCode() != null)
return false;
if (getTokenDescriptor() != null ? !getTokenDescriptor().equals(that.getTokenDescriptor()
) : that.getTokenDescriptor() != null)
return false;
return getCardNumber().equals(that.getCardNumber());
}
@Override
public int hashCode() {
int result = getId().hashCode();
result = 31 * result + getExpansionSetCode().hashCode();
result = 31 * result + (getTokenSetCode() != null ? getTokenSetCode().hashCode() : 0);
result = 31 * result + (getTokenDescriptor() != null ? getTokenDescriptor().hashCode() : 0);
result = 31 * result + getCardNumber().hashCode();
result = 31 * result + (getUsesVariousArt() ? 1 : 0);
result = 31 * result + (isGameObject() ? 1 : 0);
return result;
}
}