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

Method getToken

code/src/java/plugin/exporttokens/PaperInfoToken.java:36–97  ·  view source on GitHub ↗
(String tokenSource, CharacterDisplay display, ExportHandler eh)

Source from the content-addressed store, hash-verified

34 }
35
36 @Override
37 public String getToken(String tokenSource, CharacterDisplay display, ExportHandler eh)
38 {
39 String oString = tokenSource;
40 String sourceText = tokenSource.substring(10);
41
42 int infoType = -1;
43
44 if (sourceText.startsWith("NAME"))
45 {
46 infoType = PaperInfo.NAME;
47 }
48 else if (sourceText.startsWith("HEIGHT"))
49 {
50 infoType = PaperInfo.HEIGHT;
51 }
52 else if (sourceText.startsWith("WIDTH"))
53 {
54 infoType = PaperInfo.WIDTH;
55 }
56 else if (sourceText.startsWith("MARGIN"))
57 {
58 sourceText = sourceText.substring(6);
59
60 if (sourceText.startsWith("TOP"))
61 {
62 infoType = PaperInfo.TOPMARGIN;
63 }
64 else if (sourceText.startsWith("BOTTOM"))
65 {
66 infoType = PaperInfo.BOTTOMMARGIN;
67 }
68 else if (sourceText.startsWith("LEFT"))
69 {
70 infoType = PaperInfo.LEFTMARGIN;
71 }
72 else if (sourceText.startsWith("RIGHT"))
73 {
74 infoType = PaperInfo.RIGHTMARGIN;
75 }
76 }
77
78 if (infoType >= 0)
79 {
80 int offs = sourceText.indexOf('=');
81 String info = Globals.getPaperInfo(infoType);
82
83 if (info == null)
84 {
85 if (offs >= 0)
86 {
87 oString = sourceText.substring(offs + 1);
88 }
89 }
90 else
91 {
92 oString = info;
93 }

Callers

nothing calls this directly

Calls 2

getPaperInfoMethod · 0.95
indexOfMethod · 0.65

Tested by

no test coverage detected