From 6fbe6be3fb4e428c0d5abd76503009a1332f6181 Mon Sep 17 00:00:00 2001 From: Duncan Townsend Date: Thu, 29 Jan 2015 00:34:32 -0500 Subject: [PATCH] Added .equals(other) and .hashCode() methods to TargetAddress --- Mage/src/mage/util/TargetAddress.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Mage/src/mage/util/TargetAddress.java b/Mage/src/mage/util/TargetAddress.java index da86a808d6..4774fe21e1 100644 --- a/Mage/src/mage/util/TargetAddress.java +++ b/Mage/src/mage/util/TargetAddress.java @@ -38,7 +38,7 @@ import mage.target.Target; /** - * @author duncancmt + * @author duncant */ public class TargetAddress { protected int spellAbilityIndex; @@ -176,4 +176,15 @@ public class TargetAddress { } return card.getSpellAbility(); } + + public boolean equals(TargetAddress other) { + return spellAbilityIndex == other.spellAbilityIndex + && mode.equals(other.mode) + && targetIndex == other.targetIndex; + } + + @Override + public int hashCode() { + return spellAbilityIndex ^ mode.hashCode() ^ targetIndex; + } }