public StringExpressionSet Intersect(StringExpressionSet ses) { if (this.IsEmpty() || ses == null || ses.IsEmpty()) { return(this.CreateNewEmpty()); } this.CheckList(); ses.CheckList(); StringExpressionSet stringExpressionSet = this.CreateNewEmpty(); for (int i = 0; i < this.m_list.Count; i++) { for (int j = 0; j < ses.m_list.Count; j++) { if (this.StringSubsetString((string)this.m_list[i], (string)ses.m_list[j], this.m_ignoreCase)) { if (stringExpressionSet.m_list == null) { stringExpressionSet.m_list = new ArrayList(); } stringExpressionSet.AddSingleExpressionNoDuplicates((string)this.m_list[i]); } else if (this.StringSubsetString((string)ses.m_list[j], (string)this.m_list[i], this.m_ignoreCase)) { if (stringExpressionSet.m_list == null) { stringExpressionSet.m_list = new ArrayList(); } stringExpressionSet.AddSingleExpressionNoDuplicates((string)ses.m_list[j]); } } } stringExpressionSet.GenerateString(); return(stringExpressionSet); }
public StringExpressionSet Intersect(StringExpressionSet ses) { if (this.IsEmpty() || ses == null || ses.IsEmpty()) { return(this.CreateNewEmpty()); } this.CheckList(); ses.CheckList(); StringExpressionSet newEmpty = this.CreateNewEmpty(); for (int index1 = 0; index1 < this.m_list.Count; ++index1) { for (int index2 = 0; index2 < ses.m_list.Count; ++index2) { if (this.StringSubsetString((string)this.m_list[index1], (string)ses.m_list[index2], this.m_ignoreCase)) { if (newEmpty.m_list == null) { newEmpty.m_list = new ArrayList(); } newEmpty.AddSingleExpressionNoDuplicates((string)this.m_list[index1]); } else if (this.StringSubsetString((string)ses.m_list[index2], (string)this.m_list[index1], this.m_ignoreCase)) { if (newEmpty.m_list == null) { newEmpty.m_list = new ArrayList(); } newEmpty.AddSingleExpressionNoDuplicates((string)ses.m_list[index2]); } } } newEmpty.GenerateString(); return(newEmpty); }
[System.Security.SecurityCritical] // auto-generated public StringExpressionSet Intersect(StringExpressionSet ses) { // If either set is empty, the intersection is empty if (this.IsEmpty() || ses == null || ses.IsEmpty()) { return(CreateNewEmpty()); } CheckList(); ses.CheckList(); // Do the intersection for real StringExpressionSet intersectSet = CreateNewEmpty(); for (int this_index = 0; this_index < this.m_list.Count; ++this_index) { for (int ses_index = 0; ses_index < ses.m_list.Count; ++ses_index) { if (StringSubsetString((String)this.m_list[this_index], (String)ses.m_list[ses_index], m_ignoreCase)) { if (intersectSet.m_list == null) { intersectSet.m_list = new ArrayList(); } intersectSet.AddSingleExpressionNoDuplicates((String)this.m_list[this_index]); } else if (StringSubsetString((String)ses.m_list[ses_index], (String)this.m_list[this_index], m_ignoreCase)) { if (intersectSet.m_list == null) { intersectSet.m_list = new ArrayList(); } intersectSet.AddSingleExpressionNoDuplicates((String)ses.m_list[ses_index]); } } } intersectSet.GenerateString(); return(intersectSet); }
[System.Security.SecurityCritical] // auto-generated public StringExpressionSet Union(StringExpressionSet ses) { // If either set is empty, the union represents a copy of the other. if (ses == null || ses.IsEmpty()) { return(this.Copy()); } if (this.IsEmpty()) { return(ses.Copy()); } CheckList(); ses.CheckList(); // Perform the union // note: insert smaller set into bigger set to reduce needed comparisons StringExpressionSet bigger = ses.m_list.Count > this.m_list.Count ? ses : this; StringExpressionSet smaller = ses.m_list.Count <= this.m_list.Count ? ses : this; StringExpressionSet unionSet = bigger.Copy(); unionSet.Reduce(); for (int index = 0; index < smaller.m_list.Count; ++index) { unionSet.AddSingleExpressionNoDuplicates((String)smaller.m_list[index]); } unionSet.GenerateString(); return(unionSet); }
public StringExpressionSet Union(StringExpressionSet ses) { if (ses == null || ses.IsEmpty()) { return(this.Copy()); } if (this.IsEmpty()) { return(ses.Copy()); } this.CheckList(); ses.CheckList(); StringExpressionSet stringExpressionSet = (ses.m_list.Count > this.m_list.Count) ? ses : this; StringExpressionSet stringExpressionSet2 = (ses.m_list.Count <= this.m_list.Count) ? ses : this; StringExpressionSet stringExpressionSet3 = stringExpressionSet.Copy(); stringExpressionSet3.Reduce(); for (int i = 0; i < stringExpressionSet2.m_list.Count; i++) { stringExpressionSet3.AddSingleExpressionNoDuplicates((string)stringExpressionSet2.m_list[i]); } stringExpressionSet3.GenerateString(); return(stringExpressionSet3); }