diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-10 23:11:11 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-10 23:11:11 -0400 |
| commit | c285b4480963e0ee8b8d32312c6a4c7c94dc2840 (patch) | |
| tree | 2f6ae61d035662c1ed8fbf41487c27d6f6d8f476 /src/main/java/bjc/inflexion/EnglishUtils.java | |
| parent | 71bd0a2468a252e8aa3f6aa6db7f14cdd561b05b (diff) | |
Minor changes
Diffstat (limited to 'src/main/java/bjc/inflexion/EnglishUtils.java')
| -rw-r--r-- | src/main/java/bjc/inflexion/EnglishUtils.java | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/main/java/bjc/inflexion/EnglishUtils.java b/src/main/java/bjc/inflexion/EnglishUtils.java index 96982ed..c782162 100644 --- a/src/main/java/bjc/inflexion/EnglishUtils.java +++ b/src/main/java/bjc/inflexion/EnglishUtils.java @@ -48,20 +48,40 @@ public class EnglishUtils { */ 4, 4, 4, 4 }; + /** + * Convert small integers to words. + * + * @param num + * The number to convert. + * + * @return The word for the number, if it's less than ten. + */ public static String smallIntToWord(int num) { - if(num >= 0 && num <= 10) { + if (num >= 0 && num <= 10) { return smallNums[num]; } return Integer.toString(num); } + /** + * Summarize an integer. + * + * @param num + * The number to summarize. + * + * @param atEnd + * Whether or not the integer is at the end of a string. + * + * @return A string summarizing the integer. + */ public static String intSummarize(int num, boolean atEnd) { String[] nums = atEnd ? endSummaryNums : summaryNums; - if(num >= 0 && num < 10) { + if (num >= 0 && num < 10) { return nums[summaryMap[num]]; - } else - return "many"; + } + + return "many"; } -} +}
\ No newline at end of file |
