Compare() public static method

Compare method for PointInTime objects
public static Compare ( PointInTime pitA, PointInTime pitB ) : int
pitA PointInTime first PointInTime object
pitB PointInTime second PointInTime object
return int
Esempio n. 1
0
 /// <summary>
 /// Checking, if an enumeration of TimePeriod objects doesn't contain intersecting TimePeriods
 /// </summary>
 /// <param name="timePeriods">enumeration of Timeperiod objects to check</param>
 /// <returns>returns true, if no intersecting teime periods are found, else return false</returns>
 public static bool IsIntersectionFree(IEnumerable <TimePeriod> timePeriods)
 {
     TimePeriod[] testPeriods = timePeriods.OrderBy(tp => tp.Begin.Hour * 100 + tp.Begin.Minute).ToArray();
     for (int i = 0; i < testPeriods.Length - 1; i++)
     {
         if (PointInTime.Compare(testPeriods[i].End, testPeriods[i + 1].Begin) != -1)
         {
             return(false);
         }
     }
     return(true);
 }