예제 #1
0
        internal void Remove(RingPointLinkedListNode curNode)
        {
            if (object.ReferenceEquals(curNode, this.RootNode))
                this.RootNode = curNode.Previous; //re-establish a root node from those already visited

            curNode.Previous.Next = curNode.Next;
            curNode.Next.Previous = curNode.Previous;
            curNode.Previous = null;
            curNode.Next = null;
            curNode.Point = null;
            this.Count--;
        }
예제 #2
0
        internal RingPointLinkedList(IEnumerable<Point2<T>> points)
        {
            if (points == null)
                return;

            this.Count = 0;
            this.RootNode = new RingPointLinkedListNode();
            RingPointLinkedListNode curNode = this.RootNode;

            foreach (Point2<T> curPoint in points)
            {
                curNode.Point = curPoint;
                curNode.Next = new RingPointLinkedListNode();
                curNode.Next.Previous = curNode;
                curNode = curNode.Next;
                this.Count++;
            }

            curNode = curNode.Previous;
            curNode.Next.Previous = null; //release empty node
            curNode.Next = this.RootNode;
            this.RootNode.Previous = curNode;
        }