private static bool _subtract(List <TimeBox> tbListA, List <TimeBox> tbListB) { for (int i = 0; i < tbListA.Count; i++) { var tbA = tbListA[i]; foreach (var tbB in tbListB) { bool change = false; var res = _subtract(tbA, tbB, ref change); if (change) { // insert res at i if (res.Count > 0) { tbListA.AddRange(res); } // remove original tbListA.Remove(tbA); TimeBox._sort(tbListA); return(true); } } } return(false); }
internal TimeBox TimeBoxAdd(DateTime start, DateTime end) { // add time box var trb = new TimeBox(start, end, this); TimeBoxCollection.Add(trb); TimeBox._sort(TimeBoxCollection); TimeBoxMerge(); return(trb); }
internal void TimeBoxAdd(List <TimeBox> collection) { foreach (var src in collection) { var trb = new TimeBox(src.StartDate, src.EndDate, this); trb.CopyStates(src); TimeBoxCollection.Add(trb); } TimeBox._sort(TimeBoxCollection); TimeBoxMerge(); }
internal void TimeBoxSort() { TimeBox._sort(TimeBoxCollection); }