package com.poker.analyst.combination;
import java.util.ArrayList;
import java.util.List;
import com.poker.analyst.combinations.auxil.CardRangeInComb;
import com.poker.analyst.combinations.auxil.CardValue;
import com.poker.analyst.element.Card;
import com.poker.analyst.element.CardFace;
import com.poker.analyst.element.Hand;
public class FullHouse extends Combination {
@Override
public Integer getCombinationValue() {
return 6;
}
@Override
public List<CardValue> getCardValues(Hand hand) {
List<CardValue> listCardValues = null;
CardValue cardValue;
Card plCard;
CardFace cface = getMaxValue();
for (int q = 0; q<2 ; q++){
plCard = hand.getHandCards()[q];
if (cface.equals(plCard.getFace())){
if (listCardValues == null) listCardValues = new ArrayList<CardValue>();
cardValue = new CardValue();
cardValue.setCard(plCard);
cardValue.setCardPosition(0);
cardValue.setCardRange(CardRangeInComb.TOP);
listCardValues.add(cardValue);
}
}
cface = getMinValue();
for (int q = 0; q<2 ; q++){
plCard = hand.getHandCards()[q];
if (cface.equals(plCard.getFace())){
if (listCardValues == null) listCardValues = new ArrayList<CardValue>();
cardValue = new CardValue();
cardValue.setCard(plCard);
cardValue.setCardPosition(1);
cardValue.setCardRange(CardRangeInComb.LOW);
listCardValues.add(cardValue);
}
}
return listCardValues;
}
@Override
public CardFace getMaxValue() {
if (this.getCombinationList() != null && this.getCombinationList().size() != 0)
return getCombinationList().get(0).getFace();
else
return null;
}
@Override
public CardFace getMinValue() {
if (this.getCombinationList() != null && this.getCombinationList().size() != 0)
return getCombinationList().get(this.getCombinationList().size() - 1).getFace();
else
return null;
}
public String toString() {
String str = "FullHouse : [ ";
for (Card card : this.getCombinationList())
str += card + " ";
str += "]";
return str;
}
}