Examples of FullHouse


Examples of com.poker.analyst.combination.FullHouse

import com.poker.analyst.element.Card;

public class FullHouseAnalyzer {
  public static List<FullHouse> analyseFullHouse(List<Pair> pairs, List<ThreeOfKind> threeOfKind){
    List<FullHouse> fullHouses = new ArrayList<FullHouse>();;
    FullHouse fullHouse;
    List<Card>       combinationList;
   
    if (threeOfKind == null)
      return null;
    if (pairs == null && threeOfKind.size() < 2)
      return null;
   
    Set<Card> allCards = new TreeSet<Card>(new CardComparator());
    if (pairs != null)
      for (Pair pair: pairs)
        allCards.add(pair.getCombinationList().get(0));
    for (ThreeOfKind three: threeOfKind)
      allCards.add(three.getCombinationList().get(0));
     
   
    for (ThreeOfKind three: threeOfKind){
      for (Card card: allCards){
        if (card.getFace().equals(three.getMinValue()))
          continue;
        if (pairs != null)
          for (Pair pair: pairs)
            if (card.getFace().equals(pair.getMinValue())){
              combinationList = new ArrayList<Card>()
              combinationList.addAll(three.getCombinationList());
              combinationList.addAll(pair.getCombinationList());
             
              fullHouse = new FullHouse();
              fullHouse.setCombinationList(combinationList);
              fullHouses.add(fullHouse)
              break;
            }
        for (ThreeOfKind three2: threeOfKind)
          if (card.getFace().equals(three2.getMinValue())){
            combinationList = new ArrayList<Card>()
            combinationList.addAll(three.getCombinationList());
            combinationList.addAll(three2.getCombinationList());
            combinationList.remove(combinationList.size() - 1);
           
            fullHouse = new FullHouse();
            fullHouse.setCombinationList(combinationList);           
            fullHouses.add(fullHouse)
           
            continue;
          }       
      }
View Full Code Here
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.