package fivecardstud;
import java.util.ArrayList;
import java.util.List;

public class Hierarchy {
    
    public Hierarchy() {
}

    Card getHighCard(List<Card> cards){
        Card highCard;
        highCard = cards.get(0);
        for (Card card: cards) {
            if (card.value > highCard.value) highCard = card;
        }
        return highCard;
    }
 
    boolean checkFlush(List<Card> cards){
        Card temp;
        temp = cards.get(0);
        for (Card card: cards) {
            if (!card.suit.equals(temp.suit)) {
                return false;
            }
        }
        return true;
    }
    
    boolean checkStrait(List<Card> cards){
        skipIter = true;
        valueTemp = cardsByValue.get(0);
        for (int value: cardsByValue) {
            // skip first iteration
            if (skipIter == true) {
                skipIter = false;
                continue;
            }
            valueTemp+=1;
            if (valueTemp == value) {
                valueTemp = value;
            } else {
                return false;
            }
        }
        return true;
    }
    
    
    
    // rank hands from 0 being the worst and up to the best
    public int evaluate(List<Card> cards){

        return this.rank;
    }
}

@@ -43,16 +43,46 @@
 ayList;%0A
+import java.util.Collections;%0A
 import j
@@ -155,24 +155,31 @@
 () %7B%0A%7D%0A%0A    
+static 
 Card getHigh
@@ -396,31 +396,41 @@
     %7D%0A %0A    
-boolean
+static List%3CCard%3E
  checkFlush(
@@ -488,32 +488,41 @@
 = cards.get(0);%0A
+        %0A
         for (Car
@@ -601,37 +601,36 @@
          return 
-false
+null
 ;%0A            %7D%0A
@@ -646,36 +646,37 @@
 %0A        return 
-true
+cards
 ;%0A    %7D%0A    %0A   
@@ -680,15 +680,25 @@
     
-boolean
+static List%3CCard%3E
  che
@@ -717,32 +717,77 @@
 t%3CCard%3E cards)%7B%0A
+        boolean skipIter;%0A        Card temp;%0A
         skipIter
@@ -799,30 +799,25 @@
 ue;%0A        
-valueT
+t
 emp = cardsB
@@ -815,23 +815,16 @@
  = cards
-ByValue
 .get(0);
@@ -836,36 +836,103 @@
     
-for (int value: cardsByValue
+%0A        Collections.sort(cards, new ValueComparator());%0A        %0A        for (Card card: cards
 ) %7B%0A
@@ -1081,125 +1081,54 @@
   %7D%0A
-            valueTemp+=1;%0A            if (valueTemp == value) %7B%0A                valueTemp = value;%0A            %7D else
+%0A            if (card.value - temp.value != 1)
  %7B%0A 
@@ -1149,21 +1149,20 @@
  return 
-false
+null
 ;%0A      
@@ -1194,20 +1194,21 @@
  return 
-true
+cards
 ;%0A    %7D%0A

fix Hierarchy.checkStrait