Declared the methods and copied the XMLDoc from the readme.adoc file to each method

This commit is contained in:
MarcUs7i 2024-10-28 10:19:23 +01:00
parent 719a071bb8
commit 26c8e67c33

View file

@ -5,5 +5,63 @@
/// </summary>
public sealed class VocabularyItem
{
// TODO
private int _countCorrect;
private int _countAsked;
public readonly string NativeWord;
public readonly string Translation;
VocabularyItem(string nativeWord, string translation)
{
NativeWord = nativeWord;
Translation = translation;
}
/// <summary>
/// A translation attempt is checked for correctness.
/// </summary>
/// <param name="translationAttempt">The user provided translation</param>
/// <returns>True if the translation was correct; false otherwise</returns>
public bool TestTranslation(string translationAttempt)
{
_countAsked++;
if (Translation == translationAttempt)
{
_countCorrect++;
return true;
}
return false;
}
/// <summary>
/// The vocabulary item is compared to another. First the number of correct answers is compared.
/// If it is equal the native words are compared ordinal.
/// </summary>
/// <param name="other">The <see cref="VocabularyItem"/> to compare with</param>
/// <returns>0 if equal; less than 0 if this item is smaller; greater than 0 otherwise</returns>
public int CompareTo(VocabularyItem other)
{
return -1;
}
/// <summary>
/// Overrides the default string representation to display the word and translation statistics.
/// </summary>
/// <returns>A string containing the word, its translation and the training statistics</returns>
public override string ToString()
{
return string.Empty;
}
/// <summary>
/// Compares two strings by ordinal value, ignoring case.
/// </summary>
/// <param name="a">First string</param>
/// <param name="b">Second string</param>
/// <returns>Less than 0 if a precedes b in the sorting order; greater than 0 if b precedes a; 0 otherwise</returns>
private static int CompareStrings(string a, string b)
{
return -1;
}
}