/** * Creates a string array specifying the region * * @param region * @return */ public static String[] toRegionStringArr(Region region) { if (region.getName().endsWith("FLT") || region.getName().endsWith("AMY")) { return new String[] {region.getProvince().getName()}; } return new String[] { "(", region.getName().substring(0, 3), region.getName().substring(3, 6), ")" }; }
/** * Creates an array that represents a unit * * @param unit * @return */ public static String[] toUnitOrderStringArr(Region region, Power power) { String[] regionStrArr = toRegionStringArr(region); String[] order = new String[4 + regionStrArr.length]; String type = region.getName().substring(3, 6); if (!type.equals("AMY") && !type.equals("FLT")) { type = "FLT"; } order[0] = "("; order[1] = power.getName(); order[2] = type; int i = 3; for (String str : regionStrArr) { order[i++] = str; } order[i++] = ")"; return order; }