コード例 #1
0
ファイル: Schedule.cs プロジェクト: mjclepper/ScheduleWidget
 /// <summary>
 /// Return true if the date occurs in the schedule.
 /// </summary>
 /// <param name="aDate"></param>
 /// <returns></returns>
 public bool IsOccurring(DateTime aDate)
 {
     if (!_event.DateIsWithinLimits(aDate))
     {
         return(false);
     }
     return(TemporalExpression.Includes(aDate));
 }
コード例 #2
0
ファイル: Schedule.cs プロジェクト: mjclepper/ScheduleWidget
        /// <summary>
        /// Create and return a base schedule including exclusions if applicable.
        /// </summary>
        /// <param name="excludedDates">Holidays or any excluded dates</param>
        /// <returns>Complete schedule as an expression</returns>
        private TemporalExpression Create(TemporalExpression excludedDates)
        {
            var intersectionTE = new IntersectionTE();

            // get a builder that knows how to create a UnionTE for the event frequency
            var builder = EventFrequencyBuilder.Create(_event);
            var union   = builder.Create();

            intersectionTE.Add(union);

            if (_event.RangeInYear != null)
            {
                var rangeEachYear = GetRangeForYear(_event);
                intersectionTE.Add(rangeEachYear);
            }

            return(new DifferenceTE(intersectionTE, excludedDates));
        }
コード例 #3
0
ファイル: Schedule.cs プロジェクト: mjclepper/ScheduleWidget
 public Schedule(Event aEvent, UnionTE excludedDates)
 {
     _event             = aEvent;
     TemporalExpression = Create(excludedDates);
 }
コード例 #4
0
ファイル: Schedule.cs プロジェクト: mjclepper/ScheduleWidget
 public Schedule(Event aEvent, IEnumerable <DateTime> excludedDates)
 {
     _event             = aEvent;
     TemporalExpression = Create(excludedDates);
 }
コード例 #5
0
ファイル: Schedule.cs プロジェクト: mjclepper/ScheduleWidget
 public Schedule(Event aEvent)
 {
     _event             = aEvent;
     TemporalExpression = Create();
 }
コード例 #6
0
 public void SetSchedule(TemporalExpression expression)
 {
     _expression = expression;
 }
コード例 #7
0
 /// <summary>
 /// Return true if the date occurs in the schedule.
 /// </summary>
 /// <param name="aDate"></param>
 /// <returns></returns>
 public bool IsOccurring(DateTime aDate)
 {
     return(TemporalExpression.Includes(aDate));
 }
コード例 #8
0
 public ScheduleElement(string eventArg, TemporalExpression temporalExpression)
 {
     Event      = eventArg;
     Expression = temporalExpression;
 }