MCPcopy Create free account
hub / github.com/PCGen/pcgen / parseLine

Method parseLine

code/src/java/pcgen/persistence/lst/BioSetLoader.java:72–169  ·  view source on GitHub ↗
(LoadContext context, String lstLine, URI sourceURI)

Source from the content-addressed store, hash-verified

70 }
71
72 @Override
73 public void parseLine(LoadContext context, String lstLine, URI sourceURI)
74 {
75 if (lstLine.startsWith("#"))
76 {
77 //Is a comment
78 return;
79 }
80 if (lstLine.startsWith("AGESET:"))
81 {
82 String line = lstLine.substring(7);
83 int pipeLoc = line.indexOf('|');
84 if (pipeLoc == -1)
85 {
86 Logging.errorPrint(
87 "Found invalid AGESET " + "in Bio Settings " + sourceURI + ", was expecting a |: " + lstLine);
88 return;
89 }
90 String ageIndexString = line.substring(0, pipeLoc);
91 try
92 {
93 currentAgeSetIndex = Integer.parseInt(ageIndexString);
94 }
95 catch (NumberFormatException e)
96 {
97 Logging.errorPrint("Illegal Index for AGESET " + "in Bio Settings " + sourceURI + ": " + ageIndexString
98 + " was not an integer");
99 }
100 StringTokenizer colToken = new StringTokenizer(line.substring(pipeLoc + 1), SystemLoader.TAB_DELIM);
101 AgeSet ageSet = new AgeSet();
102 ageSet.setSourceURI(sourceURI);
103 ageSet.setAgeIndex(currentAgeSetIndex);
104 ageSet.setName(colToken.nextToken());
105 while (colToken.hasMoreTokens())
106 {
107 LstUtils.processToken(context, ageSet, sourceURI,
108 colToken.nextToken());
109 }
110
111 ageSet = bioSet.addToAgeMap(region, ageSet, sourceURI);
112 Integer oldIndex = bioSet.addToNameMap(ageSet);
113 if (oldIndex != null && oldIndex != currentAgeSetIndex)
114 {
115 Logging.errorPrint("Incompatible Index for AGESET " + "in Bio Settings " + sourceURI + ": "
116 + oldIndex + " and " + currentAgeSetIndex + " for " + ageSet.getDisplayName());
117 }
118
119 }
120 else if (lstLine.startsWith("REGION:"))
121 {
122 region = Optional.of(Region.getConstant(lstLine.substring(7)));
123 }
124 else if (lstLine.startsWith("RACENAME:"))
125 {
126 StringTokenizer colToken = new StringTokenizer(lstLine, SystemLoader.TAB_DELIM);
127 String raceName = colToken.nextToken().substring(9);
128 List<String> preReqList = null;
129

Callers

nothing calls this directly

Calls 15

errorPrintMethod · 0.95
setSourceURIMethod · 0.95
setAgeIndexMethod · 0.95
setNameMethod · 0.95
processTokenMethod · 0.95
getDisplayNameMethod · 0.95
getConstantMethod · 0.95
isPreReqStringMethod · 0.95
parseIntMethod · 0.80
nextTokenMethod · 0.80
hasMoreTokensMethod · 0.80
addToAgeMapMethod · 0.80

Tested by

no test coverage detected