Exemple #1
0
 private IntrusiveCollection.Element RemoveElement(IntrusiveCollection.Element elem
                                                   )
 {
     IntrusiveCollection.Element prev = elem.GetPrev(this);
     IntrusiveCollection.Element next = elem.GetNext(this);
     elem.RemoveInternal(this);
     prev.SetNext(this, next);
     next.SetPrev(this, prev);
     size--;
     return(next);
 }
Exemple #2
0
 /// <summary>Add an element to the front of the list.</summary>
 /// <param name="elem">The new element to add.</param>
 public virtual bool AddFirst(IntrusiveCollection.Element elem)
 {
     if (elem == null)
     {
         return(false);
     }
     if (elem.IsInList(this))
     {
         return(false);
     }
     IntrusiveCollection.Element next = root.GetNext(this);
     next.SetPrev(this, elem);
     root.SetNext(this, elem);
     elem.InsertInternal(this, root, next);
     size++;
     return(true);
 }
Exemple #3
0
 /// <summary>Add an element to the end of the list.</summary>
 /// <param name="elem">The new element to add.</param>
 public virtual bool AddItem(E elem)
 {
     if (elem == null)
     {
         return(false);
     }
     if (elem.IsInList(this))
     {
         return(false);
     }
     IntrusiveCollection.Element prev = root.GetPrev(this);
     prev.SetNext(this, elem);
     root.SetPrev(this, elem);
     elem.InsertInternal(this, prev, root);
     size++;
     return(true);
 }