Exemple #1
0
    public void Update(ViTime64 time)
    {
        if (_time >= time)
        {
            return;
        }
        //! Update迭代
        ViTime64 updateTime = _time;
        ViTime64 span       = _roll0.Span;
        ViTime64 topTime    = time - span;

        while (updateTime <= topTime)
        {
            //! 更新时间
            updateTime += span;
            if (_roll0.IsRoll())
            {
                _AddFastEvent(_roll1.Current, _roll0);
                if (_roll1.IsRoll())
                {
                    _AddEvent(_reserveList, _roll1);
                }
                _roll1.Next();
            }
            _time = updateTime;
            ViDoubleLink1 <ViTimeNodeInterface> currentTimeNodes = _roll0.Current;           //必须先取出来
            _roll0.Next();
            _UpdateTimeList(currentTimeNodes);
        }
    }
Exemple #2
0
#pragma warning disable 0219
    public static void Test()
    {
        ViDoubleLink1 <int> list = new ViDoubleLink1 <int>();
        {
            ViDoubleLinkNode1 <int> node1 = new ViDoubleLinkNode1 <int>();
            ViDoubleLinkNode1 <int> node2 = new ViDoubleLinkNode1 <int>();
            list.PushBack(node1);
            list.PushBack(node2);

            {            ///<正向迭代>
                ViDoubleLinkNode1 <int> iter = list.GetHead();
                while (!list.IsEnd(iter))
                {
                    ViDoubleLink1 <int> .Next(ref iter);

                    ///<使用>
                    ///</使用>
                }
            }
            {            ///<反向迭代>
                ViDoubleLinkNode1 <int> iter = list.GetTail();
                while (!list.IsEnd(iter))
                {
                    ViDoubleLink1 <int> .Pre(ref iter);

                    ///<使用>
                    ///</使用>
                }
            }
        }
    }
Exemple #3
0
 private void _UpdateTimeList(ViDoubleLink1 <ViTimeNodeInterface> list)
 {
     while (list.IsNotEmpty())
     {
         ViTimeNodeInterface timeNode = list.GetHead() as ViTimeNodeInterface;
         ViDebuger.AssertError(timeNode);
         timeNode.Detach();
         timeNode._Exce(this);
     }
     ViDebuger.AssertError(list.IsEmpty());
 }
Exemple #4
0
 public static void PushBefore(ViDoubleLinkNode1 <T> after, ViDoubleLink1 <T> list)
 {
     if (after.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushBefore(after, list);
 }
Exemple #5
0
 public static void PushAfter(ViDoubleLinkNode1 <T> before, ViDoubleLink1 <T> list)
 {
     if (before.IsAttach() == false)
     {
         return;
     }
     if (list.IsEmpty())
     {
         return;
     }
     _PushAfter(before, list);
 }
Exemple #6
0
    static void _PushBefore(ViDoubleLinkNode1 <T> after, ViDoubleLink1 <T> list)
    {
        if (list.IsEmpty())
        {
            return;
        }
        ViDoubleLinkNode1 <T> first = list._root._next;
        ViDoubleLinkNode1 <T> back  = list._root._pre;
        ViDoubleLinkNode1 <T> pre   = after._pre;

        _Link(pre, first);
        _Link(back, after);
        list._Init();
    }
Exemple #7
0
    static void _PushAfter(ViDoubleLinkNode1 <T> before, ViDoubleLink1 <T> list)
    {
        if (list.IsEmpty())
        {
            return;
        }
        ViDoubleLinkNode1 <T> first = list._root._next;
        ViDoubleLinkNode1 <T> back  = list._root._pre;
        ViDoubleLinkNode1 <T> next  = before._next;

        _Link(before, first);
        _Link(back, next);
        list._Init();
    }
Exemple #8
0
    //
    private static void _AddEvent(ViDoubleLink1 <ViTimeNodeInterface> list, ViTimeNodeInterface node)
    {
        ViDoubleLinkNode1 <ViTimeNodeInterface> iter = list.GetHead();

        while (!list.IsEnd(iter))
        {
            ViTimeNodeInterface timeNode = iter as ViTimeNodeInterface;
            ViDebuger.AssertError(timeNode);
            ViDoubleLink1 <ViTimeNodeInterface> .Next(ref iter);

            if (timeNode.Time > node.Time)
            {
                ViDoubleLink1 <ViTimeNodeInterface> .PushBefore(iter, node);

                return;
            }
        }
        list.PushBack(node);
    }
Exemple #9
0
    private static void _AddEvent(ViDoubleLink1 <ViTimeNodeInterface> list, TimeRoll timeRoll)
    {
        ViDoubleLinkNode1 <ViTimeNodeInterface> iter = list.GetHead();

        while (!list.IsEnd(iter))
        {
            ViTimeNodeInterface timeNode = iter as ViTimeNodeInterface;
            ViDebuger.AssertError(timeNode);
            ViDoubleLink1 <ViTimeNodeInterface> .Next(ref iter);

            if (timeRoll.InRange(timeNode.Time))
            {
                timeRoll.Add(timeNode);
            }
            else
            {
                break;
            }
        }
    }
Exemple #10
0
 public void PushFront(ViDoubleLink1 <T> list)
 {
     _PushAfter(_root, list);
 }
Exemple #11
0
 public void PushBack(ViDoubleLink1 <T> list)
 {
     _PushBefore(_root, list);
 }