Пример #1
0
 public void AddLink <T>(T entity, DefinitionType definitionType = DefinitionType.Rule) where T : RuleEntity//, new()
 {
     if (entity is CommonRule)
     {
         CommonRuleLinks.Add(new VariableRuleLink <CommonRule>()
         {
             Variable = this,
             Entity   = entity as CommonRule
         });
     }
     else if (entity is Sign)
     {
         SignLinks.Add(new VariableModRuleLink <Sign>()
         {
             Variable       = this,
             Entity         = entity as Sign,
             DefinitionType = definitionType
         });
     }
     else if (entity is MenologyRule)
     {
         MenologyRuleLinks.Add(new VariableModRuleLink <MenologyRule>()
         {
             Variable       = this,
             Entity         = entity as MenologyRule,
             DefinitionType = definitionType
         });
     }
     else if (entity is TriodionRule)
     {
         TriodionRuleLinks.Add(new VariableModRuleLink <TriodionRule>()
         {
             Variable       = this,
             Entity         = entity as TriodionRule,
             DefinitionType = definitionType
         });
     }
     else if (entity is ExplicitAddRule)
     {
         ExplicitAddRuleLinks.Add(new VariableRuleLink <ExplicitAddRule>()
         {
             Variable = this,
             Entity   = entity as ExplicitAddRule
         });
     }
 }
Пример #2
0
 public void ClearLinks <T>(T entity, DefinitionType definitionType = DefinitionType.Rule) where T : RuleEntity//, new()
 {
     if (entity is CommonRule)
     {
         CommonRuleLinks.RemoveAll(c => c.Entity == entity);
     }
     else if (entity is Sign)
     {
         SignLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     }
     else if (entity is MenologyRule)
     {
         MenologyRuleLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     }
     else if (entity is TriodionRule)
     {
         TriodionRuleLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     }
     else if (entity is ExplicitAddRule)
     {
         ExplicitAddRuleLinks.RemoveAll(c => c.Entity == entity);
     }
 }