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

Method getVarValue

code/src/java/pcgen/io/ExportHandler.java:230–247  ·  view source on GitHub ↗

Get variable value from the variable string passed in, this might be an old style variable string (COUNT[EQ and STRLEN) or a new style (JEP formula) @param varString Variable string that we want to calculate value from @param aPC The PC that holds the data that we need to get the info from @return

(String varString, PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

228 * @return The result
229 */
230 private int getVarValue(String varString, PlayerCharacter aPC)
231 {
232 // While COUNT[EQ tokens exist, build up a string
233 String vString = processCountEquipmentTokens(varString, aPC);
234
235 // While STRLEN[ tokens exist, build up a string
236 vString = processStringLengthTokens(vString, aPC);
237
238 // If it is the new JEP style variable then deal with that
239 String valueString = vString;
240 if (varString.startsWith("${") && varString.endsWith("}"))
241 {
242 String jepString = varString.substring(2, varString.length() - 1);
243 valueString = jepString.replace(';', ',');
244 }
245
246 return aPC.getVariableValue(valueString, "").intValue();
247 }
248
249 /**
250 * Helper method for getting the variable value out of a variable string

Callers 4

evaluateIIFChildrenMethod · 0.95
processLoopMethod · 0.95
replaceTokenForDforMethod · 0.95

Calls 5

intValueMethod · 0.80
getVariableValueMethod · 0.65
replaceMethod · 0.45

Tested by

no test coverage detected