示例#1
0
        //结尾追加
        public void Append(T item)
        {
            BdNode <T> tnode = new BdNode <T>(item, _linkTail, null);

            _linkTail.Next = tnode;
            _linkTail      = tnode;
            _size++;
        }
示例#2
0
        // 将节点插入到第index位置之前
        public void Insert(T item)
        {
            BdNode <T> tnode = new BdNode <T>(item, null, _linkHead);

            _linkHead.Prev = tnode;
            _linkHead      = tnode;
            _size++;
        }
示例#3
0
 public DoubleLink()
 {
     _linkHead      = new BdNode <T>(default(T), null, null); //双向链表 表头为空
     _linkHead.Next = _linkTail;
     _linkTail      = new BdNode <T>(default(T), null, null); //双向链表 表头为空
     _linkTail.Prev = _linkHead;
     _size          = 0;
 }
示例#4
0
            public bool MoveNext()
            {
                if (_currentNode == null)
                {
                    _currentNode = doubleLink._linkHead;
                }
                if (_currentNode.Next == null)
                {
                    return(false);
                }
                else
                {
                    _currentNode = _currentNode.Next;//进1
                    _current     = _currentNode.Data;
                    return(true);
                }

                //if(nextNode)

                //_currentNode = doubleLink._linkHead.Next;
                //_current = _currentNode.Data;

                //throw new NotImplementedException();
            }
示例#5
0
 public BdNode(T val, BdNode <T> prev, BdNode <T> next)
 {
     this.Data = val;
     this.Prev = prev;
     this.Next = next;
 }
示例#6
0
 public void Reset()
 {
     _currentNode = null;
     _current     = default(T);
 }