示例#1
0
    public int CompareTo(object obj)
    {
        int result = obj is Problem other ?
                     (!difficulty.Equals(other.difficulty) ?
                      difficulty.CompareTo(other.difficulty)
            : number.CompareTo(other.number)) :
                     0;

        return(result);
    }
示例#2
0
    public int CompareTo(ScoreEntry other)
    {
        int comp = score.CompareTo(other.score);

        switch (comp)
        {
        case 0:
            comp = name.CompareTo(other.name);
            switch (comp)
            {
            case 0:
                comp = difficulty.CompareTo(other.difficulty);
                switch (comp)
                {
                case 0:
                    comp = kills.CompareTo(other.kills);
                    switch (comp)
                    {
                    case 0:
                        comp = -timeTaken.CompareTo(other.timeTaken);
                        switch (comp)
                        {
                        case 0:                     // basically impossible
                            if (Tools.Tools.Coinflip())
                            {
                                return(1);
                            }
                            return(-1);

                        default:
                            return(-timeTaken.CompareTo(other.timeTaken));                    // more time -> higher up
                        }

                    default:
                        return(-comp);                // more kills -> higher up
                    }

                default:
                    return(comp);            // higher difficulty -> higher up
                }

            default:
                return(comp);        // earlyer name -> higher up
            }

        default:
            return(-comp);    // higher score -> higher up
        }
    }
示例#3
0
        /// <summary>
        /// Compares this skill with another.
        /// </summary>
        /// <param name="rhs">The other skill.</param>
        /// <returns>Returns -1 if this skill should be sorted before the other, +1 if the other should be sorted before this skill, 0 otherwise.</returns>
        public int CompareTo(SkillChallengeData rhs)
        {
            int result = fSkillName.CompareTo(rhs.SkillName);

            if (result == 0)
            {
                result = fDifficulty.CompareTo(rhs.Difficulty);
            }

            if (result == 0)
            {
                result = fDCModifier.CompareTo(rhs.DCModifier);
            }

            return(result);
        }