Esempio n. 1
0
        //-------------------------------------------------------------------------
        static void _PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkNode2 <T> node)
        {
            EbDoubleLinkNode2 <T> pre = after._pre;

            _Link(pre, node);
            _Link(node, after);
        }
Esempio n. 2
0
 //---------------------------------------------------------------------
 public void Delete(EbDoubleLinkNode2 <T> node)
 {
     if (node != null)
     {
         mListNode.PushBack(node);
     }
 }
Esempio n. 3
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);
                }
            }
        }
Esempio n. 4
0
        //-------------------------------------------------------------------------
        static void _PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkNode2 <T> node)
        {
            EbDoubleLinkNode2 <T> next = before._next;

            _Link(before, node);
            _Link(node, next);
        }
Esempio n. 5
0
        //---------------------------------------------------------------------
        public void Append(EbVector3 pos)
        {
            EbDoubleLinkNode2 <EbRouteNode> node = mNodeAlloc.New();

            node.Data._eventId = EbRouteNode.NULL_EVENT;
            node.Data._pos     = pos;
            mListNode.PushBack(node);
        }
Esempio n. 6
0
        //---------------------------------------------------------------------
        public void Append(EbVector3 pos, uint event_id)
        {
            EbDoubleLinkNode2 <EbRouteNode> node = mNodeAlloc.New();

            node.Data._eventId = event_id;
            node.Data._pos     = pos;
            mListNode.PushBack(node);
        }
Esempio n. 7
0
        //-------------------------------------------------------------------------
        public void SetValue(T value)
        {
            EbDoubleLinkNode2 <T> next = _root._next;

            while (next != _root)
            {
                next.Data = value;
                next      = next._next;
            }
        }
Esempio n. 8
0
 //-------------------------------------------------------------------------
 public void Detach()
 {
     if (_pre != null)
     {
         _pre._next = _next;
         _next._pre = _pre;
         _pre       = null;
         _next      = null;
     }
 }
Esempio n. 9
0
 //-------------------------------------------------------------------------
 public static void PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkList2 <T> list)
 {
     if (before.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushAfter(before, list);
 }
Esempio n. 10
0
 //-------------------------------------------------------------------------
 public static void PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkList2 <T> list)
 {
     if (after.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushBefore(after, list);
 }
Esempio n. 11
0
 //---------------------------------------------------------------------
 public EbDoubleLinkNode2 <T> New()
 {
     if (mListNode.IsEmpty())
     {
         return(new EbDoubleLinkNode2 <T>(new T()));
     }
     else
     {
         EbDoubleLinkNode2 <T> node = mListNode.GetHead();
         node.Detach();
         return(node);
     }
 }
Esempio n. 12
0
        //-------------------------------------------------------------------------
        public void Clear()
        {
            EbDoubleLinkNode2 <T> next = _root._next;

            while (next != _root)
            {
                EbDoubleLinkNode2 <T> nextCopy = next._next;
                next._pre  = null;
                next._next = null;
                next       = nextCopy;
            }
            _Init();
        }
Esempio n. 13
0
        //-------------------------------------------------------------------------
        public void ClearAndClearContent()
        {
            EbDoubleLinkNode2 <T> next = _root._next;

            while (next != _root)
            {
                EbDoubleLinkNode2 <T> nextCopy = next._next;
                next._pre  = null;
                next._next = null;
                next.Data  = default(T);
                next       = nextCopy;
            }
            _Init();
        }
Esempio n. 14
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();
        }
Esempio n. 15
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();
        }
Esempio n. 16
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);
        }
Esempio n. 17
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();
        }
Esempio n. 18
0
 //-------------------------------------------------------------------------
 public void PushBack(EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushBefore(_root, node);
 }
Esempio n. 19
0
 //-------------------------------------------------------------------------
 public static void PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushBefore(after, node);
 }
Esempio n. 20
0
 //-------------------------------------------------------------------------
 public static void PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushAfter(before, node);
 }
Esempio n. 21
0
 //-------------------------------------------------------------------------
 public static void Pre(ref EbDoubleLinkNode2 <T> node)
 {
     node = node._pre;
 }
Esempio n. 22
0
 //-------------------------------------------------------------------------
 public static void Next(ref EbDoubleLinkNode2 <T> node)
 {
     node = node._next;
 }
Esempio n. 23
0
 //-------------------------------------------------------------------------
 public void PushFront(EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushAfter(_root, node);
 }
Esempio n. 24
0
 //-------------------------------------------------------------------------
 static void _Link(EbDoubleLinkNode2 <T> pre, EbDoubleLinkNode2 <T> next)
 {
     pre._next = next;
     next._pre = pre;
 }
Esempio n. 25
0
 //-------------------------------------------------------------------------
 public bool IsEnd(EbDoubleLinkNode2 <T> node)
 {
     return(node == _root);
 }