class SeriesSquare extends Series{ int dimension; float _x; float _y; SeriesSquare(String _ID, String _Title, int[] _Dates, int _Items, float _Metres, String[][] _Links, ArrayList ParentList){ super(_ID, _Title, _Dates, _Items, _Metres, _Links, ParentList); // call the superclass constructor dimension = 1 + int(sqrt(Metres)*sq_scale); _x = 0; _y = 0; } public int compareTo(Object anotherSeries) { //if (sort_by == 2){ int anotherSeriesDim = ((SeriesSquare) anotherSeries).dimension; return anotherSeriesDim - this.dimension; // } } } class DimComparator implements Comparator{ int compare(Object O1, Object O2){ SeriesSquare S1 = (SeriesSquare) O1; SeriesSquare S2 = (SeriesSquare) O2; int comp = (S2.dimension - S1.dimension); return comp; } }