Exemple #1
0
 public override Rule ToRule(EventSlot slot)
 {
     var rule = new AlwaysRule();
     foreach (var activityModel in Activities)
     {
         rule.Activities.Add(activityModel.ToConfiguredActivity());
     }
     return rule;
 }
Exemple #2
0
        public override Rule ToRule(EventSlot slot)
        {
            var rule = new IfElseRule();
            rule.Conditions = Conditions.ToList();

            foreach (var thenRuleModel in Then)
            {
                rule.Then.Add(thenRuleModel.ToRule(slot));
            }

            foreach (var elseRuleModel in Else)
            {
                rule.Else.Add(elseRuleModel.ToRule(slot));
            }

            return rule;
        }
        public override Rule ToRule(EventSlot slot)
        {
            var param = RuleParameterProviders.Providers.GetParameter(slot.EventType, Parameter);
            var rule = new SwitchCaseRule(param);

            foreach (var caze in Cases)
            {
                var value = Convert.ChangeType(caze.Value, param.ValueType);
                rule.Cases.Add(value, caze.Rules.Select(r => r.ToRule(slot)).ToList());
            }

            foreach (var defaultRule in Default)
            {
                rule.Default.Add(defaultRule.ToRule(slot));
            }

            return rule;
        }
Exemple #4
0
        public void Register(string group, Type eventType, string shortName = null)
        {
            var slot = new EventSlot(eventType, shortName);

            slot.Initialize();

            _slotsByEventNames.Add(eventType.Name, slot);

            if (!_slotsByGroups.ContainsKey(group))
            {
                _slotsByGroups.Add(group, new List <EventSlot> {
                    slot
                });
            }
            else
            {
                _slotsByGroups[group].Add(slot);
            }
        }
Exemple #5
0
 public abstract Rule ToRule(EventSlot slot);
Exemple #6
0
 public RulesFileFormat(EventSlot slot)
 {
     Slot = slot;
 }