当前位置: 首页>>代码示例>>C#>>正文


C# ITimePeriod.ShouldNotBeNull方法代码示例

本文整理汇总了C#中ITimePeriod.ShouldNotBeNull方法的典型用法代码示例。如果您正苦于以下问题:C# ITimePeriod.ShouldNotBeNull方法的具体用法?C# ITimePeriod.ShouldNotBeNull怎么用?C# ITimePeriod.ShouldNotBeNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITimePeriod的用法示例。


在下文中一共展示了ITimePeriod.ShouldNotBeNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WorkTimeByRange

        /// <summary>
        /// 생성자
        /// </summary>
        /// <param name="calendar"></param>
        /// <param name="timeRange"></param>
        /// <param name="previousCumulatedWorkInMinute"></param>
        public WorkTimeByRange(Calendar calendar, ITimePeriod timeRange, int previousCumulatedWorkInMinute)
            : base(calendar, timeRange.Start)
        {
            timeRange.ShouldNotBeNull("timeRange");
            Guard.Assert(timeRange.HasPeriod, @"timeRange는 명시적인 구간을 가져야 합니다.");

            TimePeriod.Setup(timeRange.Start, timeRange.End);

            CumulatedInMinute = previousCumulatedWorkInMinute + WorkInMinute;
        }
开发者ID:debop,项目名称:NAccess,代码行数:16,代码来源:WorkTimeByRange.cs

示例2: TimeInterval

        public TimeInterval(ITimePeriod src) : base(src) {
            src.ShouldNotBeNull("src");

            var interval = src as ITimeInterval;
            if(interval != null) {
                _start = interval.StartInterval;
                _end = interval.EndInterval;
                _startEdge = interval.StartEdge;
                _endEdge = interval.EndEdge;
                _isIntervalEnabled = interval.IsIntervalEnabled;
            }
        }
开发者ID:debop,项目名称:NFramework,代码行数:12,代码来源:TimeInterval.cs

示例3: GetReleation

        /// <summary>
        /// <paramref name="period"/>가 <paramref name="target"/>과의 시간 축으로 선 후행 관계를 판단합니다.
        /// </summary>
        /// <param name="period"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static PeriodRelation GetReleation(this ITimePeriod period, ITimePeriod target) {
            period.ShouldNotBeNull("period");
            target.ShouldNotBeNull("target");

            var relation = PeriodRelation.NoRelation;

            if(period.Start > target.End) {
                relation = PeriodRelation.After;
            }
            else if(period.End < target.Start) {
                relation = PeriodRelation.Before;
            }
            else if(period.Start == target.Start && period.End == target.End) {
                relation = PeriodRelation.ExactMatch;
            }
            else if(period.Start == target.End) {
                relation = PeriodRelation.StartTouching;
            }
            else if(period.End == target.Start) {
                relation = PeriodRelation.EndTouching;
            }
            else if(HasInside(period, target)) {
                if(period.Start == target.Start)
                    relation = PeriodRelation.EnclosingStartTouching;
                else
                    relation = (period.End == target.End) ? PeriodRelation.EnclosingEndTouching : PeriodRelation.Enclosing;
            }
                // 기간이 대상 기간 내부에 속할 때
            else {
                var insideStart = HasInside(target, period.Start);
                var insideEnd = HasInside(target, period.End);

                if(insideStart && insideEnd) {
                    relation = Equals(period.Start, target.Start)
                                   ? PeriodRelation.InsideStartTouching
                                   : period.End == target.End
                                         ? PeriodRelation.InsideEndTouching
                                         : PeriodRelation.Inside;
                }
                else if(insideStart)
                    relation = PeriodRelation.StartInside;

                else if(insideEnd)
                    relation = PeriodRelation.EndInside;
            }

            if(IsDebugEnabled)
                log.Debug("period[{0}]와 target[{1}] 간의 Relation은 [{2}] 입니다.", period.AsString(), target.AsString(), relation);

            return relation;
        }
开发者ID:debop,项目名称:NFramework,代码行数:57,代码来源:TimeTool.Relation.cs

示例4: GenerateCategories

        /// <summary>
        /// 기간 단위에 따라 Category를 생성합니다.
        /// </summary>
        /// <param name="categoryCollectionList">생성된 <see cref="CategoriesElement"/> 정보가 담길 객체</param>
        /// <param name="timePeriod">Gantt에 표현할 전체 기간 (프로젝트 전체 기간)</param>
        /// <param name="periodFlags">Gantt Chart X축에 나타낼 기간 단위 정보</param>
        public static void GenerateCategories(IList<CategoriesElement> categoryCollectionList,
                                              ITimePeriod timePeriod,
                                              PeriodFlags periodFlags) {
            categoryCollectionList.ShouldNotBeNull("categoryCollectionList");
            timePeriod.ShouldNotBeNull("periodRange");
            Guard.Assert(timePeriod.HasPeriod, "Gantt에 나타낼 전체 기간은 시작과 끝이 있어야합니다.");

            if(IsDebugEnabled)
                log.Debug("Gantt의 기간 부분을 생성합니다. timePeriod=[{0}], periodFlags=[{1}]", timePeriod, periodFlags);

            categoryCollectionList.Clear();

            if((periodFlags & PeriodFlags.Year) > 0)
                categoryCollectionList.Add(CreateCategories(timePeriod.ForEachYears(),
                                                            range => range.Start.Year.ToString()));

            if((periodFlags & PeriodFlags.HalfYear) > 0)
                categoryCollectionList.Add(CreateCategories(timePeriod.ForEachYears(),
                                                            range => (range.End.HalfyearOf() == HalfyearKind.First) ? "1st" : "2nd"));

            if((periodFlags & PeriodFlags.Quarter) > 0)
                categoryCollectionList.Add(CreateCategories(timePeriod.ForEachQuarters(),
                                                            range => "Q" + range.End.QuarterOf().GetHashCode().ToString()));

            if((periodFlags & PeriodFlags.Month) > 0)
                categoryCollectionList.Add(CreateCategories(timePeriod.ForEachMonths(),
                                                            range => range.End.GetMonthName()));

            if((periodFlags & PeriodFlags.Week) > 0)
                categoryCollectionList.Add(CreateCategories(timePeriod.ForEachWeeks(),
                                                            range => "W" + range.End.GetYearAndWeek().Week.Value.ToString()));

            if((periodFlags & PeriodFlags.Day) > 0)
                categoryCollectionList.Add(CreateCategoriesAsParallel(timePeriod.ForEachDays(), range => range.End.Day.ToString()));

            if((periodFlags & PeriodFlags.Hour) > 0)
                categoryCollectionList.Add(CreateCategoriesAsParallel(timePeriod.ForEachHours(),
                                                                      range => "H" + range.End.Hour.ToString()));
        }
开发者ID:debop,项目名称:NFramework,代码行数:45,代码来源:GanttUtil.cs

示例5: Remove

        /// <summary>
        /// TimePeriodChain에서 요소 <paramref name="item"/>을 제거합니다. (제거된 후의 후속 Period들의 시간이 조정됩니다)
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public override bool Remove(ITimePeriod item) {
            item.ShouldNotBeNull("item");

            if(Count <= 0)
                return false;

            if(IsDebugEnabled)
                log.Debug("요소[{0}] 를 제거하려고 합니다...", item);

            var itemDuration = item.Duration;
            var index = IndexOf(item);

            ITimePeriod next = null;
            if(itemDuration > TimeSpan.Zero && index > 0 && index < Count - 1)
                next = this[index];

            var removed = _periods.Remove(item);

            if(removed && next != null) {
                if(IsDebugEnabled)
                    log.Debug("요소[{0}]를 제거하고, Chain의 후속 Period 들의 기간을 조정합니다...", item);

                for(int i = index; i < Count; i++) {
                    var start = this[i].Start.Subtract(itemDuration);
                    this[i].Setup(start, start.Add(this[i].Duration));
                }
            }

            if(IsDebugEnabled)
                log.Debug("요소[{0}] 를 제거 결과=[{1}]", item, removed);

            return removed;
        }
开发者ID:debop,项目名称:NFramework,代码行数:38,代码来源:TimePeriodChain.cs

示例6: Insert

        /// <summary>
        /// <see cref="ITimePeriod"/>의 Chain의 <paramref name="index"/>번째에 <paramref name="item"/>을 삽입합니다. 선행 Period와 후행 Period의 기간 값이 조정됩니다.
        /// </summary>
        /// <param name="index">추가할 위치</param>
        /// <param name="item">추가할 기간</param>
        public override void Insert(int index, ITimePeriod item) {
            item.ShouldNotBeNull("item");
            Guard.Assert<ArgumentOutOfRangeException>(index >= 0 && index <= Count, "인덱스 범위가 잘못되었습니다. Count=[{0}], index=[{1}]", Count,
                                                      index);

            item.AssertMutable();

            if(IsDebugEnabled)
                log.Debug("Chain의 인덱스[{0}]에 새로운 요소[{1}]를 삽입합니다...", index, item);

            var itemDuration = item.Duration;
            ITimePeriod previousItem = null;
            ITimePeriod nextItem = null;

            if(Count > 0) {
                if(index > 0) {
                    previousItem = this[index - 1];
                    AssertSpaceAfter(End, itemDuration);
                }
                if(index < Count - 1) {
                    nextItem = this[index];
                    AssertSpaceBefore(Start, itemDuration);
                }
            }

            _periods.Insert(index, item);

            if(previousItem != null) {
                if(IsDebugEnabled)
                    log.Debug("선행 Period에 기초하여 삽입한 Period와 후행 Period들의 시간을 조정합니다...");

                item.Setup(previousItem.End, previousItem.End.Add(itemDuration));

                for(int i = index + 1; i < Count; i++) {
                    var startTime = this[i].Start.Add(itemDuration);
                    this[i].Setup(startTime, startTime.Add(this[i].Duration));
                }
            }

            if(nextItem != null) {
                if(IsDebugEnabled)
                    log.Debug("후행 Period에 기초하여 삽입한 Period와 선행 Period들의 시간을 조정합니다...");

                var nextStart = nextItem.Start.Subtract(itemDuration);
                item.Setup(nextStart, nextStart.Add(itemDuration));

                for(var i = 0; i < index - 1; i++) {
                    nextStart = this[i].Start.Subtract(itemDuration);
                    this[i].Setup(nextStart, nextStart.Add(this[i].Duration));
                }
            }
        }
开发者ID:debop,项目名称:NFramework,代码行数:57,代码来源:TimePeriodChain.cs

示例7: GetUnion

 /// <summary>
 /// 두 기간의 합집합 기간을 반환합니다.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public new ITimeRange GetUnion(ITimePeriod other) {
     other.ShouldNotBeNull("other");
     return TimeTool.GetUnionRange(this, other);
 }
开发者ID:debop,项目名称:NFramework,代码行数:9,代码来源:TimeRange.cs

示例8: OverlapsWith

        /// <summary>
        /// 두 기간이 겹치는 구간이 있는지 파악합니다.
        /// </summary>
        /// <param name="period"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool OverlapsWith(this ITimePeriod period, ITimePeriod target) {
            target.ShouldNotBeNull("target");


            var relation = GetReleation(period, target); //period.GetRelation(target);

            var isOverlaps = relation != PeriodRelation.After &&
                             relation != PeriodRelation.StartTouching &&
                             relation != PeriodRelation.EndTouching &&
                             relation != PeriodRelation.Before;

            if(IsDebugEnabled)
                log.Debug("period[{0}]와 target[{1}]이 Overlap되는지 있는지 확인합니다. isOverlaps=[{2}]", period.AsString(), target.AsString(),
                          isOverlaps);

            return isOverlaps;
        }
开发者ID:debop,项目名称:NFramework,代码行数:23,代码来源:TimeTool.Relation.cs

示例9: GetUnion

 /// <summary>
 /// 두 기간의 합집합 기간을 반환합니다.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public virtual TimePeriodBase GetUnion(ITimePeriod other) {
     other.ShouldNotBeNull("other");
     return TimeTool.GetUnionRange(this, other);
 }
开发者ID:debop,项目名称:NFramework,代码行数:9,代码来源:TimePeriodBase.cs

示例10: OverlapsWith

 /// <summary>
 /// 지정한 기간이 현 기간과 겹치는 부분이 있는지 검사합니다.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public virtual bool OverlapsWith(ITimePeriod other) {
     other.ShouldNotBeNull("other");
     return TimeTool.OverlapsWith(this, other);
 }
开发者ID:debop,项目名称:NFramework,代码行数:9,代码来源:TimePeriodBase.cs

示例11: GetUnionRange

        /// <summary>
        /// 두 기간의 합집합 기간을 반환한다.
        /// </summary>
        /// <param name="period"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static TimeRange GetUnionRange(this ITimePeriod period, ITimePeriod target) {
            target.ShouldNotBeNull("target");

            TimeRange unionPeriod = null;

            if(period.HasPeriod && target.HasPeriod) {
                unionPeriod = new TimeRange(period.StartAsNullable < target.StartAsNullable
                                                ? period.StartAsNullable
                                                : target.StartAsNullable,
                                            period.EndAsNullable > target.EndAsNullable
                                                ? period.EndAsNullable
                                                : target.EndAsNullable,
                                            period.IsReadOnly);
            }
            else {
                var start = (period.StartAsNullable.HasValue && target.StartAsNullable.HasValue)
                                ? Min(period.Start, target.Start)
                                : (period.StartAsNullable ?? target.StartAsNullable);
                var end = (period.EndAsNullable.HasValue && target.EndAsNullable.HasValue)
                              ? Max(period.End, target.End)
                              : (period.EndAsNullable ?? target.EndAsNullable);

                unionPeriod = new TimeRange(start, end, period.IsReadOnly);
            }

            if(IsDebugEnabled)
                log.Debug("period[{0}]와 target[{1}] 의 합집합 TimeRange [{2}]를 구했습니다!!!", period.AsString(), target.AsString(),
                          unionPeriod.AsString());

            return unionPeriod;
        }
开发者ID:debop,项目名称:NFramework,代码行数:37,代码来源:TimeTool.Relation.cs

示例12: IsSamePeriod

 /// <summary>
 /// 두 기간이 같은 기간을 나타내는지 검사합니다
 /// </summary>
 /// <param name="other">비교할 대상</param>
 /// <returns></returns>
 public virtual bool IsSamePeriod(ITimePeriod other) {
     other.ShouldNotBeNull("other");
     return Equals(Start, other.Start) && Equals(End, other.End);
 }
开发者ID:debop,项目名称:NFramework,代码行数:9,代码来源:TimePeriodContainer.cs

示例13: GetUnion

 /// <summary>
 /// 두 기간의 합집합 기간을 반환합니다.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public new ITimeInterval GetUnion(ITimePeriod other) {
     other.ShouldNotBeNull("other");
     return (TimeInterval)TimeTool.GetUnionRange(this, other);
 }
开发者ID:debop,项目名称:NFramework,代码行数:9,代码来源:TimeInterval.cs

示例14: ExpandTo

        /// <summary>
        /// 시작시각과 완료시각을 지정된 기간 정보를 기준으로 변경합니다.
        /// </summary>
        /// <param name="period"></param>
        public virtual void ExpandTo(ITimePeriod period) {
            period.ShouldNotBeNull("period");

            ExpandStartTo(period.Start);
            ExpandEndTo(period.End);
        }
开发者ID:debop,项目名称:NFramework,代码行数:10,代码来源:TimeInterval.cs

示例15: GetAvailableWeekPeriods

        /// <summary>
        /// <paramref name="period"/> 기간 내에서 예외 기간등을 제외한 기간들을 HourRange 컬렉션으로 단위로 반환합니다.
        /// </summary>
        /// <param name="period"></param>
        /// <returns></returns>
        private IEnumerable<ITimePeriod> GetAvailableWeekPeriods(ITimePeriod period) {
            period.ShouldNotBeNull("period");

            if(WeekDays.Count == 0 && WorkingHours.Count == 0 && WorkingDayHours.Count == 0)
                return new TimePeriodCollection { period };

            // 필터에 필터링할 정보를 추가합니다.
            //
            var filter = new CalendarPeriodCollectorFilter();
            WeekDays.RunEach(weekDay => filter.WeekDays.Add(weekDay));
            WorkingHours.RunEach(workingHour => filter.CollectingHours.Add(workingHour));
            WorkingDayHours.RunEach(workingDayHour => filter.CollectingDayHours.Add(workingDayHour));

            var weekCollector = new CalendarPeriodCollector(filter, period, SeekDirection.Forward, TimeCalendar);
            weekCollector.CollectHours();

            return weekCollector.Periods;
        }
开发者ID:debop,项目名称:NFramework,代码行数:23,代码来源:CalendarDateAdd.cs


注:本文中的ITimePeriod.ShouldNotBeNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。