Skip to content

Commit

Permalink
reintroduced numerals based on the normal alphabet, used for numberin…
Browse files Browse the repository at this point in the history
…g sections in a literary work
  • Loading branch information
AmazingRecordingStudios committed Aug 20, 2020
1 parent 5100ab6 commit 7b5095b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,22 @@ public static AssetFileDescriptor[] getAssetFileDescriptors(
}

public static String parseGreekNumeral(int number) {
return parseGreekNumeralForSectionsOfALiteraryWork(number);
}

public static String parseGreekNumeralForSectionsOfALiteraryWork(int number) {

final String greekNumeralsString = "αβγδεζηθικλμνξοπρστυφχψω";
char[] greekNumerals = greekNumeralsString.toCharArray();

if(number > greekNumerals.length) {
return null;
}

return String.valueOf(greekNumerals[number - 1]);
}

public static String parseGreekNumeralForGeneralCounting(int number) {

// actual alphabet: αβγδε ζηθ ἰκλμνξοπ ρστυφχψω
// numeral alphabet: αβγδε ϛ ζηθ ικλμνξοπ ϙ ρστυφχψω ϡ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class UtilsUnitTest {

@Test
public void parseGreekNumeral() {
public void parseGreekNumeralForGeneralCounting() {

parseGreekNumeralHelper(6, "ϛ");
parseGreekNumeralHelper(66, "ξϛ");
Expand Down Expand Up @@ -37,7 +37,7 @@ public void parseGreekNumeral() {
}

@Test
public void parseGreekNumeralOverAThousand() {
public void parseGreekNumeralForGeneralCountingOverAThousand() {
parseGreekNumeralHelper(1000, "͵α");
parseGreekNumeralHelper(1001, "͵αα");

Expand All @@ -46,7 +46,20 @@ public void parseGreekNumeralOverAThousand() {
}

public void parseGreekNumeralHelper(int number, String expectedParse) {
String parsedInt = Utils.parseGreekNumeral(number);
String parsedInt = Utils.parseGreekNumeralForGeneralCounting(number);
assertEquals(expectedParse, parsedInt);
}

@Test
public void parseGreekNumeralForSectionsOfLiteraryWorks() {
parseGreekNumeralHelperForSectionsOfLiteraryWorks(1, "α");
parseGreekNumeralHelperForSectionsOfLiteraryWorks(6, "ζ");
parseGreekNumeralHelperForSectionsOfLiteraryWorks(10, "κ");
// α β γ δ ε ζ η θ ἰ κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω
}

public void parseGreekNumeralHelperForSectionsOfLiteraryWorks(int number, String expectedParse) {
String parsedInt = Utils.parseGreekNumeralForSectionsOfALiteraryWork(number);
assertEquals(expectedParse, parsedInt);
}
}

0 comments on commit 7b5095b

Please sign in to comment.