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

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

            _Link(before, node);
            _Link(node, next);
        }
示例#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);
        }
示例#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);
        }
示例#7
0
        //-------------------------------------------------------------------------
        public void SetValue(T value)
        {
            EbDoubleLinkNode2 <T> next = _root._next;

            while (next != _root)
            {
                next.Data = value;
                next      = next._next;
            }
        }
示例#8
0
 //-------------------------------------------------------------------------
 public void Detach()
 {
     if (_pre != null)
     {
         _pre._next = _next;
         _next._pre = _pre;
         _pre       = null;
         _next      = null;
     }
 }
示例#9
0
 //-------------------------------------------------------------------------
 public static void PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkList2 <T> list)
 {
     if (before.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushAfter(before, list);
 }
示例#10
0
 //-------------------------------------------------------------------------
 public static void PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkList2 <T> list)
 {
     if (after.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushBefore(after, list);
 }
示例#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);
     }
 }
示例#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();
        }
示例#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();
        }
示例#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();
        }
示例#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();
        }
示例#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);
        }
示例#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();
        }
示例#18
0
 //-------------------------------------------------------------------------
 public void PushBack(EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushBefore(_root, node);
 }
示例#19
0
 //-------------------------------------------------------------------------
 public static void PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushBefore(after, node);
 }
示例#20
0
 //-------------------------------------------------------------------------
 public static void PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushAfter(before, node);
 }
示例#21
0
 //-------------------------------------------------------------------------
 public static void Pre(ref EbDoubleLinkNode2 <T> node)
 {
     node = node._pre;
 }
示例#22
0
 //-------------------------------------------------------------------------
 public static void Next(ref EbDoubleLinkNode2 <T> node)
 {
     node = node._next;
 }
示例#23
0
 //-------------------------------------------------------------------------
 public void PushFront(EbDoubleLinkNode2 <T> node)
 {
     node.Detach();
     _PushAfter(_root, node);
 }
示例#24
0
 //-------------------------------------------------------------------------
 static void _Link(EbDoubleLinkNode2 <T> pre, EbDoubleLinkNode2 <T> next)
 {
     pre._next = next;
     next._pre = pre;
 }
示例#25
0
 //-------------------------------------------------------------------------
 public bool IsEnd(EbDoubleLinkNode2 <T> node)
 {
     return(node == _root);
 }