Exemplo n.º 1
0
 public Section(int crn, ClassTime lecture) //this constructor is used when there is just a lecture
 {
     this.crn        = crn;
     this.lecture    = lecture;
     this.classTimes = new List <ClassTime>()
     {
         lecture
     };         //LabRec is not added to ClassTimes list to avoid NullException during testing
 }
Exemplo n.º 2
0
 public Section(int crn, ClassTime lecture, ClassTime labRec) //this constructor is used when the section contains a lab or recitation
 {
     this.crn        = crn;
     this.lecture    = lecture;
     this.labRec     = labRec;
     this.classTimes = new List <ClassTime>()
     {
         { lecture },
         { labRec }
     };
 }
Exemplo n.º 3
0
 //METHODS
 public bool OnSameDay(ClassTime AClass)
 {
     foreach (char chr in this.days) //test all chars in the days shorthand
     {
         if (AClass.Days.Contains(chr))
         {
             return(true); //if AClass and this have any day(s) in common
         }
     }
     return(false); //if it passes the entire foreach loop, then AClass and this have no days in common
 }
Exemplo n.º 4
0
 public bool HasTimeConflict(ClassTime AClass)
 {
     if ((AClass.StartTime.TimeOfDay >= this.startTime.TimeOfDay) && (AClass.StartTime.TimeOfDay <= this.endTime.TimeOfDay))
     {
         return(true); //if the start time for AClass is in between the start and end times for this, then there is a time conflict
     }
     else if ((AClass.EndTime.TimeOfDay >= this.startTime.TimeOfDay) && (AClass.EndTime.TimeOfDay <= this.endTime.TimeOfDay))
     {
         return(true); //if the end time for AClass is in between the start and end times for this, then there is a time conflict
     }
     else
     {
         return(false); //only if the start and end times don't conflict is there no time conflict
     }
 }