Exemplo n.º 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;
        }
Exemplo n.º 2
0
        public void Add(SpeedInterval interval)
        {
            mIntervals.Add(interval);

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

            ResetSpeeds();
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        public void Remove(SpeedInterval interval)
        {
            mIntervals.Remove(interval);

            ResetSpeeds();
        }
Exemplo n.º 5
0
        public void Add(SpeedInterval interval)
        {
            mIntervals.Add(interval);

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

            ResetSpeeds();
        }
Exemplo n.º 6
0
        public void Remove(SpeedInterval interval)
        {
            mIntervals.Remove(interval);

            ResetSpeeds();
        }