コード例 #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);
                }
            }
        }
コード例 #2
0
 //-------------------------------------------------------------------------
 public static void PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkList2 <T> list)
 {
     if (after.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushBefore(after, list);
 }
コード例 #3
0
 //-------------------------------------------------------------------------
 public static void PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkList2 <T> list)
 {
     if (before.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushAfter(before, list);
 }
コード例 #4
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();
        }
コード例 #5
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();
        }
コード例 #6
0
ファイル: EbRoute.cs プロジェクト: hackerlank/Fishing
        //---------------------------------------------------------------------
        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);
        }
コード例 #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();
        }
コード例 #8
0
 //-------------------------------------------------------------------------
 public void PushFront(EbDoubleLinkList2 <T> list)
 {
     _PushAfter(_root, list);
 }
コード例 #9
0
 //-------------------------------------------------------------------------
 public void PushBack(EbDoubleLinkList2 <T> list)
 {
     _PushBefore(_root, list);
 }
コード例 #10
0
ファイル: EbRoute.cs プロジェクト: hackerlank/Fishing
 //---------------------------------------------------------------------
 public void Delete(EbDoubleLinkList2 <T> nodes)
 {
     mListNode.PushBack(nodes);
 }