public void ExhaustiveTest() { var traceId = 1000; var activities = new HashSet<Activity>(); for (char ch = 'A'; ch <= 'G'; ch++) { activities.Add(new Activity("" + ch, "somename " + ch)); } var inputLog = new Log(); var currentTrace = new LogTrace() {Id = traceId++.ToString()}; inputLog.Traces.Add(currentTrace); var exAl = new ContradictionApproach(activities); int id = 0; while (true) { var input = Console.ReadLine(); switch (input) { case "STOP": exAl.Stop(); currentTrace = currentTrace.Copy(); currentTrace = new LogTrace() { Id = traceId++.ToString() }; inputLog.Traces.Add(currentTrace); break; case "AUTOLOG": Console.WriteLine("Please input a termination index between 0 - 100 : \n"); var logGen = new LogGenerator9001(Convert.ToInt32(Console.ReadLine()), exAl.Graph); Console.WriteLine("Please input number of desired traces to generate : \n"); List<LogTrace> log = logGen.GenerateLog(Convert.ToInt32(Console.ReadLine())); foreach (var trace in log) { Console.WriteLine(trace); } break; case "REDUNDANCY": exAl.Graph = new RedundancyRemover().RemoveRedundancy(exAl.Graph); break; case "POST": exAl.Graph = ContradictionApproach.PostProcessing(exAl.Graph); break; case "NESTED": exAl.Graph = ContradictionApproach.CreateNests(exAl.Graph); break; case "CHANGE TRACE": inputLog.Traces.Add(currentTrace); var newId = Console.ReadLine(); currentTrace = inputLog.Traces.Find(x => x.Id == newId) ?? new LogTrace() { Id = newId}; break; default: if (exAl.Graph.GetActivities().Any(a => a.Id == input)) { exAl.AddEvent(input, currentTrace.Id); currentTrace.Add(new LogEvent(input, "somename" + input) {EventId = "" + id++}); } break; } Console.WriteLine("Current trace id: " + currentTrace.Id); Console.WriteLine(exAl.Graph); //the quality probably suffers because the traces contains unfinished traces. Console.WriteLine(QualityDimensionRetriever.Retrieve(exAl.Graph, inputLog)); } }
/// <summary> /// Used when adding a full log of traces (All finished from the start) /// </summary> private void AddFinishedTraceFromLog(LogTrace logTrace) // TODO: Use at AddLog { if (logTrace.Events.Count == 0) return; var trace = logTrace.Copy(); trace.IsFinished = true; if (string.IsNullOrEmpty(trace.Id)) { trace.Id = Guid.NewGuid().ToString(); } EntireLog.Add(trace); _contradictionApproach.AddTrace(trace); // Actually adds finished trace (stops it immediately) }