public WorkingModel GetWorkingModel() { WorkingModel workingModel = new WorkingModel(); foreach (Channel channel in Channels) { workingModel.Channels.Add(channel.ID, channel); } foreach (Process process in Processes) { workingModel.Processes.Add(process.ID, new List <Event>()); } while (true) { bool added = false; foreach (Event e in Events) { if (workingModel.Processes[e.ProcessID].Count + 1 == e.Seq) { workingModel.Processes[e.ProcessID].Add(e); added = true; } } if (!added) { return(workingModel); } } }
public static void Main(string[] args) { string input = GetInput(); JsonModel jsonModel = JsonSerializer.Deserialize <JsonModel>(input); WorkingModel model = jsonModel.GetWorkingModel(); if (args[0] == "past") { ISet <string> past = model.GetPast(args[1]); WriteEventIDs(past); } else if (args[0] == "future") { ISet <string> future = model.GetFuture(args[1]); WriteEventIDs(future); } else if (args[0] == "concurrent") { ISet <string> concurrent = model.GetConcurrent(args[1]); WriteEventIDs(concurrent); } }