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

Method unparse

code/src/java/plugin/lsttokens/AbilityLst.java:300–459  ·  view source on GitHub ↗
(LoadContext context, CDOMObject obj)

Source from the content-addressed store, hash-verified

298 }
299
300 @Override
301 public String[] unparse(LoadContext context, CDOMObject obj)
302 {
303 Collection<CDOMReference<? extends CDOMList<?>>> changedLists =
304 context.getListContext().getChangedLists(obj, AbilityList.class);
305 Changes<ListKey<ChooseSelectionActor<?>>> actors =
306 context.getObjectContext().getListChanges(obj, ListKey.GA_CAKEYS);
307 Set<String> returnSet = new TreeSet<>();
308 TripleKeyMapToList<Nature, CDOMSingleRef<AbilityCategory>, List<Prerequisite>, CDOMReference<Ability>> m =
309 new TripleKeyMapToList<>();
310 TripleKeyMapToList<Nature, CDOMSingleRef<AbilityCategory>, List<Prerequisite>, CDOMReference<Ability>> clear =
311 new TripleKeyMapToList<>();
312
313 Changes<ChooseSelectionActor<?>> listChanges =
314 context.getObjectContext().getListChanges(obj, ListKey.NEW_CHOOSE_ACTOR);
315 Collection<ChooseSelectionActor<?>> listAdded = listChanges.getAdded();
316 if ((listAdded != null) && !listAdded.isEmpty())
317 {
318 for (ChooseSelectionActor<?> csa : listAdded)
319 {
320 if (csa.getSource().equals(getTokenName()))
321 {
322 AbilitySelector as = (AbilitySelector) csa;
323 String sb = as.getAbilityCategory().getLSTformat(false) + Constants.PIPE
324 + as.getNature() + Constants.PIPE
325 + as.getLstFormat();
326 returnSet.add(sb);
327 }
328 }
329 }
330
331 for (CDOMReference ref : changedLists)
332 {
333 AssociatedChanges<CDOMReference<Ability>> changes =
334 context.getListContext().getChangesInList(getTokenName(), obj, ref);
335 if (changes.includesGlobalClear())
336 {
337 CDOMDirectSingleRef<AbilityList> dr = (CDOMDirectSingleRef<AbilityList>) ref;
338 AbilityList al = dr.get();
339 String sb = al.getCategory().getLSTformat(false) + Constants.PIPE
340 + al.getNature() + Constants.PIPE
341 + Constants.LST_DOT_CLEAR;
342 returnSet.add(sb);
343 }
344 MapToList<CDOMReference<Ability>, AssociatedPrereqObject> mtl = changes.getAddedAssociations();
345 if (mtl != null)
346 {
347 for (CDOMReference<Ability> ab : mtl.getKeySet())
348 {
349 for (AssociatedPrereqObject assoc : mtl.getListFor(ab))
350 {
351 Nature nature = assoc.getAssociation(AssociationKey.NATURE);
352 CDOMSingleRef<AbilityCategory> cat = assoc.getAssociation(AssociationKey.CATEGORY);
353 m.addToListFor(nature, cat, assoc.getPrerequisiteList(), ab);
354 }
355 }
356 }
357 mtl = changes.getRemovedAssociations();

Callers

nothing calls this directly

Calls 15

getTokenNameMethod · 0.95
getAbilityCategoryMethod · 0.95
getNatureMethod · 0.95
getLstFormatMethod · 0.95
getCategoryMethod · 0.95
getNatureMethod · 0.95
addToListForMethod · 0.95
getKeySetMethod · 0.95
getSecondaryKeySetMethod · 0.95
getTertiaryKeySetMethod · 0.95
removeListForMethod · 0.95
joinLstFormatMethod · 0.95

Tested by

no test coverage detected