class Series implements Comparable{ String ID; String Title; int StartYear; int EndYear; int Span; int drawRow; Series(String _ID, String _Title, int _StartYear, int _EndYear){ //println("made a series"); ID = _ID; Title = _Title; StartYear = _StartYear; EndYear = _EndYear; Span = EndYear - StartYear; // span in years drawRow = 0; // the row location where the series will be drawn } int getSpan(){ return Span; } int getStart(){ return StartYear; } public int compareTo(Object anotherSeries) { //if (!(anotherSeries instanceof Series)) throw new ClassCastException("A Series object expected."); int anotherSeriesStart = ((Series) anotherSeries).getStart(); return this.getStart() - anotherSeriesStart; // return negative if this is earlier } }