示例#1
0
        public static int OnSort(SpeedInterval left, SpeedInterval right)
        {
            int result = left.mWorld.CompareTo(right.mWorld);
            if (result != 0) return result;

            // These are intentionally inversed (larger numbers to the top)
            result = right.mDays.Count.CompareTo(left.mDays.Count);
            if (result != 0) return result;

            DaysOfTheWeek leftDay = DaysOfTheWeek.None;
            foreach (DaysOfTheWeek day in left.mDays)
            {
                if (leftDay < day)
                {
                    leftDay = day;
                }
            }

            DaysOfTheWeek rightDay = DaysOfTheWeek.None;
            foreach (DaysOfTheWeek day in right.mDays)
            {
                if (rightDay < day)
                {
                    rightDay = day;
                }
            }

            result = leftDay.CompareTo(rightDay);
            if (result != 0) return result;

            result = left.mStartHour.CompareTo(right.mStartHour);
            if (result != 0) return result;

            return 0;
        }
示例#2
0
        public void Add(SpeedInterval interval)
        {
            mIntervals.Add(interval);

            mIntervals.Sort(new Comparison <SpeedInterval>(SpeedInterval.OnSort));

            ResetSpeeds();
        }
示例#3
0
        public static int OnSort(SpeedInterval left, SpeedInterval right)
        {
            int result = left.mWorld.CompareTo(right.mWorld);

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

            // These are intentionally inversed (larger numbers to the top)
            result = right.mDays.Count.CompareTo(left.mDays.Count);
            if (result != 0)
            {
                return(result);
            }

            DaysOfTheWeek leftDay = DaysOfTheWeek.None;

            foreach (DaysOfTheWeek day in left.mDays)
            {
                if (leftDay < day)
                {
                    leftDay = day;
                }
            }

            DaysOfTheWeek rightDay = DaysOfTheWeek.None;

            foreach (DaysOfTheWeek day in right.mDays)
            {
                if (rightDay < day)
                {
                    rightDay = day;
                }
            }

            result = leftDay.CompareTo(rightDay);
            if (result != 0)
            {
                return(result);
            }

            result = left.mStartHour.CompareTo(right.mStartHour);
            if (result != 0)
            {
                return(result);
            }

            return(0);
        }
示例#4
0
        public void Remove(SpeedInterval interval)
        {
            mIntervals.Remove(interval);

            ResetSpeeds();
        }
示例#5
0
        public void Add(SpeedInterval interval)
        {
            mIntervals.Add(interval);

            mIntervals.Sort(new Comparison<SpeedInterval>(SpeedInterval.OnSort));

            ResetSpeeds();
        }
示例#6
0
        public void Remove(SpeedInterval interval)
        {
            mIntervals.Remove(interval);

            ResetSpeeds();
        }