Example #1
0
        /// <summary>
        /// 기간 컬렉션으로부터 ITimeLineMoment 컬렉션을 빌드합니다
        /// </summary>
        /// <param name="momentPeriods"></param>
        /// <returns></returns>
        private ITimeLineMomentCollection GetTimeLineMoments(ICollection <ITimePeriod> momentPeriods)
        {
            if (IsDebugEnabled)
            {
                log.Debug("기간 컬렉션으로부터 ITimeLineMoment 컬렉션을 빌드합니다...");
            }

            var timeLineMoments = new TimeLineMomentCollection();

            if (momentPeriods.Count == 0)
            {
                return(timeLineMoments);
            }

            // setup gap set with all start/end points
            var intersections = new TimePeriodCollection();

            foreach (var momentPeriod in momentPeriods.Where(mp => !mp.IsMoment))
            {
                var intersection = Limits.GetIntersection(momentPeriod);
                if (intersection == null || intersection.IsMoment)
                {
                    continue;
                }

                if (PeriodMapper != null)
                {
                    intersection = new TimeRange(MapPeriodStart(intersection.Start),
                                                 MapPeriodEnd(intersection.End));
                }

                intersections.Add(intersection);
            }

            timeLineMoments.AddAll(intersections);

            if (IsDebugEnabled)
            {
                log.Debug("기간 컬렉션으로부터 ITimeLineMoment 컬렉션을 빌드했습니다. timeLineMoments=[{0}]", timeLineMoments);
            }

            return(timeLineMoments);
        }