FlowComparator.java [src/java/cfa] Revision: 584e7fe964a63c82a57c1c2693e9bb6fadc00272  Date: Thu Feb 04 15:37:35 MST 2016
package cfa;
import java.util.Comparator;
/**
* Last Updated: 4-February-2016
* @author Tyler Wible
* @since 4-February-2016
*/
public class FlowComparator implements Comparator<String[]>{
    //Compares the second entry of sorted data as flow values and sorts largest to smallest
    public int compare(final String[] entry1, final String[] entry2) {
        double value1 = 0;
        double value2 = 0;
        try{
            value1 = Double.parseDouble(entry1[1]);
            value2 = Double.parseDouble(entry2[1]);
        }catch(NumberFormatException e){
            e.printStackTrace();
        }
        if (value1 > value2){
            return -1;
        }else if (value1 < value2){
            return 1;
        }else{
            return 0;
        }
    }
}