/*
 * @topic T00885 Using Comparable interface to sort objects
 * @brief class Stats implements Comparable<Stats> - Fall 2014
 */
package hw7demo;

public class Stats implements Comparable<Stats> {
    // data attributes
    private int combination; // 2, 3, 4, ... 12 -- [2, sideCount*2]
    private int rollCount;

    // constructors
    public Stats()
    {
        combination = 0;
        rollCount = 0;
    }
    
    public Stats( int combination, int rollCount )
    {
        this.combination = combination;
        this.rollCount = rollCount;
    }

    // operations
    @Override
    public String toString()
    {
        return combination + ":" + rollCount;
    }
    
    @Override
    public int compareTo( Stats another ) {
        if ( this.rollCount < another.rollCount ) {
            return -1; // this < another
        } else if ( this.rollCount == another.rollCount ) {
            return 0;  // this == another
        } else {
            return 1;  // this > another
        }
    }
    
    public void incrementCount()
    {
        ++rollCount;
    }
}//class Stats