package us.deans.zinc; /** record object > keyTerm (demanded skill), location and count of how many times the keyTerm is listed for the location */ public class ZnDemandRecord implements Comparable{ private String keyTerm; private String location; private int count; public void setKeyTerm(String keyTerm){ this.keyTerm = keyTerm; } public String getKeyTerm(){ return this.keyTerm; } public void setLocation(String location){ this.location = location; } public String getLocation(){ return this.location; } public void setCount(int i) { this.count = i; } public int getCount(){ return this.count; } @Override public int compareTo(Object demandObj) throws ClassCastException{ /** return: negative integer, 0, or positive integer */ if(!(demandObj instanceof ZnDemandRecord)){ throw new ClassCastException("ZnDemandRecord expected."); } int demandCompareCount = ((ZnDemandRecord) demandObj).getCount(); return this.count - demandCompareCount; } }