Skip to content

Commit

Permalink
remove redundant protected and public modifiers (#1479)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Mar 1, 2024
1 parent 852a97f commit 1870786
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override string ConvertToOrdinal(int number)
return result;
}

public static string NumberToText(long number)
static string NumberToText(long number)
{
if (number < 0)
return "(Negative) " + NumberToText(-number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public string Convert()
return words.TrimEnd();
}

protected readonly int _fullNumber = number;
protected readonly List<int> _threeDigitParts = SplitEveryThreeDigits(number);
protected readonly GrammaticalGender _gender = gender;
readonly int _fullNumber = number;
readonly List<int> _threeDigitParts = SplitEveryThreeDigits(number);
readonly GrammaticalGender _gender = gender;

protected ThreeDigitSets _nextSet = ThreeDigitSets.Units;

Expand All @@ -38,7 +38,7 @@ public string Convert()
/// </summary>
/// <param name="number">The number to split.</param>
/// <returns>The sequence of three-digit numbers.</returns>
protected static List<int> SplitEveryThreeDigits(int number)
static List<int> SplitEveryThreeDigits(int number)
{
var parts = new List<int>();
var rest = number;
Expand All @@ -60,7 +60,7 @@ protected static List<int> SplitEveryThreeDigits(int number)
/// for the next three-digit set.
/// </summary>
/// <returns>The next conversion function to use.</returns>
public Func<int, string>? GetNextPartConverter()
Func<int, string>? GetNextPartConverter()
{
Func<int, string>? converter;

Expand Down Expand Up @@ -161,7 +161,7 @@ static string ThreeDigitSetConverter(int number, bool thisIsLastSet = false)
/// </summary>
/// <param name="number">The three-digit number, as units, to convert.</param>
/// <returns>The same three-digit number, as units, expressed as text.</returns>
protected string UnitsConverter(int number)
string UnitsConverter(int number)
{
// being a unique case, it's easier to treat unity feminine gender as a completely distinct case
if (_gender == GrammaticalGender.Feminine && _fullNumber == 1)
Expand All @@ -177,7 +177,7 @@ protected string UnitsConverter(int number)
/// </summary>
/// <param name="number">The three-digit number, as thousands, to convert.</param>
/// <returns>The same three-digit number of thousands expressed as text.</returns>
protected static string ThousandsConverter(int number)
static string ThousandsConverter(int number)
{
if (number == 0)
{
Expand All @@ -197,7 +197,7 @@ protected static string ThousandsConverter(int number)
/// </summary>
/// <param name="number">The three-digit number, as millions, to convert.</param>
/// <returns>The same three-digit number of millions expressed as text.</returns>
protected static string MillionsConverter(int number)
static string MillionsConverter(int number)
{
if (number == 0)
{
Expand All @@ -217,7 +217,7 @@ protected static string MillionsConverter(int number)
/// </summary>
/// <param name="number">The three-digit number, as billions, to convert.</param>
/// <returns>The same three-digit number of billions expressed as text.</returns>
protected static string BillionsConverter(int number)
static string BillionsConverter(int number)
{
if (number == 1)
{
Expand All @@ -230,7 +230,7 @@ protected static string BillionsConverter(int number)
/// <summary>
/// Lookup table converting units number to text. Index 1 for 1, index 2 for 2, up to index 9.
/// </summary>
protected static string[] _unitsNumberToText =
static string[] _unitsNumberToText =
[
string.Empty,
"uno",
Expand All @@ -247,7 +247,7 @@ protected static string BillionsConverter(int number)
/// <summary>
/// Lookup table converting tens number to text. Index 2 for 20, index 3 for 30, up to index 9 for 90.
/// </summary>
protected static string[] _tensOver20NumberToText =
static string[] _tensOver20NumberToText =
[
string.Empty,
string.Empty,
Expand All @@ -264,7 +264,7 @@ protected static string BillionsConverter(int number)
/// <summary>
/// Lookup table converting teens number to text. Index 0 for 10, index 1 for 11, up to index 9 for 19.
/// </summary>
protected static string[] _teensUnder20NumberToText =
static string[] _teensUnder20NumberToText =
[
"dieci",
"undici",
Expand All @@ -281,7 +281,7 @@ protected static string BillionsConverter(int number)
/// <summary>
/// Lookup table converting hundreds number to text. Index 0 for no hundreds, index 1 for 100, up to index 9.
/// </summary>
protected static string[] _hundredNumberToText =
static string[] _hundredNumberToText =
[
string.Empty,
"cento",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ public string Convert()
return words;
}

protected readonly int _fullNumber = number;
protected readonly GrammaticalGender _gender = gender;
readonly int _fullNumber = number;
readonly GrammaticalGender _gender = gender;
readonly string _genderSuffix = gender == GrammaticalGender.Feminine ? "a" : "o";

/// <summary>
/// Lookup table converting units number to text. Index 1 for 1, index 2 for 2, up to index 9.
/// </summary>
protected static string[] _unitsUnder10NumberToText =
static string[] _unitsUnder10NumberToText =
[
string.Empty,
"prim",
Expand All @@ -104,5 +104,5 @@ public string Convert()
"non"
];

protected static int _lengthOf10AsCardinal = "dieci".Length;
static int _lengthOf10AsCardinal = "dieci".Length;
}

0 comments on commit 1870786

Please sign in to comment.