package geniusweb.exampleparties.anaconda; import java.util.Comparator; import geniusweb.issuevalue.Value; public class impUnit { public Value valueOfIssue; public int victories = 0; public int total_count = 0; public double probability = 0.0f; public impUnit(Value value) { this.valueOfIssue = value; } public String toString() { return String.format("%s %f", valueOfIssue, probability); } // Overriding the comparator interface static class meanWeightSumComparator implements Comparator { public int compare(impUnit o1, impUnit o2) { if (o1.probability < o2.probability) { return 1; } else if (o1.probability > o2.probability) { return -1; } return 0; } } // Overriding the comparator interface static class impSumComparator implements Comparator { public int compare(impUnit o1, impUnit o2) { if (o1.total_count < o2.total_count) { return 1; } else if (o1.total_count > o2.total_count) { return -1; } return 0; } } }