Beispiel #1
0
 public void SetNext <_T0>(IntrusiveCollection <_T0> list, IntrusiveCollection.Element
                           next)
     where _T0 : IntrusiveCollection.Element
 {
     // IntrusiveCollection.Element
     System.Diagnostics.Debug.Assert(list == pool.GetDirectiveList());
     this.next = next;
 }
Beispiel #2
0
 public void SetPrev <_T0>(IntrusiveCollection <_T0> list, IntrusiveCollection.Element
                           prev)
     where _T0 : IntrusiveCollection.Element
 {
     // IntrusiveCollection.Element
     System.Diagnostics.Debug.Assert(list == pool.GetDirectiveList());
     this.prev = prev;
 }
Beispiel #3
0
 public void RemoveInternal <_T0>(IntrusiveCollection <_T0> list)
     where _T0 : IntrusiveCollection.Element
 {
     // IntrusiveCollection.Element
     System.Diagnostics.Debug.Assert(list == pool.GetDirectiveList());
     this.pool = null;
     this.prev = null;
     this.next = null;
 }
Beispiel #4
0
 public IntrusiveCollection.Element GetNext <_T0>(IntrusiveCollection <_T0> list)
     where _T0 : IntrusiveCollection.Element
 {
     // IntrusiveCollection.Element
     if (list != pool.GetDirectiveList())
     {
         return(null);
     }
     return(this.next);
 }
Beispiel #5
0
 //
 // IntrusiveCollection.Element implementation
 //
 public void InsertInternal <_T0>(IntrusiveCollection <_T0> list, IntrusiveCollection.Element
                                  prev, IntrusiveCollection.Element next)
     where _T0 : IntrusiveCollection.Element
 {
     // IntrusiveCollection.Element
     System.Diagnostics.Debug.Assert(this.pool == null);
     this.pool = ((CachePool.DirectiveList)list).GetCachePool();
     this.prev = prev;
     this.next = next;
 }
Beispiel #6
0
 public bool IsInList <_T0>(IntrusiveCollection <_T0> list)
     where _T0 : IntrusiveCollection.Element
 {
     for (int i = 0; i < triplets.Length; i += 3)
     {
         if (triplets[i] == list)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #7
0
 public IntrusiveCollection.Element GetNext <_T0>(IntrusiveCollection <_T0> list)
     where _T0 : IntrusiveCollection.Element
 {
     for (int i = 0; i < triplets.Length; i += 3)
     {
         if (triplets[i] == list)
         {
             return((IntrusiveCollection.Element)triplets[i + 2]);
         }
     }
     throw new RuntimeException("Called getNext on an element that wasn't " + "in the list."
                                );
 }
Beispiel #8
0
 public void SetNext <_T0>(IntrusiveCollection <_T0> list, IntrusiveCollection.Element
                           next)
     where _T0 : IntrusiveCollection.Element
 {
     for (int i = 0; i < triplets.Length; i += 3)
     {
         if (triplets[i] == list)
         {
             triplets[i + 2] = next;
             return;
         }
     }
     throw new RuntimeException("Called setNext on an element that wasn't " + "in the list."
                                );
 }
Beispiel #9
0
 public void RemoveInternal <_T0>(IntrusiveCollection <_T0> list)
     where _T0 : IntrusiveCollection.Element
 {
     for (int i = 0; i < triplets.Length; i += 3)
     {
         if (triplets[i] == list)
         {
             object[] newTriplets = new object[triplets.Length - 3];
             System.Array.Copy(triplets, 0, newTriplets, 0, i);
             System.Array.Copy(triplets, i + 3, newTriplets, i, triplets.Length - (i + 3));
             triplets = newTriplets;
             return;
         }
     }
     throw new RuntimeException("Called remove on an element that wasn't " + "in the list."
                                );
 }
Beispiel #10
0
 public void InsertInternal <_T0>(IntrusiveCollection <_T0> list, IntrusiveCollection.Element
                                  prev, IntrusiveCollection.Element next)
     where _T0 : IntrusiveCollection.Element
 {
     for (int i = 0; i < triplets.Length; i += 3)
     {
         if (triplets[i] == list)
         {
             throw new RuntimeException("Trying to re-insert an element that " + "is already in the list."
                                        );
         }
     }
     object[] newTriplets = Arrays.CopyOf(triplets, triplets.Length + 3);
     newTriplets[triplets.Length]     = list;
     newTriplets[triplets.Length + 1] = prev;
     newTriplets[triplets.Length + 2] = next;
     triplets = newTriplets;
 }
Beispiel #11
0
 public bool IsInList <_T0>(IntrusiveCollection <_T0> list)
     where _T0 : IntrusiveCollection.Element
 {
     // IntrusiveCollection.Element
     return(pool == null ? false : list == pool.GetDirectiveList());
 }