public void Next(IIterationId id, ISchedule target) { ScheduleTable table = GetScheduleTable(target); ISchedule schedule = null; do { schedule = table.Schedules[table.ReadPosition]; _strategies[table.ReadPosition].Next(id, schedule); if (schedule.Action == ScheduleAction.Idle) { break; } table.ReadPosition++; } while (table.ReadPosition < _strategies.Length); if (table.ReadPosition == _strategies.Length && schedule.Action == ScheduleAction.Execute) { table.ReadPosition = 0; target.Action = ScheduleAction.Execute; target.At = MaxTarget(table.Schedules); } else { target.Action = ScheduleAction.Idle; target.At = schedule.At; } }
private ScheduleTable CreateScheduleTable(ISchedule key) { ScheduleTable result = new ScheduleTable(_timer, _strategies.Length); result = new ScheduleTable(_timer, _strategies.Length); _schedules.Add(key, result); return(result); }
public void ThreadFinished(IIterationId id, ISchedule scheduler) { ScheduleTable table = GetScheduleTable(scheduler); for (int i = 0; i < _strategies.Length; i++) { _strategies[i].ThreadFinished(id, table.Schedules[i]); } }