Class Stat

  • All Implemented Interfaces:
    Comparable<Stat>

    public class Stat
    extends Object
    implements Comparable<Stat>
    This is a primitive class to represent a single statistic, which will generally be a key value pair but with the capabilities for being sorted Note: this class has a natural ordering that is inconsistent with equals
    Author:
    Richard Jones
    • Method Detail

      • setUnits

        public void setUnits​(String unit)
        set the units of this statistic
        Parameters:
        unit - the units that this statistic is measured in
      • getUnits

        public String getUnits()
        get the unts that this statistic is measured in
        Returns:
        the units this statistic is measured in
      • getValue

        public int getValue()
        get the value of the statistic
        Returns:
        the value of this statistic
      • getKey

        public String getKey()
        get the key (text describing) the statistic
        Returns:
        the key for this statistic
      • getReference

        public String getReference()
        get the reference to related statistic information
        Returns:
        the reference for this statistic
      • setKey

        public void setKey​(String key)
        set the reference information
        Parameters:
        key - the key for this statistic
      • setReference

        public void setReference​(String reference)
        set the reference information
        Parameters:
        reference - the reference for this statistic
      • compareTo

        public int compareTo​(Stat stat)
        Compare the current Stat to the given Stat returning -1 if o is less than the current Stat, 0 if they are the same, and +1 if o is greater than the current Stat.
        Specified by:
        compareTo in interface Comparable<Stat>
        Parameters:
        stat - the Stat object to compare to the current one
        Returns:
        +1, 0, -1 if o is less than, equal to, or greater than the current object value.