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

Method getToken

code/src/java/pcgen/io/exporttoken/EqTypeToken.java:46–123  ·  view source on GitHub ↗
(String tokenSource, PlayerCharacter pc, ExportHandler eh)

Source from the content-addressed store, hash-verified

44 }
45
46 @Override
47 public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh)
48 {
49 StringTokenizer aTok = new StringTokenizer(tokenSource, ".", false);
50 aTok.nextToken();
51
52 //Merge
53 String token = aTok.nextToken();
54 int merge = Constants.MERGE_ALL;
55 if (token.contains("MERGE"))
56 {
57 merge = returnMergeType(token);
58 token = aTok.nextToken();
59 }
60
61 //Get List
62 List<Equipment> eqList = new ArrayList<>();
63 if ("Container".equals(token))
64 {
65 for (Equipment eq : pc.getEquipmentListInOutputOrder(merge))
66 {
67 if (eq.isContainer())
68 {
69 eqList.add(eq);
70 }
71 }
72 }
73 else
74 {
75 eqList = pc.getEquipmentOfTypeInOutputOrder(token, 3, merge);
76 }
77
78 int temp = -1;
79 //Begin Not code...
80 while (aTok.hasMoreTokens())
81 {
82 if ("NOT".equalsIgnoreCase(token))
83 {
84 eqList = listNotType(eqList, aTok.nextToken());
85 }
86 else if ("ADD".equalsIgnoreCase(token))
87 {
88 eqList = listAddType(pc, eqList, aTok.nextToken());
89 }
90 else if ("IS".equalsIgnoreCase(token))
91 {
92 eqList = listIsType(eqList, aTok.nextToken());
93 }
94 else
95 {
96 // In the end of the above, bString would
97 // be valid token, that should go into temp.
98 try
99 {
100 temp = Integer.parseInt(token);
101 }
102 catch (NumberFormatException exc)
103 {

Callers 1

evaluateMethod · 0.95

Calls 15

isContainerMethod · 0.95
nextTokenMethod · 0.80
returnMergeTypeMethod · 0.80
hasMoreTokensMethod · 0.80
equalsIgnoreCaseMethod · 0.80
listNotTypeMethod · 0.80
listAddTypeMethod · 0.80
listIsTypeMethod · 0.80
parseIntMethod · 0.80
getEqTokenMethod · 0.80

Tested by

no test coverage detected