Ejemplo n.º 1
0
        public int CompareTo(object obj)
        {
            DiceGroup dg = obj as DiceGroup;

            if (dg == null)
            {
                return(1);
            }
            int compare = Group.CompareTo(dg.Group);

            return((compare == 0) ? GroupNumber.CompareTo(dg.GroupNumber) : compare);
        }
Ejemplo n.º 2
0
        public int CompareTo(Location other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var bookNumberComparison = BookNumber.CompareTo(other.BookNumber);

            if (bookNumberComparison != 0)
            {
                return(bookNumberComparison);
            }
            var sectionNumberComparison = SectionNumber.CompareTo(other.SectionNumber);

            if (sectionNumberComparison != 0)
            {
                return(sectionNumberComparison);
            }

            // Non-exact locations sort after exact ones
            if (!other.Exact)
            {
                return(1);
            }
            if (!Exact)
            {
                return(-1);
            }

            var groupNumberComparison = GroupNumber.CompareTo(other.GroupNumber);

            if (groupNumberComparison != 0)
            {
                return(groupNumberComparison);
            }
            return(WordNumber.CompareTo(other.WordNumber));
        }