public int Compare(Proposition p) { int n1 = arrLiteral1.Count + arrLiteral2.Count; int n2 = p.arrLiteral1.Count + p.arrLiteral2.Count; if (n1 > n2) { return(1); } if (n1 < n2) { return(-1); } string tmp1 = this.ToString(); string tmp2 = p.ToString(); return(tmp1.CompareTo(tmp2)); }
public KnowledgeBase(string fileName) { arrProposition = new SortedSet <Proposition>(new MyCompare_2()); arrString = new List <string>(); string[] text = System.IO.File.ReadAllLines(fileName); int n = text.Length; string s = ""; for (int i = 1; i < n - 2; ++i) { arrProposition.Add(new Proposition(text[i])); s += (text[i] + ","); } arrString.Add(text[n - 1]); Proposition tmp = new Proposition(); tmp.Set(text[n - 1]); s += tmp.ToString(); arrProposition.Add(tmp); arrString.Add(s); }