@@ -0,0 +1,1071 @@
+package main;%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Apublic enum OptionType %7B%0A%09PRIORITY(%22-p%22, %22--priority%22, %22priority%22) %7B%0A%09%7D, START_TIME(%22-s%22, %22--starttime%22, %22from%22) %7B%0A%09%7D, END_TIME(%22-d%22, %22--deadline%22, %22--endtime%22, %22to%22, %22by%22) %7B%0A%09%7D;%0A%09%0A%09static private final Map%3CString, OptionType%3E ALIAS_TABLE = new HashMap%3CString, OptionType%3E();%0A%09static %7B%0A%09%09for (OptionType opt: OptionType.values()) %7B%0A%09%09%09// Normalising by lowercase all%0A%09%09%09ALIAS_TABLE.put(opt.toString().toLowerCase(), opt);%0A%09%09%09for (String alias: opt.aliases) %7B%0A%09%09%09%09ALIAS_TABLE.put(alias.toLowerCase(), opt);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%09static public OptionType fromString(String value) %7B%0A%09%09if (value == null) %7B%0A%09%09%09throw new NullPointerException(%22Null alias%22);%0A%09%09%7D%0A%0A%09%09// Normalising input%0A%09%09OptionType opt = ALIAS_TABLE.get(value.toLowerCase());%0A%0A%09%09if (opt == null) %7B%0A%09%09%09throw new IllegalArgumentException(%22Not an alias: %22 + value);%0A%09%09%7D%0A%09%09%0A%09%09return opt;%0A%09%7D%0A%09private List%3CString%3E aliases;%0A%09private OptionType(String... aliases) %7B%0A%09%09this.aliases = Arrays.asList(aliases);%0A%09%7D%0A%7D%0A

Create an enum class to store aliases of option