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

Method insertChild

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

Adds a child to this Equipment @param aPC The PC that has the Equipment @param child The child to add

(final PlayerCharacter aPC, final Object child)

Source from the content-addressed store, hash-verified

2872 * The child to add
2873 */
2874 public void insertChild(final PlayerCharacter aPC, final Object child)
2875 {
2876
2877 if (child == null)
2878 {
2879 return;
2880 }
2881
2882 Equipment anEquip = (Equipment) child;
2883 Float aFloat = anEquip.numberCarried();
2884 Float bFloat = aFloat;
2885
2886 final String aString = pickChildType(anEquip.eqTypeList(), aFloat);
2887
2888 if (containsChildType(aString))
2889 {
2890 aFloat = getChildType(aString) + aFloat;
2891 }
2892
2893 bFloat = getChildType("Total") + bFloat;
2894 setChildType(aString, aFloat);
2895 setChildType("Total", bFloat);
2896 addContainedEquipment(anEquip);
2897 anEquip.setIndexedUnderType(aString);
2898 anEquip.setParent(this);
2899
2900 // hmm probably not needed; but as it currently isn't hurting
2901 // anything...
2902 updateContainerContentsString(aPC);
2903
2904 while (anEquip.getParent() != null)
2905 {
2906 anEquip = anEquip.getParent();
2907 anEquip.updateContainerContentsString(aPC);
2908 }
2909 }
2910
2911 /**
2912 * Returns how 'deep' in a structure an Equipment is.

Callers 4

addEquipmentMethod · 0.95
parseEquipmentSetLineMethod · 0.95
addEquipToTargetMethod · 0.80

Calls 11

numberCarriedMethod · 0.95
pickChildTypeMethod · 0.95
eqTypeListMethod · 0.95
containsChildTypeMethod · 0.95
getChildTypeMethod · 0.95
setChildTypeMethod · 0.95
addContainedEquipmentMethod · 0.95
setIndexedUnderTypeMethod · 0.95
setParentMethod · 0.95
getParentMethod · 0.95

Tested by

no test coverage detected