Ejemplo n.º 1
0
#pragma warning disable 0219
    public static void Test0()
    {
        Console.WriteLine("Performance_ViDoubleLink3.Test0");
        ViDoubleLink3 <UInt32> list = new ViDoubleLink3 <UInt32>();
        UInt32 cnt   = 10000000;
        UInt32 round = 100;

        Console.WriteLine(DateTime.Now);
        for (UInt32 idx = 0; idx < cnt; ++idx)
        {
            list.PushBack(idx);
        }
        Console.WriteLine(DateTime.Now);
        for (UInt32 idx = 0; idx < round; ++idx)
        {
            ViDoubleLinkNode3 <UInt32> iter = list.GetHead();
            while (!list.IsEnd(iter))
            {
                UInt32 value = iter.Data;
                ViDoubleLink3 <UInt32> .Next(ref iter);

                ///<使用>
                ///</使用>
            }
        }
        Console.WriteLine(DateTime.Now);
    }
Ejemplo n.º 2
0
    static void _PushBefore(ViDoubleLinkNode3 <T> after, ViDoubleLink3 <T> list)
    {
        if (list.IsEmpty())
        {
            return;
        }
        ViDoubleLinkNode3 <T> first = list._root._next;
        ViDoubleLinkNode3 <T> back  = list._root._pre;
        ViDoubleLinkNode3 <T> pre   = after._pre;

        _Link(pre, first);
        _Link(back, after);
        list._Init();
    }
Ejemplo n.º 3
0
    static void _PushAfter(ViDoubleLinkNode3 <T> before, ViDoubleLink3 <T> list)
    {
        if (list.IsEmpty())
        {
            return;
        }
        ViDoubleLinkNode3 <T> first = list._root._next;
        ViDoubleLinkNode3 <T> back  = list._root._pre;
        ViDoubleLinkNode3 <T> next  = before._next;

        _Link(before, first);
        _Link(back, next);
        list._Init();
    }
Ejemplo n.º 4
0
    void _Check(ViVector3 center)
    {
        ViDebuger.AssertError(_deleIsInRange);
        ViDoubleLinkNode3 <ViRefPtr <TEntity> > iter = _objs.GetHead();

        while (!_objs.IsEnd(iter))
        {
            TEntity obj = iter.Data.Obj;
            ViDoubleLink3 <ViRefPtr <TEntity> > .Next(ref iter);

            if (!_deleIsInRange(obj, center))
            {
                _objs.Remove(iter);
            }
        }
    }
Ejemplo n.º 5
0
    public static void Test1()
    {
        Console.WriteLine("Performance_ViDoubleLink3.Test1");
        ViDoubleLink3 <UInt32> list = new ViDoubleLink3 <UInt32>();
        UInt32 cnt   = 10000000;
        UInt32 round = 100;

        Console.WriteLine(DateTime.Now);
        for (UInt32 idx = 0; idx < cnt; ++idx)
        {
            list.PushBack(idx);
        }
        Console.WriteLine(DateTime.Now);
        for (UInt32 idx = 0; idx < round; ++idx)
        {
            foreach (UInt32 value in list)
            {
            }
        }
        Console.WriteLine(DateTime.Now);
    }
Ejemplo n.º 6
0
#pragma warning disable 0219
    public static void Test()
    {
        ViDoubleLink3 <int> list = new ViDoubleLink3 <int>();

        list.PushBack(1);
        list.PushBack(3);

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

                ///<使用>
                Console.WriteLine(value);
                ///</使用>
            }
        }
        {        ///<反向迭代>
            ViDoubleLinkNode3 <int> iter = list.GetTail();
            while (!list.IsEnd(iter))
            {
                int value = iter.Data;
                ViDoubleLink3 <int> .Pre(ref iter);

                ///<使用>
                Console.WriteLine(value);
                ///</使用>
            }
        }

        foreach (int value in list)
        {
            Console.WriteLine(value);
        }
    }
Ejemplo n.º 7
0
    void _EraseFarst(ViVector3 center)
    {
        if (_objs.Count == 0)
        {
            return;
        }
        float fMaxDist = 0.0f;
        ViDoubleLinkNode3 <ViRefPtr <TEntity> > iter    = _objs.GetHead();
        ViDoubleLinkNode3 <ViRefPtr <TEntity> > iterFar = iter;

        while (!_objs.IsEnd(iter))
        {
            TEntity obj = iter.Data.Obj;
            ViDoubleLink3 <ViRefPtr <TEntity> > .Next(ref iter);

            float fDist = obj.GetDistance(center);
            if (fMaxDist <= fDist)
            {
                fMaxDist = fDist;
                iterFar  = iter;
            }
        }
        _objs.Remove(iterFar);
    }
Ejemplo n.º 8
0
 internal Enumerator(ViDoubleLink3 <T> list)
 {
     _root    = list._root;
     _node    = list._root._next;
     _current = default(T);
 }