コード例 #1
0
 internal override OperatorBuilder InternalBuild()
 {
     var dayInWeek = new Weekday(_day, _time);
     return new OperatorBuilder(
         x =>
             {
                 dayInWeek.AddConstraints(x);
                 return dayInWeek;
             });
 }
コード例 #2
0
        public override void ExitWeekdays(GoldenFoxLanguageParser.WeekdaysContext context)
        {
            var constraints = new List<IConstraint>();
            while (Current.Constraints.Any())
            {
                constraints.Add(Current.Constraints.Pop());
            }

            while (Current.Timestamps.Any())
            {
                var interval = new Weekday(ParseWeekDay(context.weekday()), Current.Timestamps.Pop());
                interval.AddConstraints(constraints);
                _stack.Push(interval);
            }
        }
コード例 #3
0
        public override void ExitNumberedweekday(GoldenFoxLanguageParser.NumberedweekdayContext context)
        {
            var index = 0;
            if (context.numberedDay() != null)
            {
                index = context.numberedDay().INT().AsInt();
                if (context.Last() != null)
                {
                    index = 7 - index + 1;
                }

                index = index % 7;
            }

            var constraints = new List<IConstraint>();
            while (Current.Constraints.Any())
            {
                constraints.Add(Current.Constraints.Pop());
            }

            while (Current.Timestamps.Any())
            {
                var interval = new Weekday((DayOfWeek)index, Current.Timestamps.Pop());
                interval.AddConstraints(constraints);
                _stack.Push(interval);
            }
        }