/// <summary> /// Gets a list of rules who are affected by the related key /// </summary> private List <Rule> GetAssociatedRules(RelationKey key) { if (_associations.ContainsKey(key)) { return(_associations[key]); } return(new List <Rule>()); }
public override bool Equals(object obj) { RelationKey rk = obj as RelationKey; if (rk == null) { return(false); } return(rk == this); }
/// <summary> /// Returns an array of relationships. /// </summary> public Relationship[] this[RelationKey key] { get { if (_knowledge.ContainsKey(key)) { return(_knowledge[key].ToArray()); } return(new Relationship[0]); } }
/// <summary> /// Adds a relationship to the knowledge base /// </summary> public void AddAssociation(RelationKey key, Rule rule) { if (!_associations.ContainsKey(key)) { _associations.Add(key, new List <Rule>()); } if (!_associations[key].Contains(rule)) { Debug.WriteLine(string.Format("Added Association ({0} -> {1})", key, rule)); _associations[key].Add(rule); } }
/// <summary> /// /// </summary> public KnowledgeChangedEventArgs(RelationKey key, List <Rule> rules) { _key = key; _rules = rules; }