protected void Reduce()
{
CheckList();
if (this.m_list == null)
return;
int j;
for (int i = 0; i < this.m_list.Count - 1; i++)
{
j = i + 1;
while (j < this.m_list.Count)
{
if (StringSubsetString( (String)this.m_list[j], (String)this.m_list[i], m_ignoreCase ))
{
this.m_list.RemoveAt( j );
}
else if (StringSubsetString( (String)this.m_list[i], (String)this.m_list[j], m_ignoreCase ))
{
// write the value at j into position i, delete the value at position j and keep going.
this.m_list[i] = this.m_list[j];
this.m_list.RemoveAt( j );
j = i + 1;
}
else
{
j++;
}
}
}
}
[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); }