Package com.poker.analyst.combination

Source Code of com.poker.analyst.combination.StraightFlush

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;
import com.poker.analyst.element.Suit;

public class StraightFlush extends Combination {

    @Override
    public Integer getCombinationValue() {

        return 8;
    }

    public Suit getSuit() {
      if (this.getCombinationList() != null && this.getCombinationList().size() != 0)       
        return getCombinationList().get(0).getSuit();
      return null;
    }

  @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 = "StraightFlush of \"" + getSuit() + "\":  [ ";
       
    for (Card card : this.getCombinationList())
      str += card + " ";
   
    str += "]";
        return str;
    }
  @Override
  public List<CardValue> getCardValues(Hand hand) {
    List<CardValue> listCardValues = null;
    CardValue cardValue;
    Card plCard;
    Card cardFromList;
     
    List<Card> listCardComb = getCombinationList();
    CardFace cface = getMinValue();
    for (int i = 0; i< listCardComb.size(); i++){
      cardFromList = listCardComb.get(i);
      for (int q = 0; q<2 ; q++){
        plCard = hand.getHandCards()[q];
        if (cardFromList.equals(plCard)){
          if (listCardValues == null) listCardValues = new ArrayList<CardValue>();
          cardValue = new CardValue();
          cardValue.setCard(plCard);
          cardValue.setCardPosition(i);
          cardValue.setCardRange(CardRangeInComb.TOP);
          listCardValues.add(cardValue);
        }
      } 
    }
   
    return updateCardsRang(listCardValues);
 
 
 
 
}
TOP

Related Classes of com.poker.analyst.combination.StraightFlush

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.