/// <summary> /// Set the specified property to the specified value. If property does not exist, it is created and initialized to the specified value. /// </summary> /// <param name="Field">Name of the property</param> /// <param name="Value">Value</param> public void SetProperty(string Field, string Value) { if (mParent != null && mParent.GetProperty(Field) != Value) //check for inheritance conflict { Contradiction.Throw(Contradiction.ERRCODE.INHERITANCE, new Concept[2] { mParent, this }); return; } if (mdictProperties.ContainsKey(Field)) { mdictProperties[Field] = Value; } else { mdictProperties.Add(Field, Value); } }
/// <summary> /// Add a new Rule to the RuleBase /// </summary> /// <param name="Object">Rule to be added</param> static public void Add(Rule Object) { lock (rbMUTEX) { var tmp = Find(Object.GetPattern()); if (tmp != null) { // Object has the same pattern with an existing Rule if (tmp != Object) { Contradiction.Throw(Contradiction.ERRCODE.RULE, new Rule[2] { Object, tmp }); return; } } if (!mRules.Contains(Object)) { mRules.Add(Object); } } }
/// <summary> /// Add a new Concept to the ConceptBase /// </summary> /// <param name="Object">Concept to be added</param> static public void Add(Concept Object) { lock (cbMUTEX) { var tmp = Find(Object.Name, Object.Type); if (tmp != null) { // Object has the same name-type combination with an existing Concept // Hence there is a direct contradiction if (tmp != Object) { Contradiction.Throw(Contradiction.ERRCODE.DIRECT, new Concept[2] { Object, tmp }); return; } } if (!mConcepts.Contains(Object)) { mConcepts.Add(Object); } } }