| 31 | import pcgen.util.Logging; |
| 32 | |
| 33 | public final class EquipSlotLoader extends LstLineFileLoader |
| 34 | { |
| 35 | |
| 36 | @Override |
| 37 | public void parseLine(LoadContext context, String lstLine, URI sourceURI) |
| 38 | { |
| 39 | final EquipSlot eqSlot = new EquipSlot(); |
| 40 | |
| 41 | final StringTokenizer colToken = new StringTokenizer(lstLine, SystemLoader.TAB_DELIM); |
| 42 | |
| 43 | Map<String, LstToken> tokenMap = TokenStore.inst().getTokenMap(EquipSlotLstToken.class); |
| 44 | while (colToken.hasMoreTokens()) |
| 45 | { |
| 46 | final String colString = colToken.nextToken().trim(); |
| 47 | |
| 48 | final int idxColon = colString.indexOf(':'); |
| 49 | String key = ""; |
| 50 | try |
| 51 | { |
| 52 | key = colString.substring(0, idxColon); |
| 53 | } |
| 54 | catch (StringIndexOutOfBoundsException e) |
| 55 | { |
| 56 | // TODO Handle Exception |
| 57 | } |
| 58 | EquipSlotLstToken token = (EquipSlotLstToken) tokenMap.get(key); |
| 59 | |
| 60 | //TODO: (DJ) Sick hack, remove in 5.11.x |
| 61 | if (token != null && key.equals("NUMSLOTS")) |
| 62 | { |
| 63 | final String value = colString.substring(idxColon + 1); |
| 64 | LstUtils.deprecationCheck(token, eqSlot.getSlotName(), sourceURI, value); |
| 65 | if (!token.parse(eqSlot, lstLine, getGameMode())) |
| 66 | { |
| 67 | Logging.errorPrint( |
| 68 | "Error parsing equip slots " + eqSlot.getSlotName() + ':' + sourceURI + ':' + colString + "\""); |
| 69 | } |
| 70 | break; |
| 71 | } |
| 72 | else if (token != null) |
| 73 | { |
| 74 | final String value = colString.substring(idxColon + 1); |
| 75 | LstUtils.deprecationCheck(token, eqSlot.getSlotName(), sourceURI, value); |
| 76 | if (!token.parse(eqSlot, value, getGameMode())) |
| 77 | { |
| 78 | Logging.errorPrint( |
| 79 | "Error parsing equip slots " + eqSlot.getSlotName() + ':' + sourceURI + ':' + colString + "\""); |
| 80 | } |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | Logging.errorPrint("Illegal slot info '" + lstLine + "' in " + sourceURI.toString()); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | SystemCollections.addToEquipSlotsList(eqSlot, getGameMode()); |
| 89 | } |
| 90 | } |
nothing calls this directly
no outgoing calls
no test coverage detected