All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
za.co.knowles.pokewhat.domain.lookup.EHand Maven / Gradle / Ivy
package za.co.knowles.pokewhat.domain.lookup;
import za.co.knowles.pokewhat.domain.HandResult;
import za.co.knowles.pokewhat.tie.NOfAKindTieResolver;
import za.co.knowles.pokewhat.tie.HighCardTieResolver;
import za.co.knowles.pokewhat.tie.ITieResolver;
import za.co.knowles.pokewhat.tie.CardComboTieResolver;
import java.util.List;
public enum EHand {
FOUR_OF_A_KIND("4 of a Kind", 3, new NOfAKindTieResolver(4)),
STRAIGHT_FLUSH("Straight Flush", 2, new HighCardTieResolver()),
STRAIGHT("Straight", 6, new HighCardTieResolver()),
FLUSH("Flush", 5, new HighCardTieResolver()),
HIGH_CARD("High Card", 10, new HighCardTieResolver()),
ONE_PAIR("1 Pair", 9, new NOfAKindTieResolver(2)),
TWO_PAIR("2 Pair", 8, new CardComboTieResolver(2, 2)),
ROYAL_FLUSH("Royal Flush", 1),
THREE_OF_KIND("3 of a Kind", 7, new NOfAKindTieResolver(3)),
FULL_HOUSE("Full House", 4, new CardComboTieResolver(3, 2)),
FOLD("Fold", 100);
private final String name;
private final int rank;
private final ITieResolver tieResolver;
EHand(String name, int rank) {
this(name, rank, null);
}
EHand(String name, int rank, ITieResolver tieResolver) {
this.name = name;
this.rank = rank;
this.tieResolver = tieResolver;
}
public String getName() {
return name;
}
public int getRank() {
return rank;
}
public List sortTies(List ties) {
return tieResolver.resolve(ties);
}
}