private void DeleteNode(Collection.Node NodeToBeDeleted, Collection.Node PrevNode)
 {
     if (PrevNode == null)
     {
         this.m_StartOfList = this.m_StartOfList.m_Next;
         if (this.m_StartOfList == null)
         {
             this.m_EndOfList = null;
         }
         else
         {
             this.m_StartOfList.m_Prev = null;
         }
     }
     else
     {
         PrevNode.m_Next = NodeToBeDeleted.m_Next;
         if (PrevNode.m_Next == null)
         {
             this.m_EndOfList = PrevNode;
         }
         else
         {
             PrevNode.m_Next.m_Prev = PrevNode;
         }
     }
     this.m_Count--;
 }
 internal void Insert(int Index, Collection.Node Node)
 {
     Collection.Node prevNode = null;
     if ((Index < 0) || (Index > this.m_Count))
     {
         throw new ArgumentOutOfRangeException("Index");
     }
     Collection.Node nodeAtIndex = this.GetNodeAtIndex(Index, ref prevNode);
     this.Insert(Node, prevNode, nodeAtIndex);
 }
Exemple #3
0
 private void Dispose()
 {
     if (!this.mDisposed)
     {
         this.mCollectionObject.RemoveIterator(this.WeakRef);
         this.mDisposed = true;
     }
     this.mCurrent = null;
     this.mNext    = null;
 }
 private void Dispose()
 {
     if (!this.mDisposed)
     {
         this.mCollectionObject.RemoveIterator(this.WeakRef);
         this.mDisposed = true;
     }
     this.mCurrent = null;
     this.mNext = null;
 }
Exemple #5
0
 public void Reset()
 {
     if (this.mDisposed)
     {
         this.mCollectionObject.AddIterator(this.WeakRef);
         this.mDisposed = false;
     }
     this.mCurrent     = null;
     this.mNext        = null;
     this.mAtBeginning = true;
 }
 internal int IndexOfValue(object Value)
 {
     Collection.Node startOfList = this.m_StartOfList;
     for (int i = 0; startOfList != null; i++)
     {
         if (this.DataIsEqual(startOfList.m_Value, Value))
         {
             return(i);
         }
         startOfList = startOfList.m_Next;
     }
     return(-1);
 }
 internal Collection.Node this[int Index]
 {
     get
     {
         Collection.Node prevNode    = null;
         Collection.Node nodeAtIndex = this.GetNodeAtIndex(Index, ref prevNode);
         if (nodeAtIndex == null)
         {
             throw new ArgumentOutOfRangeException("Index");
         }
         return(nodeAtIndex);
     }
 }
Exemple #8
0
            private Collection.Node GetNodeAtIndex(int Index, [Optional, DefaultParameterValue(null)] ref Collection.Node PrevNode)
            {
                Collection.Node startOfList = this.m_StartOfList;
                int             num         = 0;

                PrevNode = null;
                while ((num < Index) && (startOfList != null))
                {
                    PrevNode    = startOfList;
                    startOfList = startOfList.m_Next;
                    num++;
                }
                return(startOfList);
            }
            private Collection.Node GetNodeAtIndex(int Index, ref Collection.Node PrevNode = null)
            {
                Collection.Node startOfList = this.m_StartOfList;
                int             num         = 0;

                PrevNode = null;
                while ((num < Index) && (startOfList != null))
                {
                    PrevNode    = startOfList;
                    startOfList = startOfList.m_Next;
                    num++;
                }
                return(startOfList);
            }
 internal void Add(Collection.Node Node)
 {
     if (this.m_StartOfList == null)
     {
         this.m_StartOfList = Node;
     }
     else
     {
         this.m_EndOfList.m_Next = Node;
         Node.m_Prev             = this.m_EndOfList;
     }
     this.m_EndOfList = Node;
     this.m_Count++;
 }
            internal Collection.Node RemoveAt(int Index)
            {
                Collection.Node startOfList = this.m_StartOfList;
                int             num         = 0;

                Collection.Node prevNode = null;
                while ((num < Index) && (startOfList != null))
                {
                    prevNode    = startOfList;
                    startOfList = startOfList.m_Next;
                    num++;
                }
                if (startOfList == null)
                {
                    throw new ArgumentOutOfRangeException("Index");
                }
                this.DeleteNode(startOfList, prevNode);
                return(startOfList);
            }
Exemple #12
0
        public void Adjust(Collection.Node Node, AdjustIndexType Type)
        {
            if ((Node != null) && !this.mDisposed)
            {
                switch (Type)
                {
                case AdjustIndexType.Insert:
                    if ((this.mCurrent != null) && (Node == this.mCurrent.m_Next))
                    {
                        this.mNext = Node;
                    }
                    break;

                case AdjustIndexType.Remove:
                    if ((Node != this.mCurrent) && (Node == this.mNext))
                    {
                        this.mNext = this.mNext.m_Next;
                    }
                    break;
                }
            }
        }
 private void Insert(Collection.Node Node, Collection.Node PrevNode, Collection.Node CurrentNode)
 {
     Node.m_Next = CurrentNode;
     if (CurrentNode != null)
     {
         CurrentNode.m_Prev = Node;
     }
     if (PrevNode == null)
     {
         this.m_StartOfList = Node;
     }
     else
     {
         PrevNode.m_Next = Node;
         Node.m_Prev     = PrevNode;
     }
     if (Node.m_Next == null)
     {
         this.m_EndOfList = Node;
     }
     this.m_Count++;
 }
        public void Adjust(Collection.Node Node, AdjustIndexType Type)
        {
            if ((Node != null) && !this.mDisposed)
            {
                switch (Type)
                {
                    case AdjustIndexType.Insert:
                        if ((this.mCurrent != null) && (Node == this.mCurrent.m_Next))
                        {
                            this.mNext = Node;
                        }
                        break;

                    case AdjustIndexType.Remove:
                        if ((Node != this.mCurrent) && (Node == this.mNext))
                        {
                            this.mNext = this.mNext.m_Next;
                        }
                        break;
                }
            }
        }
 public bool MoveNext()
 {
     if (!this.mDisposed)
     {
         if (this.mAtBeginning)
         {
             this.mAtBeginning = false;
             this.mNext = this.mCollectionObject.GetFirstListNode();
         }
         if (this.mNext == null)
         {
             this.Dispose();
             return false;
         }
         this.mCurrent = this.mNext;
         if (this.mCurrent != null)
         {
             this.mNext = this.mCurrent.m_Next;
             return true;
         }
         this.Dispose();
     }
     return false;
 }
Exemple #16
0
 public bool MoveNext()
 {
     if (!this.mDisposed)
     {
         if (this.mAtBeginning)
         {
             this.mAtBeginning = false;
             this.mNext        = this.mCollectionObject.GetFirstListNode();
         }
         if (this.mNext == null)
         {
             this.Dispose();
             return(false);
         }
         this.mCurrent = this.mNext;
         if (this.mCurrent != null)
         {
             this.mNext = this.mCurrent.m_Next;
             return(true);
         }
         this.Dispose();
     }
     return(false);
 }
Exemple #17
0
 internal void AdjustOnListCleared()
 {
     this.mNext = null;
 }
 public void Reset()
 {
     if (this.mDisposed)
     {
         this.mCollectionObject.AddIterator(this.WeakRef);
         this.mDisposed = false;
     }
     this.mCurrent = null;
     this.mNext = null;
     this.mAtBeginning = true;
 }
 internal void RemoveNode(Collection.Node NodeToBeDeleted)
 {
     this.DeleteNode(NodeToBeDeleted, NodeToBeDeleted.m_Prev);
 }
 internal void InsertAfter(Collection.Node Node, Collection.Node NodeToInsertAfter)
 {
     this.Insert(Node, NodeToInsertAfter, NodeToInsertAfter.m_Next);
 }
 internal void Add(Collection.Node Node)
 {
     if (this.m_StartOfList == null)
     {
         this.m_StartOfList = Node;
     }
     else
     {
         this.m_EndOfList.m_Next = Node;
         Node.m_Prev = this.m_EndOfList;
     }
     this.m_EndOfList = Node;
     this.m_Count++;
 }
 internal void Clear()
 {
     this.m_StartOfList = null;
     this.m_EndOfList = null;
     this.m_Count = 0;
 }
 internal void AdjustOnListCleared()
 {
     this.mNext = null;
 }
 private void DeleteNode(Collection.Node NodeToBeDeleted, Collection.Node PrevNode)
 {
     if (PrevNode == null)
     {
         this.m_StartOfList = this.m_StartOfList.m_Next;
         if (this.m_StartOfList == null)
         {
             this.m_EndOfList = null;
         }
         else
         {
             this.m_StartOfList.m_Prev = null;
         }
     }
     else
     {
         PrevNode.m_Next = NodeToBeDeleted.m_Next;
         if (PrevNode.m_Next == null)
         {
             this.m_EndOfList = PrevNode;
         }
         else
         {
             PrevNode.m_Next.m_Prev = PrevNode;
         }
     }
     this.m_Count--;
 }
 internal void Clear()
 {
     this.m_StartOfList = null;
     this.m_EndOfList   = null;
     this.m_Count       = 0;
 }
 internal void InsertBefore(Collection.Node Node, Collection.Node NodeToInsertBefore)
 {
     this.Insert(Node, NodeToInsertBefore.m_Prev, NodeToInsertBefore);
 }
 private void Insert(Collection.Node Node, Collection.Node PrevNode, Collection.Node CurrentNode)
 {
     Node.m_Next = CurrentNode;
     if (CurrentNode != null)
     {
         CurrentNode.m_Prev = Node;
     }
     if (PrevNode == null)
     {
         this.m_StartOfList = Node;
     }
     else
     {
         PrevNode.m_Next = Node;
         Node.m_Prev = PrevNode;
     }
     if (Node.m_Next == null)
     {
         this.m_EndOfList = Node;
     }
     this.m_Count++;
 }