From b421279208c8a3b8d88eebbfb5c422bc52af157a Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Tue, 14 Jul 2015 23:50:39 +0200 Subject: [PATCH] Refactor: Rename lookup dictionaries to thesaurus. This prevents confusion with the .NET term 'dictionary'. --- README.md | 25 +++++++++---------- Tests/LineParserTest.cs | 2 +- Tests/Tests.csproj | 6 ++--- .../TestThesaurus.cs} | 7 +++--- .../ThesaurusTest.cs} | 6 ++--- .../test_thesaurus.txt} | 0 .../Importer/ZaaImporter/LaurisItem.cs | 4 +-- .../Importer/ZaaImporter/LaurisParagraph.cs | 10 ++++---- .../Importer/ZaaImporter/LaurisTimePoint.cs | 14 +++++------ .../Importer/ZaaImporter/ZaaImporter.cs | 10 ++++---- zaaReloaded2/LabModel/TimePoint.cs | 2 +- .../{ => Thesaurus}/Defaults/parameters.txt | 0 .../{ => Thesaurus}/Defaults/units.txt | 0 .../{Dictionaries => Thesaurus}/LineParser.cs | 2 +- .../Parameters.cs} | 8 +++--- .../ThesaurusBase.cs} | 10 ++++---- .../UnitDictionary.cs => Thesaurus/Units.cs} | 8 +++--- zaaReloaded2/zaaReloaded2.csproj | 12 ++++----- 18 files changed, 63 insertions(+), 63 deletions(-) rename Tests/{Dictionaries/TestDictionary.cs => Thesaurus/TestThesaurus.cs} (81%) rename Tests/{Dictionaries/DictionaryTest.cs => Thesaurus/ThesaurusTest.cs} (90%) rename Tests/{Dictionaries/test_dictionary.txt => Thesaurus/test_thesaurus.txt} (100%) rename zaaReloaded2/{ => Thesaurus}/Defaults/parameters.txt (100%) rename zaaReloaded2/{ => Thesaurus}/Defaults/units.txt (100%) rename zaaReloaded2/{Dictionaries => Thesaurus}/LineParser.cs (98%) rename zaaReloaded2/{Dictionaries/ParameterDictionary.cs => Thesaurus/Parameters.cs} (93%) rename zaaReloaded2/{Dictionaries/DictionaryBase.cs => Thesaurus/ThesaurusBase.cs} (97%) rename zaaReloaded2/{Dictionaries/UnitDictionary.cs => Thesaurus/Units.cs} (91%) diff --git a/README.md b/README.md index 0b15e79..e5dec80 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Die Lauris-Ausgabe wird in folgende Einheiten aufgetrennt: strukturierter Form zur Verfügung. -## Kanonische Namen, Materialarten, Wörterbücher +## Kanonische Namen, Materialarten, Thesauri Die Bezeichnungen für einzelne Parameter und Einheiten sind bei Lauris teilweise etwas unglücklich. Beispielsweise wird `glomerul. @@ -81,20 +81,20 @@ sagen und schreiben. Die Einheit `ml/min /1,73qm` enthält ein Leerzeichen zuviel und das veraltete "qm" und sollte besser `ml/min/1,73 m²` geschrieben werden. -Aus diesem Grunde werden anpassbare Wörterbücher verwendet, die +Aus diesem Grunde werden anpassbare Thesauri verwendet, die Parameternamen in "kanonische" (CanonicalName) und Lauris-Einheiten in wirklichkeitsnähere, typographisch korrekte Einheiten übersetzen: - - `zaaReloaded2.Dictionaries.ParameterDictionary` - - `zaaReloaded2.Dictionaries.UnitDictionary` + - `zaaReloaded2.Thesaurus.Parameters` + - `zaaReloaded2.Thesaurus.Units` -Beide Wörterbuch-Typen laden zunächst eingebaute Default-Werte aus der +Beide Thesaurus-Typen laden zunächst eingebaute Default-Werte aus der Assembly und suchen dann nach Anpassungen auf Benutzerebene. ### Material -Im `ParameterDictionary` wird für jeden Parameter neben dem Kanonischen +Im Thesaurus `Parameters` wird für jeden Parameter neben dem Kanonischen Namen auch hinterlegt, aus welchem Material er bestimmt wird. Beim Parsen der Lauris-Ausgabe wird festgelegt, um welches Material es sich handelt. Auf diese Weise wird ermöglicht, bei der späteren Ausgabe mit @@ -109,7 +109,7 @@ definiert. ### Textdateien zur Konfiguration Um Anpassungen zu erleichtern und nicht jedes Mal eine neue Version der -Binärdateien zu erfordern, werden für die Wörterbücher einfache +Binärdateien zu erfordern, werden für die Thesauri einfache Textdateien verwendet. - Datensätze in Zeilen @@ -120,9 +120,9 @@ Textdateien verwendet. - Leere Zeilen werden ignoriert -### ParameterDictionary +### Parameters -Das `ParameterDictionary` wird aus einer Textdatei folgenden Formats +Der Thesaurus `Parameters` wird aus einer Textdatei folgenden Formats generiert: # LAURIS-NAME "KANONISCHER NAME" MATERIAL "IMMER REFERENZBEREICH" @@ -142,9 +142,9 @@ Die drei Trennstriche `---` in der Zeile "Cystacin C" bedeuten, daß zaaReloaded2 den Lauris-Namen als kanonischen Namen verwenden soll. -### UnitDictionary +### Units -Das `UnitDictionary` wird aus einer Textdatei folgenden Formats +Der Thesaurus `Units` wird aus einer Textdatei folgenden Formats generiert: # LAURIS-EINHEIT "KANONISCHE EINHEIT" @@ -172,7 +172,6 @@ oder nicht-normalen Parametern oder immer mit ausgegeben werden: - immer Die Markierung besonderer Parameter erfolgt in der Textdatei, aus der -das `zaaReloaded2.Dictionaries.ParameterDictionary` generiert wird -(s.o.). +das `zaaReloaded2.Thesaurus.Parameters` generiert wird (s.o.). diff --git a/Tests/LineParserTest.cs b/Tests/LineParserTest.cs index db2fd24..3838f79 100755 --- a/Tests/LineParserTest.cs +++ b/Tests/LineParserTest.cs @@ -17,7 +17,7 @@ */ using System; using NUnit.Framework; -using zaaReloaded2.Dictionaries; +using zaaReloaded2.Thesaurus; namespace Tests { diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 72792a8..5944e77 100755 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -66,7 +66,7 @@ - + @@ -74,7 +74,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/Tests/Dictionaries/TestDictionary.cs b/Tests/Thesaurus/TestThesaurus.cs similarity index 81% rename from Tests/Dictionaries/TestDictionary.cs rename to Tests/Thesaurus/TestThesaurus.cs index a370fdd..ab96490 100755 --- a/Tests/Dictionaries/TestDictionary.cs +++ b/Tests/Thesaurus/TestThesaurus.cs @@ -22,13 +22,14 @@ using System.Linq; using System.Reflection; using System.Text; -namespace Tests.Dictionaries +namespace Tests.Thesaurus { - class TestDictionary : zaaReloaded2.Dictionaries.DictionaryBase + class TestThesaurus : zaaReloaded2.Thesaurus.ThesaurusBase { protected override System.IO.Stream GetDefaultStream() { - return Assembly.GetExecutingAssembly().GetManifestResourceStream("Tests.Dictionaries.test_dictionary.txt"); + return Assembly.GetExecutingAssembly() + .GetManifestResourceStream("Tests.Thesaurus.test_thesaurus.txt"); } protected override string GetUserFileName() diff --git a/Tests/Dictionaries/DictionaryTest.cs b/Tests/Thesaurus/ThesaurusTest.cs similarity index 90% rename from Tests/Dictionaries/DictionaryTest.cs rename to Tests/Thesaurus/ThesaurusTest.cs index 5421666..2c31f82 100755 --- a/Tests/Dictionaries/DictionaryTest.cs +++ b/Tests/Thesaurus/ThesaurusTest.cs @@ -21,15 +21,15 @@ using System.Linq; using System.Text; using NUnit.Framework; -namespace Tests.Dictionaries +namespace Tests.Thesaurus { [TestFixture] - class DictionaryTest + class ThesaurusTest { [Test] public void DictionaryFromContentStream() { - TestDictionary td = new TestDictionary(); + TestThesaurus td = new TestThesaurus(); Assert.IsTrue(td.Records.ContainsKey("Field 1")); Assert.AreEqual("Field 2", td.Records["Field 1"][1]); } diff --git a/Tests/Dictionaries/test_dictionary.txt b/Tests/Thesaurus/test_thesaurus.txt similarity index 100% rename from Tests/Dictionaries/test_dictionary.txt rename to Tests/Thesaurus/test_thesaurus.txt diff --git a/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs b/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs index 27e05b0..244c73f 100755 --- a/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs +++ b/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs @@ -67,8 +67,8 @@ namespace zaaReloaded2.Importer.ZaaImporter /// to look up the canonical name, material type, and whether or /// not to always print the reference interval public LaurisItem(string laurisString, - Dictionaries.ParameterDictionary parameterDictionary, - Dictionaries.UnitDictionary unitDictionary) + Thesaurus.Parameters parameterDictionary, + Thesaurus.Units unitDictionary) : this(laurisString) { if (parameterDictionary != null) diff --git a/zaaReloaded2/Importer/ZaaImporter/LaurisParagraph.cs b/zaaReloaded2/Importer/ZaaImporter/LaurisParagraph.cs index 2f239e2..c230a32 100755 --- a/zaaReloaded2/Importer/ZaaImporter/LaurisParagraph.cs +++ b/zaaReloaded2/Importer/ZaaImporter/LaurisParagraph.cs @@ -21,7 +21,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Text.RegularExpressions; -using zaaReloaded2.Dictionaries; +using zaaReloaded2.Thesaurus; using zaaReloaded2.LabModel; namespace zaaReloaded2.Importer.ZaaImporter @@ -78,8 +78,8 @@ namespace zaaReloaded2.Importer.ZaaImporter /// Unit dictionary that contains canonical /// unit names. public LaurisParagraph(string paragraph, - Dictionaries.ParameterDictionary parameterDictionary, - Dictionaries.UnitDictionary unitDictionary) + Thesaurus.Parameters parameterDictionary, + Thesaurus.Units unitDictionary) { OriginalParagraph = paragraph; _parameterDictionary = parameterDictionary; @@ -123,8 +123,8 @@ namespace zaaReloaded2.Importer.ZaaImporter #region Fields static readonly Regex _expectedFormat = new Regex(@"(?[^:]+:\s*)?(?[^:]+:\s*[^;]+;)*"); - Dictionaries.ParameterDictionary _parameterDictionary; - Dictionaries.UnitDictionary _unitDictionary; + Thesaurus.Parameters _parameterDictionary; + Thesaurus.Units _unitDictionary; #endregion } diff --git a/zaaReloaded2/Importer/ZaaImporter/LaurisTimePoint.cs b/zaaReloaded2/Importer/ZaaImporter/LaurisTimePoint.cs index c844f40..dd6abfa 100755 --- a/zaaReloaded2/Importer/ZaaImporter/LaurisTimePoint.cs +++ b/zaaReloaded2/Importer/ZaaImporter/LaurisTimePoint.cs @@ -22,7 +22,7 @@ using System.Globalization; using System.Linq; using System.Text; using System.Text.RegularExpressions; -using zaaReloaded2.Dictionaries; +using zaaReloaded2.Thesaurus; using zaaReloaded2.LabModel; namespace zaaReloaded2.Importer.ZaaImporter @@ -114,8 +114,8 @@ namespace zaaReloaded2.Importer.ZaaImporter public LaurisTimePoint( string laurisText, - ParameterDictionary parameterDictionary, - UnitDictionary unitDictionary) + Parameters parameterDictionary, + Units unitDictionary) : this() { _parameterDictionary = parameterDictionary; @@ -129,8 +129,8 @@ namespace zaaReloaded2.Importer.ZaaImporter public LaurisTimePoint( string[] paragraphs, - ParameterDictionary parameterDictionary, - UnitDictionary unitDictionary) + Parameters parameterDictionary, + Units unitDictionary) : this() { _parameterDictionary = parameterDictionary; @@ -222,8 +222,8 @@ namespace zaaReloaded2.Importer.ZaaImporter static readonly Regex _timeStampRegex = new Regex( @"^\s*\(?\s*(?\d\d\.\d\d\.\d\d\d\d\s+\d\d:\d\d)"); string[] _paragraphs; - ParameterDictionary _parameterDictionary; - UnitDictionary _unitDictionary; + Parameters _parameterDictionary; + Units _unitDictionary; #endregion } diff --git a/zaaReloaded2/Importer/ZaaImporter/ZaaImporter.cs b/zaaReloaded2/Importer/ZaaImporter/ZaaImporter.cs index 61cb58d..66c01f1 100755 --- a/zaaReloaded2/Importer/ZaaImporter/ZaaImporter.cs +++ b/zaaReloaded2/Importer/ZaaImporter/ZaaImporter.cs @@ -22,7 +22,7 @@ using System.Linq; using System.Text; using Bovender.Extensions; using zaaReloaded2.LabModel; -using zaaReloaded2.Dictionaries; +using zaaReloaded2.Thesaurus; namespace zaaReloaded2.Importer.ZaaImporter { @@ -107,8 +107,8 @@ namespace zaaReloaded2.Importer.ZaaImporter public ZaaImporter() { - _parameters = new ParameterDictionary(); - _units = new UnitDictionary(); + _parameters = new Parameters(); + _units = new Units(); } #endregion @@ -116,8 +116,8 @@ namespace zaaReloaded2.Importer.ZaaImporter #region Fields Laboratory _laboratory; - ParameterDictionary _parameters; - UnitDictionary _units; + Parameters _parameters; + Units _units; #endregion } diff --git a/zaaReloaded2/LabModel/TimePoint.cs b/zaaReloaded2/LabModel/TimePoint.cs index d4d8ac8..8eae261 100755 --- a/zaaReloaded2/LabModel/TimePoint.cs +++ b/zaaReloaded2/LabModel/TimePoint.cs @@ -22,7 +22,7 @@ using System.Globalization; using System.Linq; using System.Text; using System.Text.RegularExpressions; -using zaaReloaded2.Dictionaries; +using zaaReloaded2.Thesaurus; namespace zaaReloaded2.LabModel { diff --git a/zaaReloaded2/Defaults/parameters.txt b/zaaReloaded2/Thesaurus/Defaults/parameters.txt similarity index 100% rename from zaaReloaded2/Defaults/parameters.txt rename to zaaReloaded2/Thesaurus/Defaults/parameters.txt diff --git a/zaaReloaded2/Defaults/units.txt b/zaaReloaded2/Thesaurus/Defaults/units.txt similarity index 100% rename from zaaReloaded2/Defaults/units.txt rename to zaaReloaded2/Thesaurus/Defaults/units.txt diff --git a/zaaReloaded2/Dictionaries/LineParser.cs b/zaaReloaded2/Thesaurus/LineParser.cs similarity index 98% rename from zaaReloaded2/Dictionaries/LineParser.cs rename to zaaReloaded2/Thesaurus/LineParser.cs index ec9f81e..462a072 100755 --- a/zaaReloaded2/Dictionaries/LineParser.cs +++ b/zaaReloaded2/Thesaurus/LineParser.cs @@ -19,7 +19,7 @@ using System; using System.Linq; using System.Text.RegularExpressions; -namespace zaaReloaded2.Dictionaries +namespace zaaReloaded2.Thesaurus { /// /// Simple parser that separates a line from a text file into diff --git a/zaaReloaded2/Dictionaries/ParameterDictionary.cs b/zaaReloaded2/Thesaurus/Parameters.cs similarity index 93% rename from zaaReloaded2/Dictionaries/ParameterDictionary.cs rename to zaaReloaded2/Thesaurus/Parameters.cs index 81ae0cf..4d8ef4f 100755 --- a/zaaReloaded2/Dictionaries/ParameterDictionary.cs +++ b/zaaReloaded2/Thesaurus/Parameters.cs @@ -23,14 +23,14 @@ using System.Text; using System.IO; using zaaReloaded2.LabModel; -namespace zaaReloaded2.Dictionaries +namespace zaaReloaded2.Thesaurus { /// - /// Dictionary that is used to convert Lauris parameter names to + /// Thesaurus that is used to convert Lauris parameter names to /// canonical parameter names, and to assign categories and determine /// which parameters always require the output of reference intervals. /// - public class ParameterDictionary : DictionaryBase + public class Parameters : ThesaurusBase { #region Public methods @@ -87,7 +87,7 @@ namespace zaaReloaded2.Dictionaries protected override System.IO.Stream GetDefaultStream() { return Assembly.GetExecutingAssembly().GetManifestResourceStream( - "zaaReloaded2.Defaults.parameters.txt"); + "zaaReloaded2.Thesaurus.Defaults.parameters.txt"); } /// diff --git a/zaaReloaded2/Dictionaries/DictionaryBase.cs b/zaaReloaded2/Thesaurus/ThesaurusBase.cs similarity index 97% rename from zaaReloaded2/Dictionaries/DictionaryBase.cs rename to zaaReloaded2/Thesaurus/ThesaurusBase.cs index 5c2ddc4..ecc0baf 100755 --- a/zaaReloaded2/Dictionaries/DictionaryBase.cs +++ b/zaaReloaded2/Thesaurus/ThesaurusBase.cs @@ -22,14 +22,14 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; -namespace zaaReloaded2.Dictionaries +namespace zaaReloaded2.Thesaurus { /// - /// Base class for the - /// and the ; implements methods + /// Base class for the + /// and the ; implements methods /// to read configuration files. /// - public abstract class DictionaryBase + public abstract class ThesaurusBase { #region Public properties @@ -48,7 +48,7 @@ namespace zaaReloaded2.Dictionaries /// Constructs a new dictionary, loading default data from a built-in /// resource, and user data from a custom file. /// - public DictionaryBase() + public ThesaurusBase() { Records = new SortedDictionary(); LoadDefaultValues(); diff --git a/zaaReloaded2/Dictionaries/UnitDictionary.cs b/zaaReloaded2/Thesaurus/Units.cs similarity index 91% rename from zaaReloaded2/Dictionaries/UnitDictionary.cs rename to zaaReloaded2/Thesaurus/Units.cs index 0b4e4a1..3af783a 100755 --- a/zaaReloaded2/Dictionaries/UnitDictionary.cs +++ b/zaaReloaded2/Thesaurus/Units.cs @@ -22,13 +22,13 @@ using System.Text; using System.IO; using System.Reflection; -namespace zaaReloaded2.Dictionaries +namespace zaaReloaded2.Thesaurus { /// - /// Dictionary that is used to convert Lauris units to canonical + /// Thesaurus that is used to convert Lauris units to canonical /// zaaReloaded2 units. /// - public class UnitDictionary : DictionaryBase + public class Units : ThesaurusBase { #region Public methods @@ -55,7 +55,7 @@ namespace zaaReloaded2.Dictionaries protected override System.IO.Stream GetDefaultStream() { return Assembly.GetExecutingAssembly().GetManifestResourceStream( - "zaaReloaded2.Defaults.units.txt"); + "zaaReloaded2.Thesaurus.Defaults.units.txt"); } /// diff --git a/zaaReloaded2/zaaReloaded2.csproj b/zaaReloaded2/zaaReloaded2.csproj index a19d713..d4f42e9 100755 --- a/zaaReloaded2/zaaReloaded2.csproj +++ b/zaaReloaded2/zaaReloaded2.csproj @@ -163,7 +163,7 @@ can be found. --> - + @@ -173,9 +173,9 @@ - - - + + + @@ -226,8 +226,8 @@ - - + +