/// <inheritdoc/> public void TraceInconstructibleTheorem(RankedTheorem rankedTheorem, AnalyticException exception) { // If logging is allowed, log it with the reference to more detail in the file if (_settings.LogFailures) { Log.Warning("Problem while drawing a ranked theorem. See {path} for more detail.", _settings.FailureFilePath); } // Open the stream writer for the file using var streamWriter = new StreamWriter(_settings.FailureFilePath, append: true); // Prepare the formatter var rankedTheoremFormatter = new OutputFormatter(rankedTheorem.Configuration.AllObjects); // Write initial info streamWriter.WriteLine($"Problem while constructing the theorem:\n"); // Write the configuration streamWriter.WriteLine(rankedTheoremFormatter.FormatConfiguration(rankedTheorem.Configuration)); // Write the theorem streamWriter.WriteLine($"\n{rankedTheoremFormatter.FormatTheorem(rankedTheorem.Theorem)}"); // Write the exception streamWriter.WriteLine($"\nException: {exception}"); // Separator streamWriter.WriteLine("--------------------------------------------------\n"); }
/// <summary> /// Converts an original <see cref="RankedTheorem"/> object into an intermediate object to be serialized. /// </summary> /// <param name="rankedTheorem">The object to be converted.</param> /// <returns>The result of the conversion.</returns> public static RankedTheoremIntermediate Convert(RankedTheorem rankedTheorem) { // Prepare the formatter for the configuration var formatter = new OutputFormatter(rankedTheorem.Configuration.AllObjects); // Format the configuration var configurationString = formatter.FormatConfiguration(rankedTheorem.Configuration) // Replace all curly braces that are not supported by the parser (and don't matter after all) .Replace("{", "").Replace("}", ""); // Format the theorem var theoremString = formatter.FormatTheorem(rankedTheorem.Theorem) // Replace all curly braces that are not supported by the parser (and don't matter after all) .Replace("{", "").Replace("}", ""); // Return the final object return(new RankedTheoremIntermediate(theoremString, rankedTheorem.Ranking, configurationString)); }
/// <inheritdoc/> public void TraceInconstructibleTheorem(RankedTheorem rankedTheorem, AnalyticException exception) { }
/// <inheritdoc/> public void TraceInconstructibleObject(RankedTheorem rankedTheorem) { }