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

Method clone

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

Description of the Method FIXME: PMD Check is false as the parent of this class does implement Cloneable, so we suppress the warning @return Description of the Return Value

()

Source from the content-addressed store, hash-verified

2651 * @return Description of the Return Value
2652 */
2653 @Override
2654 public Equipment clone()
2655 {
2656 Equipment eq = null;
2657
2658 try
2659 {
2660 eq = (Equipment) super.clone();
2661
2662 eq.heads = new ArrayList<>();
2663 for (EquipmentHead head : heads)
2664 {
2665 if (head == null)
2666 {
2667 eq.heads.add(null);
2668 }
2669 else
2670 {
2671 EquipmentHead eh = new EquipmentHead(eq, head.getHeadIndex());
2672 eh.overlayCDOMObject(head);
2673 eq.heads.add(eh);
2674 }
2675 }
2676
2677 //
2678 if (bonusMap != null)
2679 {
2680 eq.bonusMap = new HashMap<>(bonusMap);
2681 }
2682 eq.setMoveString(moveString());
2683
2684 // eq.setTypeString(super.getType());
2685 // none of the types associated with modifiers
2686 eq.carried = carried;
2687 eq.equipped = equipped;
2688 eq.location = location;
2689 eq.numberEquipped = numberEquipped;
2690 eq.qty = qty;
2691 eq.outputIndex = outputIndex;
2692
2693 eq.d_childTypes = new HashMap<>(d_childTypes);
2694
2695 eq.d_containedEquipment = new ArrayList<>(d_containedEquipment);
2696
2697 eq.assocSupt = assocSupt.clone();
2698 eq.getEquipmentHead(1).removeListFor(ListKey.EQMOD);
2699 eq.getEquipmentHead(2).removeListFor(ListKey.EQMOD);
2700 eq.getEquipmentHead(1).addAllToListFor(ListKey.EQMOD, cloneEqModList(eq, true));
2701 eq.getEquipmentHead(2).addAllToListFor(ListKey.EQMOD, cloneEqModList(eq, false));
2702 }
2703 catch (CloneNotSupportedException e)
2704 {
2705 ShowMessageDelegate.showMessageDialog(e.getMessage(), Constants.APPLICATION_NAME, MessageType.ERROR);
2706 }
2707
2708 return eq;
2709 }
2710

Callers 12

addPurchasedEquipmentMethod · 0.95
selectClothesMethod · 0.95
getExpandedWeaponsMethod · 0.95
getEquipmentFromNameMethod · 0.95
parseEquipmentLineMethod · 0.95
parseEquipmentSetLineMethod · 0.95
parseTempBonusLineMethod · 0.95
loadCustomItemsMethod · 0.95
addEqModifierMethod · 0.45
cloneEqModListMethod · 0.45

Calls 11

setMoveStringMethod · 0.95
moveStringMethod · 0.95
getEquipmentHeadMethod · 0.95
cloneEqModListMethod · 0.95
showMessageDialogMethod · 0.95
getHeadIndexMethod · 0.80
overlayCDOMObjectMethod · 0.80
addMethod · 0.65
removeListForMethod · 0.65
addAllToListForMethod · 0.65
getMessageMethod · 0.65

Tested by 1