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

Method processOldAdd

code/src/java/pcgen/io/Compatibility.java:106–137  ·  view source on GitHub ↗
(LoadContext context, String first)

Source from the content-addressed store, hash-verified

104 }
105
106 @Nullable
107 public static PersistentTransitionChoice<?> processOldAdd(LoadContext context, String first)
108 {
109 int openParenLoc = first.indexOf('(');
110 if (openParenLoc == -1)
111 {
112 Logging.errorPrint("Expected to have a ( : " + first);
113 return null;
114 }
115 int closeParenLoc = first.lastIndexOf(')');
116 if (closeParenLoc == -1)
117 {
118 Logging.errorPrint("Expected to have a ) : " + first);
119 return null;
120 }
121 String key = first.substring(7, openParenLoc);
122 String choices = first.substring(openParenLoc + 1, closeParenLoc);
123 String count = "";
124 if (closeParenLoc != (first.length() - 1))
125 {
126 count = first.substring(closeParenLoc + 1) + '|';
127 }
128 PCClass applied = new PCClass();
129 ParseResult pr = context.processSubToken(applied, "ADD", key, count + choices);
130 pr.printMessages(context.getSourceURI());
131 if (!pr.passed())
132 {
133 return null;
134 }
135 context.commit();
136 return applied.getListFor(ListKey.ADD).get(0);
137 }
138
139}

Callers 2

parseTokenMethod · 0.95
parseLevelAbilityInfoMethod · 0.95

Calls 10

errorPrintMethod · 0.95
printMessagesMethod · 0.95
passedMethod · 0.95
indexOfMethod · 0.65
lastIndexOfMethod · 0.65
processSubTokenMethod · 0.65
getSourceURIMethod · 0.65
commitMethod · 0.65
getMethod · 0.65
getListForMethod · 0.65

Tested by

no test coverage detected