Refactor: Rename lookup dictionaries to thesaurus.

This prevents confusion with the .NET term 'dictionary'.
This commit is contained in:
Daniel Kraus 2015-07-14 23:50:39 +02:00
parent b810cc8a74
commit b421279208
18 changed files with 63 additions and 63 deletions

View File

@ -71,7 +71,7 @@ Die Lauris-Ausgabe wird in folgende Einheiten aufgetrennt:
strukturierter Form zur Verfügung. 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 Die Bezeichnungen für einzelne Parameter und Einheiten sind bei Lauris
teilweise etwas unglücklich. Beispielsweise wird `glomerul. 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 Leerzeichen zuviel und das veraltete "qm" und sollte besser `ml/min/1,73
m²` geschrieben werden. 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 Parameternamen in "kanonische" (CanonicalName) und Lauris-Einheiten in
wirklichkeitsnähere, typographisch korrekte Einheiten übersetzen: wirklichkeitsnähere, typographisch korrekte Einheiten übersetzen:
- `zaaReloaded2.Dictionaries.ParameterDictionary` - `zaaReloaded2.Thesaurus.Parameters`
- `zaaReloaded2.Dictionaries.UnitDictionary` - `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. Assembly und suchen dann nach Anpassungen auf Benutzerebene.
### Material ### 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 Namen auch hinterlegt, aus welchem Material er bestimmt wird. Beim
Parsen der Lauris-Ausgabe wird festgelegt, um welches Material es sich Parsen der Lauris-Ausgabe wird festgelegt, um welches Material es sich
handelt. Auf diese Weise wird ermöglicht, bei der späteren Ausgabe mit handelt. Auf diese Weise wird ermöglicht, bei der späteren Ausgabe mit
@ -109,7 +109,7 @@ definiert.
### Textdateien zur Konfiguration ### Textdateien zur Konfiguration
Um Anpassungen zu erleichtern und nicht jedes Mal eine neue Version der 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. Textdateien verwendet.
- Datensätze in Zeilen - Datensätze in Zeilen
@ -120,9 +120,9 @@ Textdateien verwendet.
- Leere Zeilen werden ignoriert - Leere Zeilen werden ignoriert
### ParameterDictionary ### Parameters
Das `ParameterDictionary` wird aus einer Textdatei folgenden Formats Der Thesaurus `Parameters` wird aus einer Textdatei folgenden Formats
generiert: generiert:
# LAURIS-NAME "KANONISCHER NAME" MATERIAL "IMMER REFERENZBEREICH" # 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. 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: generiert:
# LAURIS-EINHEIT "KANONISCHE EINHEIT" # LAURIS-EINHEIT "KANONISCHE EINHEIT"
@ -172,7 +172,6 @@ oder nicht-normalen Parametern oder immer mit ausgegeben werden:
- immer - immer
Die Markierung besonderer Parameter erfolgt in der Textdatei, aus der Die Markierung besonderer Parameter erfolgt in der Textdatei, aus der
das `zaaReloaded2.Dictionaries.ParameterDictionary` generiert wird das `zaaReloaded2.Thesaurus.Parameters` generiert wird (s.o.).
(s.o.).
<!-- vim: set tw=72 sw=2 ts=2 sts=-1 : --> <!-- vim: set tw=72 sw=2 ts=2 sts=-1 : -->

View File

@ -17,7 +17,7 @@
*/ */
using System; using System;
using NUnit.Framework; using NUnit.Framework;
using zaaReloaded2.Dictionaries; using zaaReloaded2.Thesaurus;
namespace Tests namespace Tests
{ {

View File

@ -66,7 +66,7 @@
</Otherwise> </Otherwise>
</Choose> </Choose>
<ItemGroup> <ItemGroup>
<Compile Include="Dictionaries\DictionaryTest.cs" /> <Compile Include="Thesaurus\ThesaurusTest.cs" />
<Compile Include="Formatter\Elements\ItemsTest.cs" /> <Compile Include="Formatter\Elements\ItemsTest.cs" />
<Compile Include="Formatter\FormatterTest.cs" /> <Compile Include="Formatter\FormatterTest.cs" />
<Compile Include="Importer\ZaaImporter\LaurisItemTest.cs" /> <Compile Include="Importer\ZaaImporter\LaurisItemTest.cs" />
@ -74,7 +74,7 @@
<Compile Include="Importer\ZaaImporter\ZaaImporterTest.cs" /> <Compile Include="Importer\ZaaImporter\ZaaImporterTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="LineParserTest.cs" /> <Compile Include="LineParserTest.cs" />
<Compile Include="Dictionaries\TestDictionary.cs" /> <Compile Include="Thesaurus\TestThesaurus.cs" />
<Compile Include="Importer\ZaaImporter\TimePointTest.cs" /> <Compile Include="Importer\ZaaImporter\TimePointTest.cs" />
<Compile Include="TestHelpers.cs" /> <Compile Include="TestHelpers.cs" />
</ItemGroup> </ItemGroup>
@ -90,7 +90,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Dictionaries\test_dictionary.txt" /> <EmbeddedResource Include="Thesaurus\test_thesaurus.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="demo-output.txt" /> <EmbeddedResource Include="demo-output.txt" />

View File

@ -22,13 +22,14 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; 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() 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() protected override string GetUserFileName()

View File

@ -21,15 +21,15 @@ using System.Linq;
using System.Text; using System.Text;
using NUnit.Framework; using NUnit.Framework;
namespace Tests.Dictionaries namespace Tests.Thesaurus
{ {
[TestFixture] [TestFixture]
class DictionaryTest class ThesaurusTest
{ {
[Test] [Test]
public void DictionaryFromContentStream() public void DictionaryFromContentStream()
{ {
TestDictionary td = new TestDictionary(); TestThesaurus td = new TestThesaurus();
Assert.IsTrue(td.Records.ContainsKey("Field 1")); Assert.IsTrue(td.Records.ContainsKey("Field 1"));
Assert.AreEqual("Field 2", td.Records["Field 1"][1]); Assert.AreEqual("Field 2", td.Records["Field 1"][1]);
} }

View File

@ -67,8 +67,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// to look up the canonical name, material type, and whether or /// to look up the canonical name, material type, and whether or
/// not to always print the reference interval</param> /// not to always print the reference interval</param>
public LaurisItem(string laurisString, public LaurisItem(string laurisString,
Dictionaries.ParameterDictionary parameterDictionary, Thesaurus.Parameters parameterDictionary,
Dictionaries.UnitDictionary unitDictionary) Thesaurus.Units unitDictionary)
: this(laurisString) : this(laurisString)
{ {
if (parameterDictionary != null) if (parameterDictionary != null)

View File

@ -21,7 +21,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using zaaReloaded2.Dictionaries; using zaaReloaded2.Thesaurus;
using zaaReloaded2.LabModel; using zaaReloaded2.LabModel;
namespace zaaReloaded2.Importer.ZaaImporter namespace zaaReloaded2.Importer.ZaaImporter
@ -78,8 +78,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// <param name="unitDictionary">Unit dictionary that contains canonical /// <param name="unitDictionary">Unit dictionary that contains canonical
/// unit names.</param> /// unit names.</param>
public LaurisParagraph(string paragraph, public LaurisParagraph(string paragraph,
Dictionaries.ParameterDictionary parameterDictionary, Thesaurus.Parameters parameterDictionary,
Dictionaries.UnitDictionary unitDictionary) Thesaurus.Units unitDictionary)
{ {
OriginalParagraph = paragraph; OriginalParagraph = paragraph;
_parameterDictionary = parameterDictionary; _parameterDictionary = parameterDictionary;
@ -123,8 +123,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
#region Fields #region Fields
static readonly Regex _expectedFormat = new Regex(@"(?<caption>[^:]+:\s*)?(?<items>[^:]+:\s*[^;]+;)*"); static readonly Regex _expectedFormat = new Regex(@"(?<caption>[^:]+:\s*)?(?<items>[^:]+:\s*[^;]+;)*");
Dictionaries.ParameterDictionary _parameterDictionary; Thesaurus.Parameters _parameterDictionary;
Dictionaries.UnitDictionary _unitDictionary; Thesaurus.Units _unitDictionary;
#endregion #endregion
} }

View File

@ -22,7 +22,7 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using zaaReloaded2.Dictionaries; using zaaReloaded2.Thesaurus;
using zaaReloaded2.LabModel; using zaaReloaded2.LabModel;
namespace zaaReloaded2.Importer.ZaaImporter namespace zaaReloaded2.Importer.ZaaImporter
@ -114,8 +114,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
public LaurisTimePoint( public LaurisTimePoint(
string laurisText, string laurisText,
ParameterDictionary parameterDictionary, Parameters parameterDictionary,
UnitDictionary unitDictionary) Units unitDictionary)
: this() : this()
{ {
_parameterDictionary = parameterDictionary; _parameterDictionary = parameterDictionary;
@ -129,8 +129,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
public LaurisTimePoint( public LaurisTimePoint(
string[] paragraphs, string[] paragraphs,
ParameterDictionary parameterDictionary, Parameters parameterDictionary,
UnitDictionary unitDictionary) Units unitDictionary)
: this() : this()
{ {
_parameterDictionary = parameterDictionary; _parameterDictionary = parameterDictionary;
@ -222,8 +222,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
static readonly Regex _timeStampRegex = new Regex( static readonly Regex _timeStampRegex = new Regex(
@"^\s*\(?\s*(?<datetime>\d\d\.\d\d\.\d\d\d\d\s+\d\d:\d\d)"); @"^\s*\(?\s*(?<datetime>\d\d\.\d\d\.\d\d\d\d\s+\d\d:\d\d)");
string[] _paragraphs; string[] _paragraphs;
ParameterDictionary _parameterDictionary; Parameters _parameterDictionary;
UnitDictionary _unitDictionary; Units _unitDictionary;
#endregion #endregion
} }

View File

@ -22,7 +22,7 @@ using System.Linq;
using System.Text; using System.Text;
using Bovender.Extensions; using Bovender.Extensions;
using zaaReloaded2.LabModel; using zaaReloaded2.LabModel;
using zaaReloaded2.Dictionaries; using zaaReloaded2.Thesaurus;
namespace zaaReloaded2.Importer.ZaaImporter namespace zaaReloaded2.Importer.ZaaImporter
{ {
@ -107,8 +107,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
public ZaaImporter() public ZaaImporter()
{ {
_parameters = new ParameterDictionary(); _parameters = new Parameters();
_units = new UnitDictionary(); _units = new Units();
} }
#endregion #endregion
@ -116,8 +116,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
#region Fields #region Fields
Laboratory _laboratory; Laboratory _laboratory;
ParameterDictionary _parameters; Parameters _parameters;
UnitDictionary _units; Units _units;
#endregion #endregion
} }

View File

@ -22,7 +22,7 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using zaaReloaded2.Dictionaries; using zaaReloaded2.Thesaurus;
namespace zaaReloaded2.LabModel namespace zaaReloaded2.LabModel
{ {

View File

@ -19,7 +19,7 @@ using System;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace zaaReloaded2.Dictionaries namespace zaaReloaded2.Thesaurus
{ {
/// <summary> /// <summary>
/// Simple parser that separates a line from a text file into /// Simple parser that separates a line from a text file into

View File

@ -23,14 +23,14 @@ using System.Text;
using System.IO; using System.IO;
using zaaReloaded2.LabModel; using zaaReloaded2.LabModel;
namespace zaaReloaded2.Dictionaries namespace zaaReloaded2.Thesaurus
{ {
/// <summary> /// <summary>
/// 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 /// canonical parameter names, and to assign categories and determine
/// which parameters always require the output of reference intervals. /// which parameters always require the output of reference intervals.
/// </summary> /// </summary>
public class ParameterDictionary : DictionaryBase public class Parameters : ThesaurusBase
{ {
#region Public methods #region Public methods
@ -87,7 +87,7 @@ namespace zaaReloaded2.Dictionaries
protected override System.IO.Stream GetDefaultStream() protected override System.IO.Stream GetDefaultStream()
{ {
return Assembly.GetExecutingAssembly().GetManifestResourceStream( return Assembly.GetExecutingAssembly().GetManifestResourceStream(
"zaaReloaded2.Defaults.parameters.txt"); "zaaReloaded2.Thesaurus.Defaults.parameters.txt");
} }
/// <summary> /// <summary>

View File

@ -22,14 +22,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace zaaReloaded2.Dictionaries namespace zaaReloaded2.Thesaurus
{ {
/// <summary> /// <summary>
/// Base class for the <see cref="ParameterDictionary"/> /// Base class for the <see cref="Parameters"/>
/// and the <see cref="UnitDictionary"/>; implements methods /// and the <see cref="Units"/>; implements methods
/// to read configuration files. /// to read configuration files.
/// </summary> /// </summary>
public abstract class DictionaryBase public abstract class ThesaurusBase
{ {
#region Public properties #region Public properties
@ -48,7 +48,7 @@ namespace zaaReloaded2.Dictionaries
/// Constructs a new dictionary, loading default data from a built-in /// Constructs a new dictionary, loading default data from a built-in
/// resource, and user data from a custom file. /// resource, and user data from a custom file.
/// </summary> /// </summary>
public DictionaryBase() public ThesaurusBase()
{ {
Records = new SortedDictionary<string, string[]>(); Records = new SortedDictionary<string, string[]>();
LoadDefaultValues(); LoadDefaultValues();

View File

@ -22,13 +22,13 @@ using System.Text;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
namespace zaaReloaded2.Dictionaries namespace zaaReloaded2.Thesaurus
{ {
/// <summary> /// <summary>
/// Dictionary that is used to convert Lauris units to canonical /// Thesaurus that is used to convert Lauris units to canonical
/// zaaReloaded2 units. /// zaaReloaded2 units.
/// </summary> /// </summary>
public class UnitDictionary : DictionaryBase public class Units : ThesaurusBase
{ {
#region Public methods #region Public methods
@ -55,7 +55,7 @@ namespace zaaReloaded2.Dictionaries
protected override System.IO.Stream GetDefaultStream() protected override System.IO.Stream GetDefaultStream()
{ {
return Assembly.GetExecutingAssembly().GetManifestResourceStream( return Assembly.GetExecutingAssembly().GetManifestResourceStream(
"zaaReloaded2.Defaults.units.txt"); "zaaReloaded2.Thesaurus.Defaults.units.txt");
} }
/// <summary> /// <summary>

View File

@ -163,7 +163,7 @@
can be found. can be found.
--> -->
<ItemGroup> <ItemGroup>
<Compile Include="Dictionaries\DictionaryBase.cs" /> <Compile Include="Thesaurus\ThesaurusBase.cs" />
<Compile Include="Formatter\Elements\ElementsList.cs" /> <Compile Include="Formatter\Elements\ElementsList.cs" />
<Compile Include="Formatter\IItemFormatterDictionary.cs" /> <Compile Include="Formatter\IItemFormatterDictionary.cs" />
<Compile Include="Formatter\ItemFormatter.cs" /> <Compile Include="Formatter\ItemFormatter.cs" />
@ -173,9 +173,9 @@
<Compile Include="Formatter\TimePointFormatterDictionary.cs" /> <Compile Include="Formatter\TimePointFormatterDictionary.cs" />
<Compile Include="LabModel\IItemDictionary.cs" /> <Compile Include="LabModel\IItemDictionary.cs" />
<Compile Include="LabModel\ItemDictionary.cs" /> <Compile Include="LabModel\ItemDictionary.cs" />
<Compile Include="Dictionaries\LineParser.cs" /> <Compile Include="Thesaurus\LineParser.cs" />
<Compile Include="Dictionaries\ParameterDictionary.cs" /> <Compile Include="Thesaurus\Parameters.cs" />
<Compile Include="Dictionaries\UnitDictionary.cs" /> <Compile Include="Thesaurus\Units.cs" />
<Compile Include="Formatter\Elements\ElementBase.cs" /> <Compile Include="Formatter\Elements\ElementBase.cs" />
<Compile Include="Formatter\Elements\Items.cs" /> <Compile Include="Formatter\Elements\Items.cs" />
<Compile Include="Formatter\Formatter.cs" /> <Compile Include="Formatter\Formatter.cs" />
@ -226,8 +226,8 @@
<None Include="zaaReloaded2.pfx" /> <None Include="zaaReloaded2.pfx" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Defaults\parameters.txt" /> <EmbeddedResource Include="Thesaurus\Defaults\parameters.txt" />
<EmbeddedResource Include="Defaults\units.txt" /> <EmbeddedResource Include="Thesaurus\Defaults\units.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<PropertyGroup> <PropertyGroup>