Beispiel #1
0
        public void Visit(ReferencedRule target, Access access)
        {
            AddSignature(target, access, requiresGeneration: false);                  // Referenced rule will generate itself
            var     methodName = this.ruleMethodNames[target.Identifier];
            Invoker invoker    = (i, p, s, f) => $"{methodName}({i}, {p}, {s}, {f})"; // Invocation

            AddInvoker(target, invoker);
        }
        public String Visit(ReferencedRule target)
        {
            var value = target.Identifier;

            if (this.ShowHeader)
            {
                value = $"Rule: {value}";
            }
            return(value);
        }
        private SetIntersectionRule CreateIntersectionRule()
        {
            var intersectRule = ReferencedRule.IfAlso(
                new MonthsRule()
            {
                Months = Months
            });

            return(intersectRule);
        }
Beispiel #4
0
        public override bool IsMatch(DateTime day)
        {
            if (Nth == 0)
            {
                throw new InvalidOperationException("Nth rule can't count to zero");
            }
            //first, the current day must match the rule (e.g. 2nd monday after xxx must be a Monday!)
            if (!NthRule.IsMatch(day))
            {
                return(false);
            }

            var ruleWithAlternatives = NthRule as IHasAlternateRules;
            var nthRules             = ruleWithAlternatives != null ? ruleWithAlternatives.Rules : new[] { NthRule };

            var searchDays = nthRules.SelectMany(crtRule => GetCandidateDays(day, crtRule))
                             .Distinct() // skip duplicate days
            ;

            return(searchDays.Any(d => ReferencedRule.IsMatch(d))); //in the search interval, there's a day matching the guiding rule
        }
 public override string GetDescription()
 {
     return(ReferencedRule.GetDescription() + string.Format(" between {0:d} and {1:d}", StartDate, EndDate));
 }
 public override bool IsMatch(DateTime day)
 {
     return(StartDate <= day.Date && day.Date <= EndDate &&
            ReferencedRule.IsMatch(day));
 }
Beispiel #7
0
 public IParseFunction Visit(ReferencedRule target) => target;
 public override bool IsMatch(DateTime day)
 {
     return(ReferencedRule.IsMatch(day - TimeSpan.FromDays(Nth)));
 }
Beispiel #9
0
 public override string GetDescription()
 {
     return(ReferencedRule.GetDescription() + string.Format(" starting on {0:d}", StartDate));
 }
Beispiel #10
0
 public override bool IsMatch(DateTime day)
 {
     return(day >= StartDate && ReferencedRule.IsMatch(day));
 }
Beispiel #11
0
 public override bool IsMatch(DateTime day)
 {
     return(!ReferencedRule.IsMatch(day));
 }
Beispiel #12
0
 public IParseFunction Visit(ReferencedRule target) => (ReferencedRule == null) ? target : (ReferencedRule(target));
 public void Visit(ReferencedRule target, Signature input)
 {
     BasicTargetWithInterfaceMethod(target, target.InterfaceMethod, input);
 }