Пример #1
0
    protected bool DoAdd(T item)
    {
        if (!item)
        {
            throw new MissingReferenceException("You cannot pass a missing or null item into the list");
        }
        if (!this.hashSet.Add(item))
        {
            return(false);
        }
        ODBNode <T> .New(this, item);

        return(true);
    }
Пример #2
0
    protected bool DoAdd(T item, out ODBNode <T> node)
    {
        if (item == null)
        {
            throw new MissingReferenceException("You cannot pass a missing or null item into the list");
        }
        if (this.hashSet.Add(item))
        {
            node = ODBNode <T> .New((ODBList <T>) this, item);

            return(true);
        }
        node = null;
        return(false);
    }
Пример #3
0
 protected void DoUnionWith(ODBList <T> list)
 {
     if (list.any && (list != this))
     {
         ODBSibling <T> first = list.first;
         do
         {
             T self = first.item.self;
             first = first.item.n;
             if (this.hashSet.Add(self))
             {
                 ODBNode <T> .New((ODBList <T>) this, self);
             }
         }while (first.has);
     }
 }
Пример #4
0
    protected void DoUnionWith(ODBList <T> list)
    {
        if (!list.any || list == this)
        {
            return;
        }
        ODBSibling <T> oDBSibling = list.first;

        do
        {
            T t = oDBSibling.item.self;
            oDBSibling = oDBSibling.item.n;
            if (!this.hashSet.Add(t))
            {
                continue;
            }
            ODBNode <T> .New(this, t);
        }while (oDBSibling.has);
    }
Пример #5
0
 protected void DoSymmetricExceptWith(ODBList <T> list)
 {
     if (this.any)
     {
         if (list.any)
         {
             if (list != this)
             {
                 ODBSibling <T> oDBSibling = list.first;
                 do
                 {
                     T t = oDBSibling.item.self;
                     oDBSibling = oDBSibling.item.n;
                     if (!this.hashSet.Remove(t))
                     {
                         this.hashSet.Add(t);
                         ODBNode <T> .New(this, t);
                     }
                     else
                     {
                         this.KnownFind(t).Dispose();
                     }
                 }while (oDBSibling.has);
             }
             else
             {
                 this.DoClear();
             }
         }
     }
     else if (list.any)
     {
         ODBSibling <T> oDBSibling1 = list.first;
         do
         {
             T t1 = oDBSibling1.item.self;
             oDBSibling1 = oDBSibling1.item.n;
             this.hashSet.Add(t1);
             ODBNode <T> .New(this, t1);
         }while (oDBSibling1.has);
     }
 }
Пример #6
0
 protected void DoSymmetricExceptWith(ODBList <T> list)
 {
     if (this.any)
     {
         if (list.any)
         {
             if (list == this)
             {
                 this.DoClear();
             }
             else
             {
                 ODBSibling <T> first = list.first;
                 do
                 {
                     T self = first.item.self;
                     first = first.item.n;
                     if (this.hashSet.Remove(self))
                     {
                         this.KnownFind(self).Dispose();
                     }
                     else
                     {
                         this.hashSet.Add(self);
                         ODBNode <T> .New((ODBList <T>) this, self);
                     }
                 }while (first.has);
             }
         }
     }
     else if (list.any)
     {
         ODBSibling <T> n = list.first;
         do
         {
             T item = n.item.self;
             n = n.item.n;
             this.hashSet.Add(item);
             ODBNode <T> .New((ODBList <T>) this, item);
         }while (n.has);
     }
 }