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

Method parseLine

code/src/java/pcgen/persistence/lst/PCClassLoader.java:42–145  ·  view source on GitHub ↗
(LoadContext context, PCClass target, String lstLine, SourceEntry source)

Source from the content-addressed store, hash-verified

40public final class PCClassLoader extends LstObjectFileLoader<PCClass>
41{
42 @Override
43 public PCClass parseLine(LoadContext context, PCClass target, String lstLine, SourceEntry source)
44 {
45 if (lstLine.startsWith("SUBCLASS:") || lstLine.startsWith("SUBCLASSLEVEL:"))
46 {
47 if (target == null)
48 {
49 Logging.errorPrint("Ignoring line: " + lstLine + " as SUBCLASS* type line appeared before CLASS: line");
50 return null;
51 }
52 SubClass subClass;
53
54 if (lstLine.startsWith("SUBCLASS:"))
55 {
56 int tabLoc = lstLine.indexOf('\t');
57 if (tabLoc == -1)
58 {
59 Logging.errorPrint("Expected SUBCLASS to have " + "additional Tags in " + source.getURI()
60 + " (e.g. COST is a required Tag in a SUBCLASS)");
61 }
62 final String n = lstLine.substring(9, tabLoc);
63 String restOfLine = lstLine.substring(tabLoc);
64 subClass = target.getSubClassKeyed(n);
65
66 if (subClass == null)
67 {
68 subClass = new SubClass();
69 subClass.setName(n);
70 subClass.put(ObjectKey.SOURCE_CAMPAIGN, source.getCampaign());
71 subClass.setSourceURI(source.getURI());
72 target.addSubClass(subClass);
73 }
74 parseLineIntoClass(context, subClass, source, restOfLine);
75 }
76 else
77 {
78 List<SubClass> subClassList = target.getListFor(ListKey.SUB_CLASS);
79 if (subClassList != null)
80 {
81 subClass = subClassList.get(subClassList.size() - 1);
82 subClass.addToListFor(ListKey.SUB_CLASS_LEVEL,
83 new DeferredLine(source, lstLine.substring(14)));
84 }
85 }
86 return target;
87 }
88
89 if (lstLine.startsWith("SUBSTITUTIONCLASS:") || lstLine.startsWith("SUBSTITUTIONLEVEL:"))
90 {
91 if (target == null)
92 {
93 Logging.errorPrint(
94 "Ignoring line: " + lstLine + " as SUBSTITUTIONCLASS* type line appeared before CLASS: line");
95 return null;
96 }
97 SubstitutionClass substitutionClass;
98
99 if (lstLine.startsWith("SUBSTITUTIONCLASS:"))

Callers 13

setUpMethod · 0.95
testGetPCCTextMethod · 0.95
testGetPCCTextMethod · 0.95
parsePCClassTextMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
test2857849aMethod · 0.95
parsePCClassTextMethod · 0.95
parsePCClassTextMethod · 0.95

Calls 15

errorPrintMethod · 0.95
parseLineIntoClassMethod · 0.95
parseClassLineMethod · 0.95
getSubClassKeyedMethod · 0.80
addSubClassMethod · 0.80
addSubstitutionClassMethod · 0.80
indexOfMethod · 0.65
getURIMethod · 0.65
setNameMethod · 0.65
putMethod · 0.65
getCampaignMethod · 0.65

Tested by 12

setUpMethod · 0.76
testGetPCCTextMethod · 0.76
testGetPCCTextMethod · 0.76
parsePCClassTextMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
test2857849aMethod · 0.76
parsePCClassTextMethod · 0.76
parsePCClassTextMethod · 0.76