Example #1
0
 /// <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>());
 }
Example #2
0
        public override bool Equals(object obj)
        {
            RelationKey rk = obj as RelationKey;

            if (rk == null)
            {
                return(false);
            }
            return(rk == this);
        }
Example #3
0
 /// <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]);
     }
 }
Example #4
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);
            }
        }
Example #5
0
 /// <summary>
 ///
 /// </summary>
 public KnowledgeChangedEventArgs(RelationKey key, List <Rule> rules)
 {
     _key   = key;
     _rules = rules;
 }