Added .equals(other) and .hashCode() methods to TargetAddress

This commit is contained in:
Duncan Townsend 2015-01-29 00:34:32 -05:00
parent 601e442208
commit 6fbe6be3fb
No known key found for this signature in database
GPG key ID: C00ECDF315F7A593

View file

@ -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;
}
}