Пример #1
0
#pragma warning disable 0219
    public static void Test()
    {
        ViDoubleLink2 <int> list = new ViDoubleLink2 <int>();
        {
            ViDoubleLinkNode2 <int> node1 = new ViDoubleLinkNode2 <int>();
            node1.Data = 1;
            ViDoubleLinkNode2 <int> node2 = new ViDoubleLinkNode2 <int>();
            node2.Data = 2;
            list.PushBack(node1);
            list.PushBack(node2);

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

            {//<反向迭代>
                ViDoubleLinkNode2 <int> iter = list.GetTail();
                while (!list.IsEnd(iter))
                {
                    int value = iter.Data;
                    ViDoubleLink2 <int> .Pre(ref iter);
                }
            }
        }
    }
Пример #2
0
    //-------------------------------------------------------------------------
    public void Reset()
    {
        ViDoubleLinkNode2 <ViAstarStep> iter = _openList.GetHead();

        while (!_openList.IsEnd(iter))
        {
            iter.Data.Clear();
            ViDoubleLink2 <ViAstarStep> .Next(ref iter);
        }
        _openList.Clear();
        //
        iter = _closeList.GetHead();
        while (!_closeList.IsEnd(iter))
        {
            iter.Data.Clear();
            ViDoubleLink2 <ViAstarStep> .Next(ref iter);
        }
        _closeList.Clear();
        //
        _openHeap.Clear();
    }