PokerGroup类
斗地主的所有牌型的定义类
public enum PokerGroup {
Unvalid("未知", 0),
Single("单", 1),
Duad("对", 1),
Three("三", 1),
StraightFlush("顺", 1),
StraightFlush2("对顺", 1),
StraightFlush3("飞机", 1),
StraightFlush3WithSingle("飞机带单", 1),
StraightFlush3WithDuad("飞机带对", 1),
ThreeWithSingle("三带一单", 1),
ThreeWithDuad("三带一对", 1),
FourWithSingle2("四带两单", 1),
FourWithDuad2("四带两对", 1),
Bomb("炸弹", 2),
Rocket("火箭", 3);
// 成员变量
private String name;
private Integer index;
// 构造方法
private PokerGroup(String name, Integer index) {
this.name = name;
this.index = index;
}
// 普通方法
public static String getName(Integer index) {
for (PokerGroup c : PokerGroup.values()) {
if (c.getIndex() == index) {
return c.name;
}
}
return null;
}
// get set 方法
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}