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); }
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)); }
public IParseFunction Visit(ReferencedRule target) => target;
public override bool IsMatch(DateTime day) { return(ReferencedRule.IsMatch(day - TimeSpan.FromDays(Nth))); }
public override string GetDescription() { return(ReferencedRule.GetDescription() + string.Format(" starting on {0:d}", StartDate)); }
public override bool IsMatch(DateTime day) { return(day >= StartDate && ReferencedRule.IsMatch(day)); }
public override bool IsMatch(DateTime day) { return(!ReferencedRule.IsMatch(day)); }
public IParseFunction Visit(ReferencedRule target) => (ReferencedRule == null) ? target : (ReferencedRule(target));
public void Visit(ReferencedRule target, Signature input) { BasicTargetWithInterfaceMethod(target, target.InterfaceMethod, input); }