Ejemplo n.º 1
0
        public DictionarySet(DictionarySet Dictionary)
        {
            this.MyList = new SortArray();
            this.MyList.ResizeArray(Dictionary.Count());
            int num2 = Dictionary.Count() - 1;

            for (int i = 0; i <= num2; i++)
            {
                this.MyList.Add(Dictionary[i]);
            }
        }
Ejemplo n.º 2
0
        private SetOperation DoUnion(DictionarySet SetA, DictionarySet SetB)
        {
            SetOperation operation2 = new SetOperation();
            int          num        = 0;
            int          num2       = 0;

            operation2.Changed = false;
            while ((num < SetA.Count()) | (num2 < SetB.Count()))
            {
                IMember newObject;
                if (num >= SetA.Count())
                {
                    newObject = SetB[num2];
                    num2++;
                }
                else if (num2 >= SetB.Count())
                {
                    newObject = SetA[num];
                    num++;
                }
                else if (SetA[num].Key().CompareTo(SetB[num2].Key()) == 0)
                {
                    MemberResult result = SetA[num].Union(SetB[num2]);
                    if (result == null)
                    {
                        newObject = SetA[num];
                    }
                    else
                    {
                        newObject = result.NewObject;
                        if (result.SetChanged)
                        {
                            operation2.Changed = true;
                        }
                    }
                    num++;
                    num2++;
                }
                else if (SetA[num].Key().CompareTo(SetB[num2].Key()) < 0)
                {
                    newObject = SetA[num];
                    num++;
                }
                else
                {
                    newObject = SetB[num2];
                    num2++;
                }
                operation2.List.Add(newObject);
            }
            operation2.List.RemoveNullItems();
            return(operation2);
        }
Ejemplo n.º 3
0
 public void Copy(DictionarySet List)
 {
     this.Clear();
     if (List.Count() > 0)
     {
         int num2 = List.Count() - 1;
         for (int i = 0; i <= num2; i++)
         {
             this.MyList.Add(List[i]);
         }
     }
 }
Ejemplo n.º 4
0
        public bool Remove(DictionarySet SetB)
        {
            bool flag  = false;
            int  index = 0;
            int  num2  = 0;
            int  num3  = (int)this.MyList.Count();

            while ((index < this.MyList.Count()) | (num2 < SetB.Count()))
            {
                if (index >= this.MyList.Count())
                {
                    num2++;
                }
                else if (num2 >= SetB.Count())
                {
                    index++;
                }
                else if (this.MyList[index].Key().CompareTo(SetB[num2].Key()) == 0)
                {
                    this.MyList.Remove(index);
                    index++;
                    num2++;
                }
                else if (this.MyList[index].Key().CompareTo(SetB[num2].Key()) < 0)
                {
                    index++;
                }
                else
                {
                    num2++;
                }
            }
            this.MyList.RemoveNullItems();
            if (num3 != this.MyList.Count())
            {
                flag = true;
            }
            return(flag);
        }
Ejemplo n.º 5
0
        public Compare CompareTo(DictionarySet SetB)
        {
            int num;
            int num3 = (int)this.MyList.Count();
            int num4 = SetB.Count();

            if (num3 == num4)
            {
                bool flag = false;
                num = 0;
                while ((num < num3) & !flag)
                {
                    if (this.MyList[num].Key().CompareTo(SetB[num].Key()) != 0)
                    {
                        flag = true;
                    }
                    else
                    {
                        num++;
                    }
                }
                if (flag)
                {
                    return(Compare.UnEqual);
                }
                return(Compare.Equal);
            }
            if (num3 < num4)
            {
                num = 0;
                int num2 = 0;
                while ((num < num3) & (num2 < num4))
                {
                    if (this.MyList[num].Key().CompareTo(SetB[num2].Key()) == 0)
                    {
                        num++;
                        num2++;
                    }
                    else
                    {
                        num2++;
                    }
                }
                if (num > (num3 - 1))
                {
                    return(Compare.Subset);
                }
                return(Compare.UnEqual);
            }
            return(Compare.UnEqual);
        }
Ejemplo n.º 6
0
        public bool IsProperSubsetOf(DictionarySet SetB)
        {
            int num  = 0;
            int num2 = 0;

            while ((num < this.MyList.Count()) & (num2 < SetB.Count()))
            {
                if (this.MyList[num].Key().CompareTo(SetB[num2].Key()) == 0)
                {
                    num++;
                    num2++;
                }
                else
                {
                    num2++;
                }
            }
            if (num < this.MyList.Count())
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 7
0
        public bool IsEqualSet(DictionarySet SetB)
        {
            bool flag2;

            if (this.MyList.Count() != SetB.Count())
            {
                flag2 = true;
            }
            else
            {
                int num = 0;
                flag2 = false;
                while ((num <= (this.Count() - 1)) & !flag2)
                {
                    if (this.MyList[num].Key().CompareTo(SetB[num].Key()) != 0)
                    {
                        flag2 = true;
                    }
                    num++;
                }
            }
            return(!flag2);
        }