Revert "Added hashCode and equal to main server objects"

This reverts commit 27a454f042.
This commit is contained in:
magenoxx 2017-04-21 20:43:32 +03:00
parent 5d2c210d36
commit ee7026f71d
14 changed files with 31 additions and 614 deletions

View file

@ -27,9 +27,8 @@
*/
package mage.players.net;
import mage.constants.PhaseStep;
import java.io.Serializable;
import mage.constants.PhaseStep;
/**
*
@ -120,33 +119,5 @@ public class SkipPrioritySteps implements Serializable {
return true;
}
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final SkipPrioritySteps that = (SkipPrioritySteps) o;
if (isUpkeep() != that.isUpkeep()) return false;
if (isDraw() != that.isDraw()) return false;
if (isMain1() != that.isMain1()) return false;
if (isBeforeCombat() != that.isBeforeCombat()) return false;
if (isEndOfCombat() != that.isEndOfCombat()) return false;
if (isMain2() != that.isMain2()) return false;
return isEndOfTurn() == that.isEndOfTurn();
}
@Override
public int hashCode() {
int result = (isUpkeep() ? 1 : 0);
result = 31 * result + (isDraw() ? 1 : 0);
result = 31 * result + (isMain1() ? 1 : 0);
result = 31 * result + (isBeforeCombat() ? 1 : 0);
result = 31 * result + (isEndOfCombat() ? 1 : 0);
result = 31 * result + (isMain2() ? 1 : 0);
result = 31 * result + (isEndOfTurn() ? 1 : 0);
return result;
}
}

View file

@ -263,73 +263,4 @@ public class UserData implements Serializable {
public static String getDefaultFlagName() {
return "world.png";
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final UserData userData = (UserData) o;
if (getGroupId() != userData.getGroupId()) return false;
if (getAvatarId() != userData.getAvatarId()) return false;
if (isShowAbilityPickerForced() != userData.isShowAbilityPickerForced()) return false;
if (isAllowRequestShowHandCards() != userData.isAllowRequestShowHandCards()) return false;
if (confirmEmptyManaPool != userData.confirmEmptyManaPool) return false;
if (askMoveToGraveOrder != userData.askMoveToGraveOrder) return false;
if (isManaPoolAutomatic() != userData.isManaPoolAutomatic()) return false;
if (isManaPoolAutomaticRestricted() != userData.isManaPoolAutomaticRestricted())
return false;
if (isPassPriorityCast() != userData.isPassPriorityCast()) return false;
if (isPassPriorityActivation() != userData.isPassPriorityActivation()) return false;
if (isAutoOrderTrigger() != userData.isAutoOrderTrigger()) return false;
if (isUseFirstManaAbility() != userData.isUseFirstManaAbility()) return false;
if (getMatchQuitRatio() != userData.getMatchQuitRatio()) return false;
if (getTourneyQuitRatio() != userData.getTourneyQuitRatio()) return false;
if (getGeneralRating() != userData.getGeneralRating()) return false;
if (getConstructedRating() != userData.getConstructedRating()) return false;
if (getLimitedRating() != userData.getLimitedRating()) return false;
if (getUserSkipPrioritySteps() != null ? !getUserSkipPrioritySteps().equals(userData
.getUserSkipPrioritySteps()) : userData.getUserSkipPrioritySteps() != null)
return false;
if (getFlagName() != null ? !getFlagName().equals(userData.getFlagName()) : userData
.getFlagName() != null)
return false;
if (userIdStr != null ? !userIdStr.equals(userData.userIdStr) : userData.userIdStr != null)
return false;
if (getMatchHistory() != null ? !getMatchHistory().equals(userData.getMatchHistory()) :
userData.getMatchHistory() != null)
return false;
return getTourneyHistory() != null ? getTourneyHistory().equals(userData
.getTourneyHistory()) : userData.getTourneyHistory() == null;
}
@Override
public int hashCode() {
int result = getGroupId();
result = 31 * result + getAvatarId();
result = 31 * result + (isShowAbilityPickerForced() ? 1 : 0);
result = 31 * result + (isAllowRequestShowHandCards() ? 1 : 0);
result = 31 * result + (confirmEmptyManaPool ? 1 : 0);
result = 31 * result + (getUserSkipPrioritySteps() != null ? getUserSkipPrioritySteps()
.hashCode() : 0);
result = 31 * result + (getFlagName() != null ? getFlagName().hashCode() : 0);
result = 31 * result + (askMoveToGraveOrder ? 1 : 0);
result = 31 * result + (isManaPoolAutomatic() ? 1 : 0);
result = 31 * result + (isManaPoolAutomaticRestricted() ? 1 : 0);
result = 31 * result + (isPassPriorityCast() ? 1 : 0);
result = 31 * result + (isPassPriorityActivation() ? 1 : 0);
result = 31 * result + (isAutoOrderTrigger() ? 1 : 0);
result = 31 * result + (isUseFirstManaAbility() ? 1 : 0);
result = 31 * result + (userIdStr != null ? userIdStr.hashCode() : 0);
result = 31 * result + (getMatchHistory() != null ? getMatchHistory().hashCode() : 0);
result = 31 * result + getMatchQuitRatio();
result = 31 * result + (getTourneyHistory() != null ? getTourneyHistory().hashCode() : 0);
result = 31 * result + getTourneyQuitRatio();
result = 31 * result + getGeneralRating();
result = 31 * result + getConstructedRating();
result = 31 * result + getLimitedRating();
return result;
}
}

View file

@ -88,36 +88,4 @@ public class UserSkipPrioritySteps implements Serializable {
this.stopOnAllEndPhases = stopOnAllEndPhases;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final UserSkipPrioritySteps that = (UserSkipPrioritySteps) o;
if (isStopOnDeclareAttackersDuringSkipAction() != that
.isStopOnDeclareAttackersDuringSkipAction())
return false;
if (isStopOnDeclareBlockerIfNoneAvailable() != that.isStopOnDeclareBlockerIfNoneAvailable())
return false;
if (isStopOnAllMainPhases() != that.isStopOnAllMainPhases()) return false;
if (isStopOnAllEndPhases() != that.isStopOnAllEndPhases()) return false;
if (getYourTurn() != null ? !getYourTurn().equals(that.getYourTurn()) : that.getYourTurn
() != null)
return false;
return getOpponentTurn() != null ? getOpponentTurn().equals(that.getOpponentTurn()) :
that.getOpponentTurn() == null;
}
@Override
public int hashCode() {
int result = getYourTurn() != null ? getYourTurn().hashCode() : 0;
result = 31 * result + (getOpponentTurn() != null ? getOpponentTurn().hashCode() : 0);
result = 31 * result + (isStopOnDeclareAttackersDuringSkipAction() ? 1 : 0);
result = 31 * result + (isStopOnDeclareBlockerIfNoneAvailable() ? 1 : 0);
result = 31 * result + (isStopOnAllMainPhases() ? 1 : 0);
result = 31 * result + (isStopOnAllEndPhases() ? 1 : 0);
return result;
}
}