/* * @topic T00889 Using Comparable interface Fall 2015 * @brief class Stats implements Comparable<Stats> - Fall 2015 */ package diceroll; public class Stats implements Comparable< Stats > { // data attributes private int combination; // 2, 3, 4, ... 12 -- [2, sideCount*2] private int rollCount; // constructor public Stats( int combination, int rollCount ) { this.combination = combination; this.rollCount = rollCount; } // operations public int getCombination() { return combination; } public int getRollCount() { return rollCount; } @Override public int compareTo( Stats anotherStats ) { if ( getRollCount() < anotherStats.getRollCount() ) return -1; if ( getRollCount() > anotherStats.getRollCount() ) return +1; return 0; } }//class Stats