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 ThreeOfKind extends Combination {
@Override
public Integer getCombinationValue() {
return 3;
}
@Override
public List<CardValue> getCardValues(Hand hand) {
List<CardValue> listCardValues = null;
CardValue cardValue;
Card plCard;
CardFace 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(0);
cardValue.setCardRange(CardRangeInComb.TOP);
listCardValues.add(cardValue);
}
}
return listCardValues;
}
@Override
public String toString() {
String str = "3ofKind of " + getMinValue() + ": [ ";
for (Card card : this.getCombinationList())
str += card + " ";
str += "]";
return str;
}
@Override
public CardFace getMinValue() {
if (getCombinationList() != null && getCombinationList().size() != 0)
return getCombinationList().get(0).getFace();
else
return null;
}
@Override
public CardFace getMaxValue() {
return getMinValue();
}
}