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

Method parse

code/src/java/plugin/pretokens/parser/PreHPParser.java:54–77  ·  view source on GitHub ↗

Parse the pre req list @param kind The kind of the prerequisite (less the "PRE" prefix) @param formula The body of the prerequisite. @param invertResult Whether the prerequisite should invert the result. @param overrideQualify if set true, this prerequisite will be enforced in spite

(String kind, String formula, boolean invertResult, boolean overrideQualify)

Source from the content-addressed store, hash-verified

52 */
53
54 @Override
55 public Prerequisite parse(String kind, String formula, boolean invertResult, boolean overrideQualify)
56 throws PersistenceLayerException
57 {
58 Prerequisite prereq = super.parse(kind, formula, invertResult, overrideQualify);
59
60 try
61 {
62 int minHitPoints = Integer.parseInt(formula);
63 prereq.setOperator(PrerequisiteOperator.GTEQ);
64 prereq.setOperand(Integer.toString(minHitPoints));
65 }
66 catch (NumberFormatException nfe)
67 {
68 throw new PersistenceLayerException("PREHP formula must be an integer '" + formula + "' is not valid.",
69 nfe);
70 }
71
72 if (invertResult)
73 {
74 prereq.setOperator(prereq.getOperator().invert());
75 }
76 return prereq;
77 }
78}

Callers

nothing calls this directly

Calls 7

setOperatorMethod · 0.95
setOperandMethod · 0.95
getOperatorMethod · 0.95
parseIntMethod · 0.80
invertMethod · 0.80
parseMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected