/// <summary> /// change exit schedule depends on priorities of each child processes /// 工程毎優先順に従って、OUTするスケジュールに変更する /// </summary> /// <param name="events"></param> /// <param name="work"></param> public override void AddAndAdjustExitTiming(JitStage.WorkEventQueue events, JitWork work) { if (work.Next?.Process != null) { var sortList = events.FindAll(work.Current.ToChangeProcess(this), EventTypes.Out).ToList(); var tarDT = work.ExitTime; if (sortList.Count > 0) { tarDT = MathUtil.Max(sortList.Min(a => a.Value.DT), work.ExitTime); // 退場時刻は、既存のものに合わせる events.Remove(sortList); } var nn = new LinkedListNode <JitStage.WorkEventQueue.Item>(new JitStage.WorkEventQueue.Item { DT = tarDT, Type = EventTypes.Out, Work = work, }); sortList.Add(nn); sortList.Sort(new QueueItemComparer { ProcPriorities = procPriority, // Larger number is priority }.Comparer); foreach (var node in sortList) { events.Enqueue(tarDT, EventTypes.Out, node.Value.Work); // 退場予約 並び替えて、再登録 } } }
/// <summary> /// 通常のProcessは、delayを考慮するだけの、FIFO /// </summary> /// <param name="events"></param> /// <param name="work"></param> public virtual void AddAndAdjustExitTiming(JitStage.WorkEventQueue events, JitWork work) { if (work.Next?.Process != null) { events.Enqueue(work.ExitTime, EventTypes.Out, work); // 退場予約 } }