aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky
diff options
context:
space:
mode:
authorRime <81419447+Emirlol@users.noreply.github.com>2024-06-07 15:34:44 +0300
committerRime <81419447+Emirlol@users.noreply.github.com>2024-06-08 04:13:47 +0300
commit97167505f1f7f805e6afdb8f1c60810e17f553e3 (patch)
tree516ecc1878734bc42b40db8b98f5da8c53742bd1 /src/main/java/de/hysky
parent8d8bd17a8816e57daa19c348bb865eab2337b84b (diff)
downloadSkyblocker-97167505f1f7f805e6afdb8f1c60810e17f553e3.tar.gz
Skyblocker-97167505f1f7f805e6afdb8f1c60810e17f553e3.tar.bz2
Skyblocker-97167505f1f7f805e6afdb8f1c60810e17f553e3.zip
Add tests for RomanNumerals and clarify their uses in javadocs
Diffstat (limited to 'src/main/java/de/hysky')
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/RomanNumerals.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/de/hysky/skyblocker/utils/RomanNumerals.java b/src/main/java/de/hysky/skyblocker/utils/RomanNumerals.java
index 5f273f8e..007cb0b1 100644
--- a/src/main/java/de/hysky/skyblocker/utils/RomanNumerals.java
+++ b/src/main/java/de/hysky/skyblocker/utils/RomanNumerals.java
@@ -16,6 +16,13 @@ public class RomanNumerals {
};
}
+ /**
+ * Checks if a string is a valid roman numeral.
+ * It's the caller's responsibility to clean up the string before calling this method (such as trimming it).
+ * @param romanNumeral The roman numeral to check.
+ * @return True if the string is a valid roman numeral, false otherwise.
+ * @implNote This will only check if the string contains valid roman numeral characters. It won't check if the numeral is well-formed.
+ */
public static boolean isValidRomanNumeral(String romanNumeral) {
if (romanNumeral == null || romanNumeral.isEmpty()) return false;
for (int i = 0; i < romanNumeral.length(); i++) {
@@ -28,7 +35,7 @@ public class RomanNumerals {
* Converts a roman numeral to a decimal number.
*
* @param romanNumeral The roman numeral to convert.
- * @return The decimal number, or 0 if the roman numeral string is malformed, empty or null.
+ * @return The decimal number, or 0 if the roman numeral string has non-roman characters in it, or if the string is empty or null.
*/
public static int romanToDecimal(String romanNumeral) {
if (romanNumeral == null || romanNumeral.isEmpty()) return 0;