Esempio n. 1
0
        private void method_0(EventTreeItem item)
        {
            item.eventTreeItem_1 = null;
            item.eventTreeItem_0 = null;
            item.eventTreeItem_2 = null;
            item.eventTreeItem_3 = null;
            item.eventTreeItem_4 = item;
            item.dateTime        = item.queue.PeekDateTime();
            if (this.eventTreeItem_0 == null)
            {
                this.eventTreeItem_0 = item;
                return;
            }
            EventTreeItem eventTreeItem  = this.eventTreeItem_0;
            EventTreeItem eventTreeItem2 = null;

            while (!(eventTreeItem.dateTime == item.dateTime))
            {
                if (item.dateTime > eventTreeItem.dateTime)
                {
                    if (eventTreeItem.eventTreeItem_1 == null)
                    {
                        eventTreeItem.eventTreeItem_1 = item;
                        return;
                    }
                    eventTreeItem2 = eventTreeItem;
                    eventTreeItem  = eventTreeItem.eventTreeItem_1;
                }
                else
                {
                    if (eventTreeItem.eventTreeItem_0 == null)
                    {
                        eventTreeItem.eventTreeItem_0 = item;
                        return;
                    }
                    eventTreeItem2 = eventTreeItem;
                    eventTreeItem  = eventTreeItem.eventTreeItem_0;
                }
            }
            item.eventTreeItem_3          = eventTreeItem;
            eventTreeItem.eventTreeItem_2 = item;
            item.eventTreeItem_4          = eventTreeItem.eventTreeItem_4;
            item.eventTreeItem_1          = eventTreeItem.eventTreeItem_1;
            item.eventTreeItem_0          = eventTreeItem.eventTreeItem_0;
            if (eventTreeItem2 == null)
            {
                this.eventTreeItem_0 = item;
                return;
            }
            if (item.dateTime > eventTreeItem2.dateTime)
            {
                eventTreeItem2.eventTreeItem_1 = item;
                return;
            }
            eventTreeItem2.eventTreeItem_0 = item;
        }
Esempio n. 2
0
        public Event Read()
        {
            if (this.eventTreeItem_1 != null)
            {
                throw new Exception("EventTree::Read Can not read from a tree with empty queue");
            }
            EventTreeItem eventTreeItem  = this.eventTreeItem_0;
            EventTreeItem eventTreeItem2 = null;

            while (eventTreeItem.eventTreeItem_0 != null)
            {
                eventTreeItem2 = eventTreeItem;
                eventTreeItem  = eventTreeItem.eventTreeItem_0;
            }
            if (eventTreeItem.eventTreeItem_3 != null)
            {
                EventTreeItem eventTreeItem_ = eventTreeItem.eventTreeItem_4;
                eventTreeItem.eventTreeItem_4.eventTreeItem_2.eventTreeItem_3 = null;
                eventTreeItem.eventTreeItem_4 = eventTreeItem.eventTreeItem_4.eventTreeItem_2;
                eventTreeItem = eventTreeItem_;
            }
            else
            {
                if (eventTreeItem2 != null)
                {
                    eventTreeItem2.eventTreeItem_0 = eventTreeItem.eventTreeItem_1;
                }
                else
                {
                    this.eventTreeItem_0 = eventTreeItem.eventTreeItem_1;
                }
                eventTreeItem.eventTreeItem_1 = null;
            }
            Event @event = eventTreeItem.queue.Read();

            if (@event.TypeId == EventType.OnQueueClosed)
            {
                if (this.eventTreeItem_0 == null)
                {
                    @event = new OnSimulatorStop();
                }
            }
            else if (eventTreeItem.queue.IsEmpty())
            {
                this.eventTreeItem_1 = eventTreeItem;
            }
            else
            {
                this.method_0(eventTreeItem);
            }
            return(@event);
        }
Esempio n. 3
0
        public void Add(IEventQueue queue)
        {
            if (queue.IsEmpty())
            {
                throw new Exception($"EventTree::Add Can not add queue, the queue is empty : {queue.Name}");
            }

            var item = new EventTreeItem(queue);

            if (this.eventTreeItem_0 == null)
            {
                this.eventTreeItem_0 = item;
                return;
            }
            this.method_0(item);
        }
Esempio n. 4
0
 private void method_0(EventTreeItem item)
 {
     item.eventTreeItem_1 = null;
     item.eventTreeItem_0 = null;
     item.eventTreeItem_2 = null;
     item.eventTreeItem_3 = null;
     item.eventTreeItem_4 = item;
     item.dateTime = item.queue.PeekDateTime();
     if (this.eventTreeItem_0 == null)
     {
         this.eventTreeItem_0 = item;
         return;
     }
     EventTreeItem eventTreeItem = this.eventTreeItem_0;
     EventTreeItem eventTreeItem2 = null;
     while (!(eventTreeItem.dateTime == item.dateTime))
     {
         if (item.dateTime > eventTreeItem.dateTime)
         {
             if (eventTreeItem.eventTreeItem_1 == null)
             {
                 eventTreeItem.eventTreeItem_1 = item;
                 return;
             }
             eventTreeItem2 = eventTreeItem;
             eventTreeItem = eventTreeItem.eventTreeItem_1;
         }
         else
         {
             if (eventTreeItem.eventTreeItem_0 == null)
             {
                 eventTreeItem.eventTreeItem_0 = item;
                 return;
             }
             eventTreeItem2 = eventTreeItem;
             eventTreeItem = eventTreeItem.eventTreeItem_0;
         }
     }
     item.eventTreeItem_3 = eventTreeItem;
     eventTreeItem.eventTreeItem_2 = item;
     item.eventTreeItem_4 = eventTreeItem.eventTreeItem_4;
     item.eventTreeItem_1 = eventTreeItem.eventTreeItem_1;
     item.eventTreeItem_0 = eventTreeItem.eventTreeItem_0;
     if (eventTreeItem2 == null)
     {
         this.eventTreeItem_0 = item;
         return;
     }
     if (item.dateTime > eventTreeItem2.dateTime)
     {
         eventTreeItem2.eventTreeItem_1 = item;
         return;
     }
     eventTreeItem2.eventTreeItem_0 = item;
 }
Esempio n. 5
0
        public void Add(IEventQueue queue)
        {
            if (queue.IsEmpty())
                throw new Exception($"EventTree::Add Can not add queue, the queue is empty : {queue.Name}");

            var item = new EventTreeItem(queue);
            if (this.eventTreeItem_0 == null)
            {
                this.eventTreeItem_0 = item;
                return;
            }
            this.method_0(item);
        }