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

Method parse

code/src/java/plugin/pretokens/parser/PreSizeParser.java:57–93  ·  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

55 * @throws PersistenceLayerException
56 */
57 @Override
58 public Prerequisite parse(String kind, String formula, boolean invertResult, boolean overrideQualify)
59 throws PersistenceLayerException
60 {
61 Prerequisite prereq = super.parse(kind, formula, invertResult, overrideQualify);
62 try
63 {
64 prereq.setKind("size");
65
66 // Get the comparator type SIZEGTEQ, BSIZE, SIZENEQ etc.
67 String compType = kind.substring(4);
68 if (compType.isEmpty())
69 {
70 compType = "gteq";
71 }
72 prereq.setOperator(compType);
73
74 String abb = formula.substring(0, 1);
75
76 LoadContext context = Globals.getContext();
77 CDOMSingleRef<SizeAdjustment> ref =
78 context.getReferenceContext().getCDOMReference(SizeAdjustment.class, abb);
79 context.forgetMeNot(ref);
80
81 prereq.setOperand(formula);
82 if (invertResult)
83 {
84 prereq.setOperator(prereq.getOperator().invert());
85 }
86 }
87 catch (PrerequisiteException pe)
88 {
89 throw new PersistenceLayerException(
90 "Unable to parse the prerequisite :'" + kind + ':' + formula + "'. " + pe.getLocalizedMessage(), pe);
91 }
92 return prereq;
93 }
94}

Callers

nothing calls this directly

Calls 11

setKindMethod · 0.95
setOperatorMethod · 0.95
getContextMethod · 0.95
getReferenceContextMethod · 0.95
forgetMeNotMethod · 0.95
setOperandMethod · 0.95
getOperatorMethod · 0.95
getCDOMReferenceMethod · 0.80
invertMethod · 0.80
parseMethod · 0.65
isEmptyMethod · 0.65

Tested by

no test coverage detected