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

Method parse

code/src/java/plugin/lsttokens/gamemode/ActypeToken.java:49–92  ·  view source on GitHub ↗
(GameMode gameMode, String value, URI source)

Source from the content-addressed store, hash-verified

47 }
48
49 @Override
50 public boolean parse(GameMode gameMode, String value, URI source)
51 {
52 final StringTokenizer aTok = new StringTokenizer(value, "\t");
53
54 if (!aTok.hasMoreTokens())
55 {
56 Logging.errorPrint("Empty tag in miscinfo.ACTYPE");
57
58 return false;
59 }
60
61 final String acType = aTok.nextToken();
62
63 while (aTok.hasMoreTokens())
64 {
65 final String aString = aTok.nextToken();
66
67 if (aString.startsWith("ADD:"))
68 {
69 Collection<ACControl> controls = parseACControl(aString.substring(4));
70 if (controls == null)
71 {
72 return false;
73 }
74 gameMode.addACAdds(acType, controls);
75 }
76 else if (aString.startsWith("REMOVE:"))
77 {
78 Collection<ACControl> controls = parseACControl(aString.substring(7));
79 if (controls == null)
80 {
81 return false;
82 }
83 gameMode.addACRemoves(acType, controls);
84 }
85 else
86 {
87 Logging.errorPrint("Incorrect tag in miscinfo.ACTYPE: " + aString);
88 return false;
89 }
90 }
91 return true;
92 }
93
94 private Collection<ACControl> parseACControl(String str)
95 {

Callers

nothing calls this directly

Calls 6

errorPrintMethod · 0.95
parseACControlMethod · 0.95
hasMoreTokensMethod · 0.80
nextTokenMethod · 0.80
addACAddsMethod · 0.80
addACRemovesMethod · 0.80

Tested by

no test coverage detected