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

Method removeChild

code/src/java/pcgen/core/Equipment.java:3190–3211  ·  view source on GitHub ↗

Removes a child from the Equipment @param pc The PC carrying the item @param child The child to remove

(final PlayerCharacter pc, final Object child)

Source from the content-addressed store, hash-verified

3188 * The child to remove
3189 */
3190 public void removeChild(final PlayerCharacter pc, final Object child)
3191 {
3192
3193 final int i = indexOfChild(child);
3194 Equipment anEquip = (Equipment) child;
3195 final Float qtyRemoved = anEquip.numberCarried();
3196 setChildType("Total", getChildType("Total") - qtyRemoved);
3197
3198 final String aString = anEquip.isIndexedUnderType();
3199 setChildType(aString, getChildType(aString) - qtyRemoved);
3200 anEquip.setParent(null);
3201 removeContainedEquipment(i);
3202 updateContainerContentsString(pc);
3203
3204 Equipment equipment = this;
3205
3206 while (equipment.getParent() != null)
3207 {
3208 equipment = equipment.getParent();
3209 equipment.updateContainerContentsString(pc);
3210 }
3211 }
3212
3213 /**
3214 * Description of the Method

Callers 3

removeEquipmentMethod · 0.95

Calls 9

indexOfChildMethod · 0.95
numberCarriedMethod · 0.95
setChildTypeMethod · 0.95
getChildTypeMethod · 0.95
isIndexedUnderTypeMethod · 0.95
setParentMethod · 0.95
getParentMethod · 0.95

Tested by

no test coverage detected