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

Method processAdds

code/src/java/plugin/lsttokens/SpellsLst.java:308–381  ·  view source on GitHub ↗
(LoadContext context,
		MapToList<CDOMReference<Spell>, AssociatedPrereqObject> mtl)

Source from the content-addressed store, hash-verified

306 }
307
308 private Collection<? extends String> processAdds(LoadContext context,
309 MapToList<CDOMReference<Spell>, AssociatedPrereqObject> mtl)
310 {
311 TripleKeyMap<Set<Prerequisite>, Map<AssociationKey<?>, Object>, CDOMReference<Spell>, String> m =
312 new TripleKeyMap<>();
313 for (CDOMReference<Spell> lw : mtl.getKeySet())
314 {
315 for (AssociatedPrereqObject assoc : mtl.getListFor(lw))
316 {
317 Map<AssociationKey<?>, Object> am = new HashMap<>();
318 String dc = null;
319 for (AssociationKey<?> ak : assoc.getAssociationKeys())
320 {
321 // if (AssociationKey.SOURCE_URI.equals(ak)
322 // || AssociationKey.FILE_LOCATION.equals(ak))
323 // {
324 // // Do nothing
325 // }
326 // else
327 if (AssociationKey.DC_FORMULA.equals(ak))
328 {
329 dc = assoc.getAssociation(AssociationKey.DC_FORMULA);
330 }
331 else
332 {
333 am.put(ak, assoc.getAssociation(ak));
334 }
335 }
336 m.put(new HashSet<>(assoc.getPrerequisiteList()), am, lw, dc);
337 }
338 }
339
340 Set<String> set = new TreeSet<>();
341 for (Set<Prerequisite> prereqs : m.getKeySet())
342 {
343 for (Map<AssociationKey<?>, Object> am : m.getSecondaryKeySet(prereqs))
344 {
345 StringBuilder sb = new StringBuilder();
346 sb.append(am.get(AssociationKey.SPELLBOOK));
347 Formula times = AssociationKey.TIMES_PER_UNIT.cast(am.get(AssociationKey.TIMES_PER_UNIT));
348 sb.append(Constants.PIPE).append("TIMES=").append(times);
349 String timeunit = AssociationKey.TIME_UNIT.cast(am.get(AssociationKey.TIME_UNIT));
350 if (timeunit != null)
351 {
352 sb.append(Constants.PIPE).append("TIMEUNIT=").append(timeunit);
353 }
354 String casterLvl = AssociationKey.CASTER_LEVEL.cast(am.get(AssociationKey.CASTER_LEVEL));
355 if (casterLvl != null)
356 {
357 sb.append(Constants.PIPE).append("CASTERLEVEL=").append(casterLvl);
358 }
359 Set<String> spellSet = new TreeSet<>();
360 for (CDOMReference<Spell> spell : m.getTertiaryKeySet(prereqs, am))
361 {
362 String spellString = spell.getLSTformat(false);
363 String dc = m.get(prereqs, am, spell);
364 if (dc != null)
365 {

Callers 1

unparseMethod · 0.95

Calls 15

putMethod · 0.95
getKeySetMethod · 0.95
getSecondaryKeySetMethod · 0.95
getTertiaryKeySetMethod · 0.95
getMethod · 0.95
joinMethod · 0.95
getKeySetMethod · 0.65
getListForMethod · 0.65
getAssociationKeysMethod · 0.65
equalsMethod · 0.65
getAssociationMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected