Package com.poker.analyst.analyser.combanalyzer

Source Code of com.poker.analyst.analyser.combanalyzer.StraightFlushAnalyzer

package com.poker.analyst.analyser.combanalyzer;

import java.util.ArrayList;
import java.util.List;

import com.poker.analyst.combination.Flush;
import com.poker.analyst.combination.FullHouse;
import com.poker.analyst.combination.Pair;
import com.poker.analyst.combination.Straight;
import com.poker.analyst.combination.StraightFlush;
import com.poker.analyst.combination.ThreeOfKind;
import com.poker.analyst.element.Card;

public class StraightFlushAnalyzer {
  public static List<StraightFlush> analyseStraightFlush(List<Flush> flushs, List<Straight> straights){
    List<StraightFlush> straightFlushList = null;
    StraightFlush    straightFlush = null;
   
    if (flushs == null || straights == null)
      return null;
   
    boolean equals;
    for (Flush flush: flushs){
      for (Straight straight: straights){
        equals = true;
        for(int i = 0; i< flush.getCombinationList().size(); i++){
          if (!flush.getCombinationList().get(i).getFace().equals(
              straight.getCombinationList().get(i).getFace())){
            equals = false;
            break;         
          }
        }
        if (equals){
          straightFlush = new StraightFlush();
          straightFlush.setCombinationList(flush.getCombinationList());
          if (straightFlushList == null)
            straightFlushList = new ArrayList<StraightFlush>();
         
          straightFlushList.add(straightFlush);
         
        }
      }
    }
   
   
   
    return straightFlushList;
  }
}
TOP

Related Classes of com.poker.analyst.analyser.combanalyzer.StraightFlushAnalyzer

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.