Example #1
0
 protected void DoExceptWith(ODBList <T> list)
 {
     if (!this.any || !list.any)
     {
         return;
     }
     if (list != this)
     {
         ODBSibling <T> oDBSibling = list.first;
         do
         {
             T t = oDBSibling.item.self;
             oDBSibling = oDBSibling.item.n;
             if (!this.hashSet.Remove(t))
             {
                 continue;
             }
             this.KnownFind(t).Dispose();
         }while (oDBSibling.has);
     }
     else
     {
         this.DoClear();
     }
 }
Example #2
0
    private void Setup(ODBList <T> list, T self)
    {
        ODBSibling <T> oDBSibling = new ODBSibling <T>();

        this.self    = self;
        this.list    = list;
        this.hasList = true;
        this.n       = new ODBSibling <T>();
        if (!list.any)
        {
            list.count      = 1;
            list.any        = true;
            oDBSibling.has  = true;
            oDBSibling.item = this;
            list.first      = oDBSibling;
            list.last       = oDBSibling;
        }
        else
        {
            this.p             = list.last;
            this.p.item.n.item = this;
            this.p.item.n.has  = true;
            list.last.item     = this;
            ODBList <T> ts = list;
            ts.count = ts.count + 1;
        }
    }
Example #3
0
 private void Setup(ODBList <T> list, T self)
 {
     this.self    = self;
     this.list    = list;
     this.hasList = true;
     this.n       = new ODBSibling <T>();
     if (list.any)
     {
         this.p             = list.last;
         this.p.item.n.item = (ODBNode <T>) this;
         this.p.item.n.has  = true;
         list.last.item     = (ODBNode <T>) this;
         list.count++;
     }
     else
     {
         ODBSibling <T> sibling;
         list.count   = 1;
         list.any     = true;
         sibling.has  = true;
         sibling.item = (ODBNode <T>) this;
         list.first   = sibling;
         list.last    = sibling;
     }
 }
Example #4
0
 public bool MoveNext()
 {
     if (this.sib.has)
     {
         ODBNode <T> item = this.sib.item;
         this.Current = item.self;
         this.sib     = item.p;
         return(true);
     }
     return(false);
 }
Example #5
0
    public bool MoveNext()
    {
        if (!this.sib.has)
        {
            return(false);
        }
        ODBNode <T> oDBNode = this.sib.item;

        this.Current = oDBNode.self;
        this.sib     = oDBNode.p;
        return(true);
    }
Example #6
0
    protected ODBNode <T> KnownFind(T item)
    {
        ODBSibling <T> first = this.first;

        while (first.item.self != item)
        {
            first = first.item.n;
            if (!first.has)
            {
                throw new ArgumentException("item was not found", "item");
            }
        }
        return(first.item);
    }
Example #7
0
    protected ODBNode <T> KnownFind(T item)
    {
        ODBSibling <T> oDBSibling = this.first;

        do
        {
            if (oDBSibling.item.self == item)
            {
                return(oDBSibling.item);
            }
            oDBSibling = oDBSibling.item.n;
        }while (oDBSibling.has);
        throw new ArgumentException("item was not found", "item");
    }
Example #8
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);
     }
 }
Example #9
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);
    }
Example #10
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);
     }
 }
Example #11
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);
     }
 }
Example #12
0
 protected void DoIntersectWith(ODBList <T> list)
 {
     if (this.any)
     {
         if (list.any)
         {
             if (list != this)
             {
                 this.hashSet.IntersectWith(list.hashSet);
                 int count = this.hashSet.Count;
                 if (count == 0)
                 {
                     while (this.any)
                     {
                         this.first.item.Dispose();
                     }
                 }
                 else
                 {
                     ODBSibling <T> first = this.first;
                     do
                     {
                         ODBNode <T> item = first.item;
                         first = first.item.n;
                         if (!this.hashSet.Contains(item.self))
                         {
                             item.Dispose();
                             if (this.count == count)
                             {
                                 break;
                             }
                         }
                     }while (first.has);
                 }
             }
         }
         else
         {
             this.DoClear();
         }
     }
 }
Example #13
0
 public void Dispose()
 {
     if (this.hasList)
     {
         if (this.n.has)
         {
             if (!this.p.has)
             {
                 this.n.item.p   = new ODBSibling <T>();
                 this.list.first = this.n;
                 ODBList <T> ts = this.list;
                 ts.count = ts.count - 1;
             }
             else
             {
                 this.p.item.n = this.n;
                 this.n.item.p = this.p;
                 this.p        = new ODBSibling <T>();
                 ODBList <T> ts1 = this.list;
                 ts1.count = ts1.count - 1;
             }
         }
         else if (!this.p.has)
         {
             this.list.count = 0;
             this.list.any   = false;
             this.list.first = new ODBSibling <T>();
             this.list.last  = new ODBSibling <T>();
         }
         else
         {
             this.p.item.n  = new ODBSibling <T>();
             this.list.last = this.p;
             this.p         = new ODBSibling <T>();
             ODBList <T> ts2 = this.list;
             ts2.count = ts2.count - 1;
         }
         this.hasList = false;
         this.list    = null;
         ODBNode <T> .recycle.Push(this);
     }
 }
Example #14
0
 protected void DoIntersectWith(ODBList <T> list)
 {
     if (this.any)
     {
         if (!list.any)
         {
             this.DoClear();
         }
         else if (list != this)
         {
             this.hashSet.IntersectWith(list.hashSet);
             int count = this.hashSet.Count;
             if (count != 0)
             {
                 ODBSibling <T> oDBSibling = this.first;
                 do
                 {
                     ODBNode <T> oDBNode = oDBSibling.item;
                     oDBSibling = oDBSibling.item.n;
                     if (this.hashSet.Contains(oDBNode.self))
                     {
                         continue;
                     }
                     oDBNode.Dispose();
                     if (this.count != count)
                     {
                         continue;
                     }
                     break;
                 }while (oDBSibling.has);
             }
             else
             {
                 while (this.any)
                 {
                     this.first.item.Dispose();
                 }
             }
         }
     }
 }
Example #15
0
 public void Dispose()
 {
     if (this.hasList)
     {
         if (this.n.has)
         {
             if (this.p.has)
             {
                 this.p.item.n = this.n;
                 this.n.item.p = this.p;
                 this.p        = new ODBSibling <T>();
                 this.list.count--;
             }
             else
             {
                 this.n.item.p   = new ODBSibling <T>();
                 this.list.first = this.n;
                 this.list.count--;
             }
         }
         else if (this.p.has)
         {
             this.p.item.n  = new ODBSibling <T>();
             this.list.last = this.p;
             this.p         = new ODBSibling <T>();
             this.list.count--;
         }
         else
         {
             this.list.count = 0;
             this.list.any   = false;
             this.list.first = new ODBSibling <T>();
             this.list.last  = new ODBSibling <T>();
         }
         this.hasList = false;
         this.list    = null;
         ODBNode <T> .recycle.Push((ODBNode <T>) this);
     }
 }
Example #16
0
 protected void DoExceptWith(ODBList <T> list)
 {
     if (this.any && 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();
                 }
             }while (first.has);
         }
     }
 }
Example #17
0
 public ODBForwardEnumerator(ODBSibling <T> sibling)
 {
     this.sib     = sibling;
     this.Current = (T)null;
 }
Example #18
0
 public ODBForwardEnumerable(ODBSibling <T> sibling)
 {
     this.sibling = sibling;
 }
Example #19
0
 public void Dispose()
 {
     this.sib     = new ODBSibling <T>();
     this.Current = null;
 }
 public ODBReverseEnumerable(ODBSibling <T> sibling)
 {
     this.sibling = sibling;
 }
Example #21
0
 public ODBReverseEnumerator(ODBSibling <T> sibling)
 {
     this.sib     = sibling;
     this.Current = null;
 }