//------------------------------------------------------------------------- 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); } } }
//------------------------------------------------------------------------- public static void PushBefore(EbDoubleLinkNode2 <T> after, EbDoubleLinkList2 <T> list) { if (after.IsAttach() == false) { return; } if (list.IsEmpty()) { return; } _PushBefore(after, list); }
//------------------------------------------------------------------------- public static void PushAfter(EbDoubleLinkNode2 <T> before, EbDoubleLinkList2 <T> list) { if (before.IsAttach() == false) { return; } if (list.IsEmpty()) { return; } _PushAfter(before, list); }
//------------------------------------------------------------------------- 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(); }
//------------------------------------------------------------------------- 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(); }
//--------------------------------------------------------------------- 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); }
//--------------------------------------------------------------------- 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(); }
//------------------------------------------------------------------------- public void PushFront(EbDoubleLinkList2 <T> list) { _PushAfter(_root, list); }
//------------------------------------------------------------------------- public void PushBack(EbDoubleLinkList2 <T> list) { _PushBefore(_root, list); }
//--------------------------------------------------------------------- public void Delete(EbDoubleLinkList2 <T> nodes) { mListNode.PushBack(nodes); }