package agents.anac.y2015.group2; import java.util.ArrayList; class G2SubBid implements Comparable{ ArrayList values; double ourUtility; ArrayList otherUtilities; public G2SubBid(String value, double ourUtility, ArrayList otherUtilities) { values = new ArrayList(1); values.add(value); this.ourUtility = ourUtility; this.otherUtilities = otherUtilities; } public G2SubBid(G2SubBid one, G2SubBid two) { values = new ArrayList(one.values.size() + two.values.size()); values.addAll(one.values); values.addAll(two.values); ourUtility = one.ourUtility + two.ourUtility; otherUtilities = new ArrayList(one.otherUtilities.size()); for(int i=0; i other.ourUtility) return 1; else if(ourUtility == other.ourUtility) return 0; else return -1; } public boolean hasHigherOtherUtilities(G2SubBid other) { if(other == null) return true; for(int i=otherUtilities.size()-1; i>=0; i--) { if(otherUtilities.get(i) > other.otherUtilities.get(i) + 0.00001) return true; } return false; } }