MCPcopy Index your code
hub / github.com/PCGen/pcgen / parseTokenWithSeparator

Method parseTokenWithSeparator

code/src/java/plugin/lsttokens/FactLst.java:48–75  ·  view source on GitHub ↗
(LoadContext context, CDOMObject cdo, String value)

Source from the content-addressed store, hash-verified

46 }
47
48 @Override
49 protected ParseResult parseTokenWithSeparator(LoadContext context, CDOMObject cdo, String value)
50 {
51 int pipeLoc = value.indexOf(Constants.PIPE);
52 if (pipeLoc == -1)
53 {
54 return new ParseResult.Fail(
55 getTokenName() + " expecting '|', format is: " + "Fact identification|Fact value ... was: " + value);
56 }
57 else if (pipeLoc != value.lastIndexOf(Constants.PIPE))
58 {
59 return new ParseResult.Fail(getTokenName() + " expecting only one '|', format is: "
60 + "Fact identification|Fact value ... was: " + value);
61 }
62 String factID = value.substring(0, pipeLoc);
63 if (factID.isEmpty())
64 {
65 return new ParseResult.Fail(getTokenName() + " expecting non-empty identification, "
66 + "format is: Fact identification|Fact value ... was: " + value);
67 }
68 String factStr = value.substring(pipeLoc + 1);
69 if (factStr.isEmpty())
70 {
71 return new ParseResult.Fail(getTokenName() + " expecting non-empty value, "
72 + "format is: Fact identification|Fact value ... was: " + value);
73 }
74 return context.processSubToken(cdo, getTokenName(), factID, factStr);
75 }
76
77 @Override
78 public String[] unparse(LoadContext context, CDOMObject cdo)

Callers

nothing calls this directly

Calls 5

getTokenNameMethod · 0.95
indexOfMethod · 0.65
lastIndexOfMethod · 0.65
isEmptyMethod · 0.65
processSubTokenMethod · 0.65

Tested by

no test coverage detected