Example #1
0
            public int CompareFieldValueTo(FieldIndex field, Solution other)
            {
                switch (field)
                {
                case FieldIndex.TimeAtUni:
                    return(TimeAtUni.CompareTo(other.TimeAtUni));

                case FieldIndex.TimeInClasses:
                    return(TimeInClasses.CompareTo(other.TimeInClasses));

                case FieldIndex.TimeInBreaks:
                    return(TimeInBreaks.CompareTo(other.TimeInBreaks));

                case FieldIndex.Days:
                    return(Days.CompareTo(other.Days));

                case FieldIndex.MinDayLength:
                    return(MinDayLength.CompareTo(other.MinDayLength));

                case FieldIndex.MaxDayLength:
                    return(MaxDayLength.CompareTo(other.MaxDayLength));

                case FieldIndex.AverageDayLength:
                    return(AverageDayLength.CompareTo(other.AverageDayLength));

                case FieldIndex.ShortBreak:
                    return(ShortBreak.CompareTo(other.ShortBreak));

                case FieldIndex.LongBreak:
                    return(LongBreak.CompareTo(other.LongBreak));

                case FieldIndex.AverageBreak:
                    return(AverageBreak.CompareTo(other.AverageBreak));

                case FieldIndex.NumberBreaks:
                    return(NumberBreaks.CompareTo(other.NumberBreaks));

                case FieldIndex.ShortBlock:
                    return(ShortBlock.CompareTo(other.ShortBlock));

                case FieldIndex.LongBlock:
                    return(LongBlock.CompareTo(other.LongBlock));

                case FieldIndex.AverageBlock:
                    return(AverageBlock.CompareTo(other.AverageBlock));

                case FieldIndex.NumberBlocks:
                    return(NumberBlocks.CompareTo(other.NumberBlocks));

                case FieldIndex.EarlyStart:
                    return(EarlyStart.CompareTo(other.EarlyStart));

                case FieldIndex.LateStart:
                    return(LateStart.CompareTo(other.LateStart));

                case FieldIndex.AverageStart:
                    return(AverageStart.CompareTo(other.AverageStart));

                case FieldIndex.EarlyEnd:
                    return(EarlyEnd.CompareTo(other.EarlyEnd));

                case FieldIndex.LateEnd:
                    return(LateEnd.CompareTo(other.LateEnd));

                case FieldIndex.AverageEnd:
                    return(AverageEnd.CompareTo(other.AverageEnd));

                default:
                    return(0);
                }
            }
Example #2
0
            /*public IComparable Field(int field)
             * {
             * switch (field)
             * {
             *  case 0:
             *      return (IComparable)TimeAtUni_;
             *  case 1:
             *      return (IComparable)TimeInClasses_;
             *  case 2:
             *      return (IComparable)TimeInBreaks_;
             *  case 3:
             *      return Days_;
             *  case 4:
             *      return (IComparable)MinDayLength_;
             *  case 5:
             *      return (IComparable)MaxDayLength_;
             *  case 6:
             *      return (IComparable)AverageDayLength_;
             *  case 7:
             *      return (IComparable)ShortBreak_;
             *  case 8:
             *      return (IComparable)LongBreak_;
             *  case 9:
             *      return (IComparable)AverageBreak_;
             *  case 10:
             *      return NumberBreaks_;
             *  case 11:
             *      return (IComparable)ShortBlock_;
             *  case 12:
             *      return (IComparable)LongBlock_;
             *  case 13:
             *      return (IComparable)AverageBlock_;
             *  case 14:
             *      return NumberBlocks_;
             *  case 15:
             *      return (IComparable)EarlyStart_;
             *  case 16:
             *      return (IComparable)LateStart_;
             *  case 17:
             *      return (IComparable)AverageStart_;
             *  case 18:
             *      return (IComparable)EarlyEnd_;
             *  case 19:
             *      return (IComparable)LateEnd_;
             *  case 20:
             *      return (IComparable)AverageEnd_;
             *  default:
             *      throw new Exception("Field index out of range.");
             * }
             * }*/

            public string FieldValueToString(FieldIndex field)
            {
                switch (field)
                {
                case FieldIndex.TimeAtUni:
                    return(TimeAtUni.ToString());

                case FieldIndex.TimeInClasses:
                    return(TimeInClasses.ToString());

                case FieldIndex.TimeInBreaks:
                    return(TimeInBreaks.ToString());

                case FieldIndex.Days:
                    return(Days.ToString());

                case FieldIndex.MinDayLength:
                    return(MinDayLength.ToString());

                case FieldIndex.MaxDayLength:
                    return(MaxDayLength.ToString());

                case FieldIndex.AverageDayLength:
                    return(AverageDayLength.ToString());

                case FieldIndex.ShortBreak:
                    return(ShortBreak.ToString());

                case FieldIndex.LongBreak:
                    return(LongBreak.ToString());

                case FieldIndex.AverageBreak:
                    return(AverageBreak.ToString());

                case FieldIndex.NumberBreaks:
                    return(NumberBreaks.ToString());

                case FieldIndex.ShortBlock:
                    return(ShortBlock.ToString());

                case FieldIndex.LongBlock:
                    return(LongBlock.ToString());

                case FieldIndex.AverageBlock:
                    return(AverageBlock.ToString());

                case FieldIndex.NumberBlocks:
                    return(NumberBlocks.ToString());

                case FieldIndex.EarlyStart:
                    return(EarlyStart.ToString());

                case FieldIndex.LateStart:
                    return(LateStart.ToString());

                case FieldIndex.AverageStart:
                    return(AverageStart.ToString());

                case FieldIndex.EarlyEnd:
                    return(EarlyEnd.ToString());

                case FieldIndex.LateEnd:
                    return(LateEnd.ToString());

                case FieldIndex.AverageEnd:
                    return(AverageEnd.ToString());

                default:
                    return("");
                }
            }