Ejemplo n.º 1
0
        public SuperLinkedListNode <T> AddAfter(SuperLinkedListNode <T> node, SuperLinkedList <T> newLinkedList)
        {
            if (newLinkedList.Count <= 0)
            {
                return(node);
            }

            SuperLinkedListNode <T> cur = node;

            foreach (T t in newLinkedList)
            {
                cur = this.AddAfter(cur, t);
            }

            return(cur);

            //SuperLinkedListNode<T> nodeNext = node.Next;
            //SuperLinkedListNode<T> newLast = newLinkedList.Last;

            //node.next = newLinkedList.First;
            //newLinkedList.First.prev = node;

            //if (nodeNext != null)
            //{
            //    newLast.next = nodeNext;
            //    nodeNext.prev = newLast;
            //}
            //else
            //{
            //    newLast.next = head;
            //    head.prev = newLast;
            //}

            //count += newLinkedList.Count;
        }
Ejemplo n.º 2
0
 internal Enumerator(SerializationInfo info, StreamingContext context)
 {
     siInfo  = info;
     list    = null;
     version = 0;
     node    = null;
     current = default(T);
     index   = 0;
 }
Ejemplo n.º 3
0
 internal Enumerator(SuperLinkedList <T> list)
 {
     this.list = list;
     version   = list.version;
     node      = list.head;
     current   = default(T);
     index     = 0;
     siInfo    = null;
 }
Ejemplo n.º 4
0
 internal Enumerator(StreamingContext context)
 {
     //siInfo = info;
     list    = null;
     version = 0;
     node    = null;
     current = default(T);
     index   = 0;
 }
Ejemplo n.º 5
0
            void IDeserializationCallback.OnDeserialization(Object sender)
            {
                if (list != null)
                {
                    return; //Somebody had a dependency on this Dictionary and fixed us up before the ObjectManager got to it.
                }

                if (siInfo == null)
                {
                    throw new SerializationException("SR.Serialization_InvalidOnDeser");
                }

                list    = (SuperLinkedList <T>)siInfo.GetValue(LinkedListName, typeof(SuperLinkedList <T>));
                version = siInfo.GetInt32(VersionName);
                current = (T)siInfo.GetValue(CurrentValueName, typeof(T));
                index   = siInfo.GetInt32(IndexName);

                if (list.siInfo != null)
                {
                    list.OnDeserialization(sender);
                }

                if (index == list.Count + 1)
                {  // end of enumeration
                    node = null;
                }
                else
                {
                    node = list.First;
                    // We don't care if we can point to the correct node if the LinkedList was changed
                    // MoveNext will throw upon next call and Current has the correct value.
                    if (node != null && index != 0)
                    {
                        for (int i = 0; i < index; i++)
                        {
                            node = node.next;
                        }
                        if (node == list.First)
                        {
                            node = null;
                        }
                    }
                }
                siInfo = null;
            }
Ejemplo n.º 6
0
 internal void Invalidate()
 {
     list = null;
     next = null;
     prev = null;
 }
Ejemplo n.º 7
0
 internal SuperLinkedListNode(SuperLinkedList <T> list, T value)
 {
     this.list = list;
     this.item = value;
 }