From 4679b558e7b2d8583ea6f7bb80ca13b195389ff2 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 24 Dec 2014 11:45:19 +0000 Subject: * log output for contract analysis git-svn-id: https://svn.emkael.info/an9k@48 05ec0d5d-773b-4d93-9e23-c81a7ac79feb --- Analizator9000/Analizator9000/Accumulator.cs | 6 +++-- Analizator9000/Analizator9000/ScoreAccumulator.cs | 30 ++++++++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Analizator9000/Analizator9000/Accumulator.cs b/Analizator9000/Analizator9000/Accumulator.cs index be5e714..3f52a8c 100644 --- a/Analizator9000/Analizator9000/Accumulator.cs +++ b/Analizator9000/Analizator9000/Accumulator.cs @@ -224,7 +224,7 @@ namespace Analizator9000 { try { - this.outputFile.WriteLine(this.getString()); + this.outputFile.WriteLine(this.getString(true)); this.outputFile.Close(); } catch (Exception) { }; @@ -237,10 +237,12 @@ namespace Analizator9000 /// /// Presents the current analysis results in textual form. /// + /// Return full analysis for log file purpose (may be used in override methods) /// Text table containing means and std. deviations for distinct contracts. - private String getString() + protected virtual String getString(bool full = false) { StringWriter sw = new StringWriter(); + sw.WriteLine(); sw.WriteLine(" N E S W"); foreach (KeyValuePair> row in this.sums) { diff --git a/Analizator9000/Analizator9000/ScoreAccumulator.cs b/Analizator9000/Analizator9000/ScoreAccumulator.cs index 14d89a1..f850e63 100644 --- a/Analizator9000/Analizator9000/ScoreAccumulator.cs +++ b/Analizator9000/Analizator9000/ScoreAccumulator.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.IO; namespace Analizator9000 { @@ -9,8 +10,9 @@ namespace Analizator9000 /// class ScoreAccumulator : Accumulator { + private readonly string[] vulnerabilities = { "obie przed", "obie po", "NS po", "EW po" }; /// - /// Vulneraility setting of the analysis + /// Vulnerability setting of the analysis /// private int vulnerability; /// @@ -79,6 +81,32 @@ namespace Analizator9000 } } + /// + /// Returns user-readable summary of analysis + /// + /// Append matchpoint/IMP scores summary + /// Formatted log string + protected override String getString(bool full = false) + { + String output = base.getString(full); + if (full) + { + StringWriter sw = new StringWriter(); + sw.WriteLine(); + sw.WriteLine("Założenia: {0}", this.vulnerabilities[this.vulnerability]); + sw.WriteLine(" KONTRAKT LEWY ZAPIS MAX IMP "); + foreach (KeyValuePair tricks in this.trickSums) + { + sw.WriteLine(" {0,6} (x{1,3}) {2,5:0.00} {3,9:0.00} {4,5:0.00} {5,7:0.00} ", this.getContractLogLine(tricks.Key), tricks.Key.Frequency, + tricks.Value / this.dealsScored, this.scoreSums[tricks.Key] / this.dealsScored, + this.maxScoreSums[tricks.Key] / this.dealsScored, this.impScoreSums[tricks.Key] / this.dealsScored); + } + sw.Close(); + output += sw.ToString(); + } + return output; + } + /// /// Handling single DD analysis result /// -- cgit v1.2.3