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

Method getShortToken

code/src/java/plugin/exporttokens/HitDiceToken.java:168–183  ·  view source on GitHub ↗

Get the short version of the HITDICE token @param display @return the short version of the HITDICE token

(CharacterDisplay display)

Source from the content-addressed store, hash-verified

166 * @return the short version of the HITDICE token
167 */
168 public static String getShortToken(CharacterDisplay display)
169 {
170 int dice = display.getClassSet().stream()
171 .map(pcClass ->
172 IntStream.range(0, display.getLevel(pcClass))
173 .map(i -> display.getLevelHitDie(pcClass, i + 1).getDie())
174 .boxed()
175 .collect(Collectors.toMap(Function.identity(),
176 hitDie -> 1,
177 Integer::sum,
178 LinkedHashMap::new)))
179 .mapToInt(hdMap -> hdMap.entrySet().stream().mapToInt(Map.Entry::getValue).sum())
180 .sum();
181
182 return String.valueOf(dice);
183 }
184}

Callers 2

getTokenMethod · 0.95
getMediumTokenMethod · 0.95

Calls 7

streamMethod · 0.80
getDieMethod · 0.80
getClassSetMethod · 0.45
getLevelMethod · 0.45
getLevelHitDieMethod · 0.45
entrySetMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected