mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Added hashCode and equal to main server objects
This commit is contained in:
parent
21eb420c16
commit
27a454f042
14 changed files with 614 additions and 31 deletions
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.view;
|
||||
|
||||
import java.util.*;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Abilities;
|
||||
|
@ -51,6 +50,8 @@ import mage.game.stack.StackAbility;
|
|||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -1028,4 +1029,180 @@ public class CardView extends SimpleCardView {
|
|||
public boolean isTribal() {
|
||||
return cardTypes.contains(CardType.TRIBAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final CardView cardView = (CardView) o;
|
||||
|
||||
if (getConvertedManaCost() != cardView.getConvertedManaCost()) return false;
|
||||
if (isAbility() != cardView.isAbility()) return false;
|
||||
if (isToken() != cardView.isToken()) return false;
|
||||
if (getType() != cardView.getType()) return false;
|
||||
if (transformable != cardView.transformable) return false;
|
||||
if (isTransformed() != cardView.isTransformed()) return false;
|
||||
if (isFlipCard() != cardView.isFlipCard()) return false;
|
||||
if (isFaceDown() != cardView.isFaceDown()) return false;
|
||||
if (isSplitCard() != cardView.isSplitCard()) return false;
|
||||
if (isPaid() != cardView.isPaid()) return false;
|
||||
if (isControlledByOwner() != cardView.isControlledByOwner()) return false;
|
||||
if (rotate != cardView.rotate) return false;
|
||||
if (hideInfo != cardView.hideInfo) return false;
|
||||
if (isPlayable() != cardView.isPlayable()) return false;
|
||||
if (isChoosable() != cardView.isChoosable()) return false;
|
||||
if (isSelected() != cardView.isSelected()) return false;
|
||||
if (isCanAttack() != cardView.isCanAttack()) return false;
|
||||
if (getParentId() != null ? !getParentId().equals(cardView.getParentId()) : cardView
|
||||
.getParentId() != null)
|
||||
return false;
|
||||
if (getName() != null ? !getName().equals(cardView.getName()) : cardView.getName() != null)
|
||||
return false;
|
||||
if (getDisplayName() != null ? !getDisplayName().equals(cardView.getDisplayName()) :
|
||||
cardView.getDisplayName() != null)
|
||||
return false;
|
||||
if (getRules() != null ? !getRules().equals(cardView.getRules()) : cardView.getRules() !=
|
||||
null)
|
||||
return false;
|
||||
if (getPower() != null ? !getPower().equals(cardView.getPower()) : cardView.getPower() !=
|
||||
null)
|
||||
return false;
|
||||
if (getToughness() != null ? !getToughness().equals(cardView.getToughness()) : cardView
|
||||
.getToughness() != null)
|
||||
return false;
|
||||
if (getLoyalty() != null ? !getLoyalty().equals(cardView.getLoyalty()) : cardView
|
||||
.getLoyalty() != null)
|
||||
return false;
|
||||
if (getStartingLoyalty() != null ? !getStartingLoyalty().equals(cardView
|
||||
.getStartingLoyalty()) : cardView.getStartingLoyalty() != null)
|
||||
return false;
|
||||
if (getCardTypes() != null ? !getCardTypes().equals(cardView.getCardTypes()) : cardView
|
||||
.getCardTypes() != null)
|
||||
return false;
|
||||
if (getSubTypes() != null ? !getSubTypes().equals(cardView.getSubTypes()) : cardView
|
||||
.getSubTypes() != null)
|
||||
return false;
|
||||
if (getSuperTypes() != null ? !getSuperTypes().equals(cardView.getSuperTypes()) :
|
||||
cardView.getSuperTypes() != null)
|
||||
return false;
|
||||
if (getColor() != null ? !getColor().equals(cardView.getColor()) : cardView.getColor() !=
|
||||
null)
|
||||
return false;
|
||||
if (getFrameColor() != null ? !getFrameColor().equals(cardView.getFrameColor()) :
|
||||
cardView.getFrameColor() != null)
|
||||
return false;
|
||||
if (getFrameStyle() != cardView.getFrameStyle()) return false;
|
||||
if (getManaCost() != null ? !getManaCost().equals(cardView.getManaCost()) : cardView
|
||||
.getManaCost() != null)
|
||||
return false;
|
||||
if (getRarity() != cardView.getRarity()) return false;
|
||||
if (getMageObjectType() != cardView.getMageObjectType()) return false;
|
||||
if (getAbilityType() != cardView.getAbilityType()) return false;
|
||||
if (isAbility() != cardView.isAbility())
|
||||
return false;
|
||||
if (getSecondCardFace() != null ? !getSecondCardFace().equals(cardView.getSecondCardFace
|
||||
()) : cardView.getSecondCardFace() != null)
|
||||
return false;
|
||||
if (getAlternateName() != null ? !getAlternateName().equals(cardView.getAlternateName())
|
||||
: cardView.getAlternateName() != null)
|
||||
return false;
|
||||
if (getOriginalName() != null ? !getOriginalName().equals(cardView.getOriginalName()) :
|
||||
cardView.getOriginalName() != null)
|
||||
return false;
|
||||
if (getLeftSplitName() != null ? !getLeftSplitName().equals(cardView.getLeftSplitName())
|
||||
: cardView.getLeftSplitName() != null)
|
||||
return false;
|
||||
if (getLeftSplitCosts() != null ? !getLeftSplitCosts().equals(cardView.getLeftSplitCosts
|
||||
()) : cardView.getLeftSplitCosts() != null)
|
||||
return false;
|
||||
if (getLeftSplitRules() != null ? !getLeftSplitRules().equals(cardView.getLeftSplitRules
|
||||
()) : cardView.getLeftSplitRules() != null)
|
||||
return false;
|
||||
if (getLeftSplitTypeLine() != null ? !getLeftSplitTypeLine().equals(cardView
|
||||
.getLeftSplitTypeLine()) : cardView.getLeftSplitTypeLine() != null)
|
||||
return false;
|
||||
if (getRightSplitName() != null ? !getRightSplitName().equals(cardView.getRightSplitName
|
||||
()) : cardView.getRightSplitName() != null)
|
||||
return false;
|
||||
if (getRightSplitCosts() != null ? !getRightSplitCosts().equals(cardView
|
||||
.getRightSplitCosts()) : cardView.getRightSplitCosts() != null)
|
||||
return false;
|
||||
if (getRightSplitRules() != null ? !getRightSplitRules().equals(cardView
|
||||
.getRightSplitRules()) : cardView.getRightSplitRules() != null)
|
||||
return false;
|
||||
if (getRightSplitTypeLine() != null ? !getRightSplitTypeLine().equals(cardView
|
||||
.getRightSplitTypeLine()) : cardView.getRightSplitTypeLine() != null)
|
||||
return false;
|
||||
if (getArtRect() != cardView.getArtRect()) return false;
|
||||
if (getTargets() != null ? !getTargets().equals(cardView.getTargets()) : cardView
|
||||
.getTargets() != null)
|
||||
return false;
|
||||
if (getPairedCard() != null ? !getPairedCard().equals(cardView.getPairedCard()) :
|
||||
cardView.getPairedCard() != null)
|
||||
return false;
|
||||
if (getCounters() != null ? !getCounters().equals(cardView.getCounters()) : cardView
|
||||
.getCounters() != null)
|
||||
return false;
|
||||
return getZone() == cardView.getZone();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = getParentId() != null ? getParentId().hashCode() : 0;
|
||||
result = 31 * result + (getName() != null ? getName().hashCode() : 0);
|
||||
result = 31 * result + (getDisplayName() != null ? getDisplayName().hashCode() : 0);
|
||||
result = 31 * result + (getRules() != null ? getRules().hashCode() : 0);
|
||||
result = 31 * result + (getPower() != null ? getPower().hashCode() : 0);
|
||||
result = 31 * result + (getToughness() != null ? getToughness().hashCode() : 0);
|
||||
result = 31 * result + (getLoyalty() != null ? getLoyalty().hashCode() : 0);
|
||||
result = 31 * result + (getStartingLoyalty() != null ? getStartingLoyalty().hashCode() : 0);
|
||||
result = 31 * result + (getCardTypes() != null ? getCardTypes().hashCode() : 0);
|
||||
result = 31 * result + (getSubTypes() != null ? getSubTypes().hashCode() : 0);
|
||||
result = 31 * result + (getSuperTypes() != null ? getSuperTypes().hashCode() : 0);
|
||||
result = 31 * result + (getColor() != null ? getColor().hashCode() : 0);
|
||||
result = 31 * result + (getFrameColor() != null ? getFrameColor().hashCode() : 0);
|
||||
result = 31 * result + (getFrameStyle() != null ? getFrameStyle().hashCode() : 0);
|
||||
result = 31 * result + (getManaCost() != null ? getManaCost().hashCode() : 0);
|
||||
result = 31 * result + getConvertedManaCost();
|
||||
result = 31 * result + (getRarity() != null ? getRarity().hashCode() : 0);
|
||||
result = 31 * result + (getMageObjectType() != null ? getMageObjectType().hashCode() : 0);
|
||||
result = 31 * result + (isAbility() ? 1 : 0);
|
||||
result = 31 * result + (getAbilityType() != null ? getAbilityType().hashCode() : 0);
|
||||
result = 31 * result + (isToken() ? 1 : 0);
|
||||
result = 31 * result + (isAbility() ? 1 : 0);
|
||||
result = 31 * result + getType();
|
||||
result = 31 * result + (transformable ? 1 : 0);
|
||||
result = 31 * result + (getSecondCardFace() != null ? getSecondCardFace().hashCode() : 0);
|
||||
result = 31 * result + (isTransformed() ? 1 : 0);
|
||||
result = 31 * result + (isFlipCard() ? 1 : 0);
|
||||
result = 31 * result + (isFaceDown() ? 1 : 0);
|
||||
result = 31 * result + (getAlternateName() != null ? getAlternateName().hashCode() : 0);
|
||||
result = 31 * result + (getOriginalName() != null ? getOriginalName().hashCode() : 0);
|
||||
result = 31 * result + (isSplitCard() ? 1 : 0);
|
||||
result = 31 * result + (getLeftSplitName() != null ? getLeftSplitName().hashCode() : 0);
|
||||
result = 31 * result + (getLeftSplitCosts() != null ? getLeftSplitCosts().hashCode() : 0);
|
||||
result = 31 * result + (getLeftSplitRules() != null ? getLeftSplitRules().hashCode() : 0);
|
||||
result = 31 * result + (getLeftSplitTypeLine() != null ? getLeftSplitTypeLine().hashCode
|
||||
() : 0);
|
||||
result = 31 * result + (getRightSplitName() != null ? getRightSplitName().hashCode() : 0);
|
||||
result = 31 * result + (getRightSplitCosts() != null ? getRightSplitCosts().hashCode() : 0);
|
||||
result = 31 * result + (getRightSplitRules() != null ? getRightSplitRules().hashCode() : 0);
|
||||
result = 31 * result + (getRightSplitTypeLine() != null ? getRightSplitTypeLine().hashCode() : 0);
|
||||
result = 31 * result + (getArtRect() != null ? getArtRect().hashCode() : 0);
|
||||
result = 31 * result + (getTargets() != null ? getTargets().hashCode() : 0);
|
||||
result = 31 * result + (getPairedCard() != null ? getPairedCard().hashCode() : 0);
|
||||
result = 31 * result + (isPaid() ? 1 : 0);
|
||||
result = 31 * result + (getCounters() != null ? getCounters().hashCode() : 0);
|
||||
result = 31 * result + (isControlledByOwner() ? 1 : 0);
|
||||
result = 31 * result + (getZone() != null ? getZone().hashCode() : 0);
|
||||
result = 31 * result + (rotate ? 1 : 0);
|
||||
result = 31 * result + (hideInfo ? 1 : 0);
|
||||
result = 31 * result + (isPlayable() ? 1 : 0);
|
||||
result = 31 * result + (isChoosable() ? 1 : 0);
|
||||
result = 31 * result + (isSelected() ? 1 : 0);
|
||||
result = 31 * result + (isCanAttack() ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
*/
|
||||
package mage.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -45,6 +40,8 @@ import mage.game.permanent.PermanentToken;
|
|||
import mage.target.targetpointer.TargetPointer;
|
||||
import mage.util.GameLog;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
|
@ -89,4 +89,27 @@ public class CombatGroupView implements Serializable {
|
|||
public UUID getDefenderId() {
|
||||
return defenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final CombatGroupView that = (CombatGroupView) o;
|
||||
|
||||
if (!getAttackers().equals(that.getAttackers())) return false;
|
||||
if (!getBlockers().equals(that.getBlockers())) return false;
|
||||
if (!getDefenderName().equals(that.getDefenderName())) return false;
|
||||
return getDefenderId().equals(that.getDefenderId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = getAttackers().hashCode();
|
||||
result = 31 * result + getBlockers().hashCode();
|
||||
result = 31 * result + getDefenderName().hashCode();
|
||||
result = 31 * result + getDefenderId().hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package mage.view;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.game.command.Emblem;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.cards.Card;
|
||||
import mage.game.command.Emblem;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
|
@ -54,4 +55,31 @@ public class EmblemView implements CommandObjectView, Serializable {
|
|||
public List<String> getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final EmblemView that = (EmblemView) o;
|
||||
|
||||
if (!getId().equals(that.getId())) return false;
|
||||
if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null)
|
||||
return false;
|
||||
if (getExpansionSetCode() != null ? !getExpansionSetCode().equals(that
|
||||
.getExpansionSetCode()) : that.getExpansionSetCode() != null)
|
||||
return false;
|
||||
return getRules() != null ? getRules().equals(that.getRules()) : that.getRules() == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = getId().hashCode();
|
||||
result = 31 * result + (getName() != null ? getName().hashCode() : 0);
|
||||
result = 31 * result + (getExpansionSetCode() != null ? getExpansionSetCode().hashCode()
|
||||
: 0);
|
||||
result = 31 * result + (getRules() != null ? getRules().hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,11 +28,12 @@
|
|||
|
||||
package mage.view;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.cards.Card;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -59,4 +60,24 @@ public class ExileView extends CardsView {
|
|||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
|
||||
final ExileView exileView = (ExileView) o;
|
||||
|
||||
if (!getName().equals(exileView.getName())) return false;
|
||||
return getId().equals(exileView.getId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + getName().hashCode();
|
||||
result = 31 * result + getId().hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
*/
|
||||
package mage.view;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.cards.Card;
|
||||
|
@ -55,6 +49,9 @@ import mage.players.Player;
|
|||
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -63,7 +60,7 @@ public class GameView implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(GameView.class);
|
||||
private transient static final Logger LOGGER = Logger.getLogger(GameView.class);
|
||||
|
||||
private final int priorityTime;
|
||||
private final List<PlayerView> players = new ArrayList<>();
|
||||
|
|
|
@ -57,4 +57,23 @@ public class LookedAtView implements Serializable {
|
|||
public SimpleCardsView getCards() {
|
||||
return cards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final LookedAtView that = (LookedAtView) o;
|
||||
|
||||
if (!getName().equals(that.getName())) return false;
|
||||
return getCards().equals(that.getCards());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = getName().hashCode();
|
||||
result = 31 * result + getCards().hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
*/
|
||||
package mage.view;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.ConditionalMana;
|
||||
import mage.players.ManaPool;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -87,4 +88,30 @@ public class ManaPoolView implements Serializable {
|
|||
return colorless;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final ManaPoolView that = (ManaPoolView) o;
|
||||
|
||||
if (getRed() != that.getRed()) return false;
|
||||
if (getGreen() != that.getGreen()) return false;
|
||||
if (getBlue() != that.getBlue()) return false;
|
||||
if (getWhite() != that.getWhite()) return false;
|
||||
if (getBlack() != that.getBlack()) return false;
|
||||
return getColorless() == that.getColorless();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = getRed();
|
||||
result = 31 * result + getGreen();
|
||||
result = 31 * result + getBlue();
|
||||
result = 31 * result + getWhite();
|
||||
result = 31 * result + getBlack();
|
||||
result = 31 * result + getColorless();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
*/
|
||||
package mage.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.TurnFaceUpAbility;
|
||||
import mage.cards.Card;
|
||||
|
@ -38,6 +35,10 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentToken;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -214,4 +215,55 @@ public class PermanentView extends CardView {
|
|||
public boolean isManifested() {
|
||||
return manifested;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
|
||||
final PermanentView that = (PermanentView) o;
|
||||
|
||||
if (isTapped() != that.isTapped()) return false;
|
||||
if (isFlipped() != that.isFlipped()) return false;
|
||||
if (isPhasedIn() != that.isPhasedIn()) return false;
|
||||
if (summoningSickness != that.summoningSickness) return false;
|
||||
if (getDamage() != that.getDamage()) return false;
|
||||
if (isCopy() != that.isCopy()) return false;
|
||||
if (isControlled() != that.isControlled()) return false;
|
||||
if (isMorphed() != that.isMorphed()) return false;
|
||||
if (isManifested() != that.isManifested()) return false;
|
||||
if (isAttachedToPermanent() != that.isAttachedToPermanent()) return false;
|
||||
if (getAttachments() != null ? !getAttachments().equals(that.getAttachments()) : that
|
||||
.getAttachments() != null)
|
||||
return false;
|
||||
if (getOriginal() != null ? !getOriginal().equals(that.getOriginal()) : that.getOriginal
|
||||
() != null)
|
||||
return false;
|
||||
if (getNameOwner() != null ? !getNameOwner().equals(that.getNameOwner()) : that
|
||||
.getNameOwner() != null)
|
||||
return false;
|
||||
return isAttachedTo() == that.isAttachedTo();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + (isTapped() ? 1 : 0);
|
||||
result = 31 * result + (isFlipped() ? 1 : 0);
|
||||
result = 31 * result + (isPhasedIn() ? 1 : 0);
|
||||
result = 31 * result + (summoningSickness ? 1 : 0);
|
||||
result = 31 * result + getDamage();
|
||||
result = 31 * result + (getAttachments() != null ? getAttachments().hashCode() : 0);
|
||||
result = 31 * result + (getOriginal() != null ? getOriginal().hashCode() : 0);
|
||||
result = 31 * result + (isCopy() ? 1 : 0);
|
||||
result = 31 * result + (getNameOwner() != null ? getNameOwner().hashCode() : 0);
|
||||
result = 31 * result + (isControlled() ? 1 : 0);
|
||||
result = 31 * result + (isAttachedTo() ? 1 : 0);
|
||||
result = 31 * result + (isMorphed() ? 1 : 0);
|
||||
result = 31 * result + (isManifested() ? 1 : 0);
|
||||
result = 31 * result + (isAttachedToPermanent() ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,14 +27,6 @@
|
|||
*/
|
||||
package mage.view;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.counters.Counters;
|
||||
import mage.game.ExileZone;
|
||||
|
@ -47,6 +39,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.players.net.UserData;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -305,4 +300,88 @@ public class PlayerView implements Serializable {
|
|||
return monarch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final PlayerView that = (PlayerView) o;
|
||||
|
||||
if (getLife() != that.getLife()) return false;
|
||||
if (getWins() != that.getWins()) return false;
|
||||
if (getWinsNeeded() != that.getWinsNeeded()) return false;
|
||||
if (getDeckHashCode() != that.getDeckHashCode()) return false;
|
||||
if (getLibraryCount() != that.getLibraryCount()) return false;
|
||||
if (getHandCount() != that.getHandCount()) return false;
|
||||
if (isActive() != that.isActive()) return false;
|
||||
if (hasPriority != that.hasPriority) return false;
|
||||
if (isTimerActive() != that.isTimerActive()) return false;
|
||||
if (hasLeft != that.hasLeft) return false;
|
||||
if (getStatesSavedSize() != that.getStatesSavedSize()) return false;
|
||||
if (getPriorityTimeLeft() != that.getPriorityTimeLeft()) return false;
|
||||
if (isPassedTurn() != that.isPassedTurn()) return false;
|
||||
if (isPassedUntilEndOfTurn() != that.isPassedUntilEndOfTurn()) return false;
|
||||
if (isPassedUntilNextMain() != that.isPassedUntilNextMain()) return false;
|
||||
if (isPassedUntilStackResolved() != that.isPassedUntilStackResolved()) return false;
|
||||
if (isPassedAllTurns() != that.isPassedAllTurns()) return false;
|
||||
if (isPassedUntilEndStepBeforeMyTurn() != that.isPassedUntilEndStepBeforeMyTurn())
|
||||
return false;
|
||||
if (isMonarch() != that.isMonarch()) return false;
|
||||
if (!getPlayerId().equals(that.getPlayerId())) return false;
|
||||
if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null)
|
||||
return false;
|
||||
if (getCounters() != null ? !getCounters().equals(that.getCounters()) : that.getCounters
|
||||
() != null)
|
||||
return false;
|
||||
if (getManaPool() != null ? !getManaPool().equals(that.getManaPool()) : that.getManaPool
|
||||
() != null)
|
||||
return false;
|
||||
if (!getGraveyard().equals(that.getGraveyard())) return false;
|
||||
if (!getExile().equals(that.getExile())) return false;
|
||||
if (!getBattlefield().equals(that.getBattlefield())) return false;
|
||||
if (getTopCard() != null ? !getTopCard().equals(that.getTopCard()) : that.getTopCard() !=
|
||||
null)
|
||||
return false;
|
||||
if (getUserData() != null ? !getUserData().equals(that.getUserData()) : that.getUserData
|
||||
() != null)
|
||||
return false;
|
||||
if (!commandList.equals(that.commandList)) return false;
|
||||
return getAttachments().equals(that.getAttachments());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = getPlayerId().hashCode();
|
||||
result = 31 * result + (getName() != null ? getName().hashCode() : 0);
|
||||
result = 31 * result + getLife();
|
||||
result = 31 * result + (getCounters() != null ? getCounters().hashCode() : 0);
|
||||
result = 31 * result + getWins();
|
||||
result = 31 * result + getWinsNeeded();
|
||||
result = 31 * result + (int) (getDeckHashCode() ^ (getDeckHashCode() >>> 32));
|
||||
result = 31 * result + getLibraryCount();
|
||||
result = 31 * result + getHandCount();
|
||||
result = 31 * result + (isActive() ? 1 : 0);
|
||||
result = 31 * result + (hasPriority ? 1 : 0);
|
||||
result = 31 * result + (isTimerActive() ? 1 : 0);
|
||||
result = 31 * result + (hasLeft ? 1 : 0);
|
||||
result = 31 * result + (getManaPool() != null ? getManaPool().hashCode() : 0);
|
||||
result = 31 * result + getGraveyard().hashCode();
|
||||
result = 31 * result + getExile().hashCode();
|
||||
result = 31 * result + getBattlefield().hashCode();
|
||||
result = 31 * result + (getTopCard() != null ? getTopCard().hashCode() : 0);
|
||||
result = 31 * result + (getUserData() != null ? getUserData().hashCode() : 0);
|
||||
result = 31 * result + commandList.hashCode();
|
||||
result = 31 * result + getAttachments().hashCode();
|
||||
result = 31 * result + getStatesSavedSize();
|
||||
result = 31 * result + getPriorityTimeLeft();
|
||||
result = 31 * result + (isPassedTurn() ? 1 : 0);
|
||||
result = 31 * result + (isPassedUntilEndOfTurn() ? 1 : 0);
|
||||
result = 31 * result + (isPassedUntilNextMain() ? 1 : 0);
|
||||
result = 31 * result + (isPassedUntilStackResolved() ? 1 : 0);
|
||||
result = 31 * result + (isPassedAllTurns() ? 1 : 0);
|
||||
result = 31 * result + (isPassedUntilEndStepBeforeMyTurn() ? 1 : 0);
|
||||
result = 31 * result + (isMonarch() ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,10 @@
|
|||
*/
|
||||
package mage.players.net;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.constants.PhaseStep;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
@ -119,5 +120,33 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,4 +263,73 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,4 +88,36 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue