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

Method dataRemoved

code/src/java/pcgen/cdom/facet/AddLevelFacet.java:92–105  ·  view source on GitHub ↗

Drives the necessary removal of the results of an ADDLEVEL: token to remove the added levels from a Player Character because the object granting the ADDLEVEL: was removed from the Player Character. Triggered when one of the Facets to which AddLevelFacet listens fires a DataFacetChangeEvent to indic

(DataFacetChangeEvent<CharID, PCTemplate> dfce)

Source from the content-addressed store, hash-verified

90 * change
91 */
92 @Override
93 public void dataRemoved(DataFacetChangeEvent<CharID, PCTemplate> dfce)
94 {
95 PCTemplate template = dfce.getCDOMObject();
96 CharID id = dfce.getCharID();
97 PlayerCharacter pc = trackingFacet.getPC(id);
98
99 List<LevelCommandFactory> lcfList = template.getSafeListFor(ListKey.ADD_LEVEL);
100 for (ListIterator<LevelCommandFactory> it = lcfList.listIterator(lcfList.size()); it.hasPrevious();)
101 {
102 LevelCommandFactory lcf = it.previous();
103 remove(lcf.getLevelCount(), lcf.getPCClass(), pc);
104 }
105 }
106
107 /**
108 * Adds levels of the given PCClass to the given PlayerCharacter.

Callers

nothing calls this directly

Calls 11

removeMethod · 0.95
getLevelCountMethod · 0.95
getPCClassMethod · 0.95
hasPreviousMethod · 0.80
previousMethod · 0.80
getCDOMObjectMethod · 0.65
getCharIDMethod · 0.65
getSafeListForMethod · 0.65
sizeMethod · 0.65
getPCMethod · 0.45
listIteratorMethod · 0.45

Tested by

no test coverage detected