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

Method clone

code/src/java/pcgen/core/PCClass.java:659–699  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

657 }
658
659 @Override
660 public PCClass clone()
661 {
662 PCClass aClass = null;
663
664 try
665 {
666 aClass = (PCClass) super.clone();
667
668 List<KnownSpellIdentifier> ksl = getListFor(ListKey.KNOWN_SPELLS);
669 if (ksl != null)
670 {
671 aClass.removeListFor(ListKey.KNOWN_SPELLS);
672 for (KnownSpellIdentifier ksi : ksl)
673 {
674 aClass.addToListFor(ListKey.KNOWN_SPELLS, ksi);
675 }
676 }
677 Map<AttackType, Integer> acmap = getMapFor(MapKey.ATTACK_CYCLE);
678 if (acmap != null && !acmap.isEmpty())
679 {
680 aClass.removeMapFor(MapKey.ATTACK_CYCLE);
681 for (Map.Entry<AttackType, Integer> me : acmap.entrySet())
682 {
683 aClass.addToMapFor(MapKey.ATTACK_CYCLE, me.getKey(), me.getValue());
684 }
685 }
686
687 aClass.levelMap = new TreeMap<>();
688 for (Map.Entry<Integer, PCClassLevel> me : levelMap.entrySet())
689 {
690 aClass.levelMap.put(me.getKey(), me.getValue().clone());
691 }
692 }
693 catch (CloneNotSupportedException exc)
694 {
695 ShowMessageDelegate.showMessageDialog(exc.getMessage(), Constants.APPLICATION_NAME, MessageType.ERROR);
696 }
697
698 return aClass;
699 }
700
701 /*
702 * PCCLASSLEVELONLY Since this is really only something that will be done

Callers 3

makeIntoExClassMethod · 0.95
parseClassLineMethod · 0.95
copyLevelsFromMethod · 0.45

Calls 13

showMessageDialogMethod · 0.95
getListForMethod · 0.65
removeListForMethod · 0.65
addToListForMethod · 0.65
isEmptyMethod · 0.65
getKeyMethod · 0.65
getValueMethod · 0.65
putMethod · 0.65
getMessageMethod · 0.65
getMapForMethod · 0.45
removeMapForMethod · 0.45
entrySetMethod · 0.45

Tested by

no test coverage detected