Exemplo n.º 1
0
    public int CompareTo(object obj)
    {
        if (obj == null)
        {
            return(-1);
        }

        OneScoreFromTopTen other = obj as OneScoreFromTopTen;

        if (this.GradeMeAsFloat() > other.GradeMeAsFloat())
        {
            //this grade is higher, automatically makes this precede other in the top ten list
            return(-1);
        }
        else if (this.GradeMeAsFloat() == other.GradeMeAsFloat())
        {
            //grades are the same for this and other
            //if other time is shorter, then other is higher on the top 10 list, this follows other in the top ten list
            if (other.TimeValue < this.TimeValue)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }

        //same by default?
        return(0);
    }