Exemplo n.º 1
0
        //-------------------------------------------------------------------------
        public static void Test()
        {
            EbDoubleLinkList2 <int> list  = new EbDoubleLinkList2 <int>();
            EbDoubleLinkNode2 <int> node1 = new EbDoubleLinkNode2 <int>();

            node1.Data = 1;
            EbDoubleLinkNode2 <int> node2 = new EbDoubleLinkNode2 <int>();

            node2.Data = 2;
            list.PushBack(node1);
            list.PushBack(node2);

            {// 正向迭代
                EbDoubleLinkNode2 <int> iter = list.GetHead();
                while (!list.IsEnd(iter))
                {
                    //int value = iter.Data;
                    EbDoubleLinkList2 <int> .Next(ref iter);
                }
            }

            {// 反向迭代
                EbDoubleLinkNode2 <int> iter = list.GetTail();
                while (!list.IsEnd(iter))
                {
                    //int value = iter.Data;
                    EbDoubleLinkList2 <int> .Pre(ref iter);
                }
            }
        }
Exemplo n.º 2
0
 //-------------------------------------------------------------------------
 public static void PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkList2 <T> list)
 {
     if (after.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushBefore(after, list);
 }
Exemplo n.º 3
0
 //-------------------------------------------------------------------------
 public static void PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkList2 <T> list)
 {
     if (before.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushAfter(before, list);
 }
Exemplo n.º 4
0
        //-------------------------------------------------------------------------
        static void _PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkList2 <T> list)
        {
            if (list.IsEmpty())
            {
                return;
            }
            EbDoubleLinkNode2 <T> first = list._root._next;
            EbDoubleLinkNode2 <T> back  = list._root._pre;
            EbDoubleLinkNode2 <T> pre   = after._pre;

            _Link(pre, first);
            _Link(back, after);
            list._Init();
        }
Exemplo n.º 5
0
        //-------------------------------------------------------------------------
        static void _PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkList2 <T> list)
        {
            if (list.IsEmpty())
            {
                return;
            }
            EbDoubleLinkNode2 <T> first = list._root._next;
            EbDoubleLinkNode2 <T> back  = list._root._pre;
            EbDoubleLinkNode2 <T> next  = before._next;

            _Link(before, first);
            _Link(back, next);
            list._Init();
        }
Exemplo n.º 6
0
        //---------------------------------------------------------------------
        public float Length()
        {
            float     len     = 0.0f;
            EbVector3 pos_pre = mCurrentPos;
            EbDoubleLinkNode2 <EbRouteNode> iter = mListNode.GetHead();

            while (!mListNode.IsEnd(iter))
            {
                EbRouteNode value = iter.Data;
                EbDoubleLinkList2 <EbRouteNode> .Next(ref iter);

                len    += Distance(value._pos, pos_pre);
                pos_pre = value._pos;
            }
            return(len);
        }
Exemplo n.º 7
0
        //---------------------------------------------------------------------
        public void Reset()
        {
            EbDoubleLinkNode2 <EbAstarStep> iter = mOpenList.GetHead();

            while (!mOpenList.IsEnd(iter))
            {
                iter.Data.Clear();
                EbDoubleLinkList2 <EbAstarStep> .Next(ref iter);
            }
            mOpenList.Clear();

            iter = mCloseList.GetHead();
            while (!mCloseList.IsEnd(iter))
            {
                iter.Data.Clear();
                EbDoubleLinkList2 <EbAstarStep> .Next(ref iter);
            }
            mCloseList.Clear();

            mOpenHeap.Clear();
        }
Exemplo n.º 8
0
 //---------------------------------------------------------------------
 public void Delete(EbDoubleLinkList2 <T> nodes)
 {
     mListNode.PushBack(nodes);
 }
Exemplo n.º 9
0
 //-------------------------------------------------------------------------
 public void PushFront(EbDoubleLinkList2 <T> list)
 {
     _PushAfter(_root, list);
 }
Exemplo n.º 10
0
 //-------------------------------------------------------------------------
 public void PushBack(EbDoubleLinkList2 <T> list)
 {
     _PushBefore(_root, list);
 }