package org.apollo.util;

/**
 * A utility class which contains language-related methods.
 * 
 * @author Graham
 */
public final class LanguageUtil {

	/**
	 * Gets the indefinite article of a 'thing'.
	 * 
	 * @param thing The thing.
	 * @return The indefinite article.
	 */
	public static String getIndefiniteArticle(String thing) {
		char first = thing.toLowerCase().charAt(0);
		boolean vowel = first == 'a' || first == 'e' || first == 'i' || first == 'o' || first == 'u';
		return vowel ? "an" : "a";
	}

	/**
	 * Default private constructor to prevent instantiation.
	 */
	private LanguageUtil() {

	}

}
@@ -30,31 +30,9 @@
 %0A * 
-A utility class which c
+C
 onta
@@ -52,16 +52,24 @@
 related 
+utility 
 methods.
@@ -91,16 +91,33 @@
  Graham%0A
+ * @author Major%0A
  */%0Apubl
@@ -160,48 +160,511 @@
 %09 * 
-Gets the indefinite article of a 'th
+Returns whether or not the each letter in the specified String is upper case (i.e. digits etc are ignored).%0A%09 * %0A%09 * @param string The string.%0A%09 * @return %7B@code true%7D if no letters in the specified String are lower case, otherwise %7B@code false%7D.%0A%09 */%0A%09public static boolean allUpperCase(String string) %7B%0A%09%09for (char character : string.toCharArray()) %7B%0A%09%09%09if (Character.isLowerCase(character)) %7B%0A%09%09%09%09return false;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return true;%0A%09%7D%0A%0A%09/**%0A%09 * Gets the indefinite article of the specified Str
 ing
-'
 .%0A%09 
@@ -681,18 +681,19 @@
 ram 
-th
+str
 ing The 
 thin
@@ -688,18 +688,19 @@
 ing The 
-th
+Str
 ing.%0A%09 *
@@ -787,18 +787,19 @@
 (String 
-th
+str
 ing) %7B%0A%09
@@ -816,13 +816,17 @@
 t = 
-thing
+Character
 .toL
@@ -834,17 +834,22 @@
 werCase(
-)
+string
 .charAt(
@@ -850,17 +850,161 @@
 harAt(0)
-;
+);%0A%09%09if (allUpperCase(string)) %7B%0A%09%09%09if (first == 'f' %7C%7C first == 'l' %7C first == 'm' %7C%7C first == 'n' %7C%7C first == 's') %7B%0A%09%09%09%09return %22an%22;%0A%09%09%09%7D%0A%09%09%7D%0A
 %0A%09%09boole
@@ -1138,15 +1138,12 @@
 %09 * 
-Default
+Sole
  pri

Add acronym support (e.g. NPC) to LanguageUtil#getIndefiniteArticle.