@Override public int hashCode() { // ignore suit if joker if (rank.equals(PokerRank.JOKER)) { return rank.hashCode(); } else { int result = rank.hashCode(); return 31 * result + (suit != null ? suit.hashCode() : 0); } }
@Override public String toString() { if (this.equals(JOKER)) { return "Joker"; } return rank.toString() + suit.Symbol; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PokerValue that = (PokerValue) o; // ignore suit if joker if (that.rank.equals(PokerRank.JOKER)) { return this.rank.equals(PokerRank.JOKER); } if (!rank.equals(that.rank)) return false; if (suit != that.suit) return false; return true; }