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

Method act

code/src/java/pcgen/cdom/helper/SAProcessor.java:39–72  ·  view source on GitHub ↗
(SpecialAbility sa, Object source)

Source from the content-addressed store, hash-verified

37 }
38
39 @Override
40 public SpecialAbility act(SpecialAbility sa, Object source)
41 {
42 final String key = sa.getKeyName();
43 final int idx = key.indexOf("%CHOICE");
44
45 if (idx == -1)
46 {
47 return sa;
48 }
49
50 StringBuilder sb = new StringBuilder(100);
51 sb.append(key.substring(0, idx));
52
53 if (source instanceof ChooseDriver object)
54 {
55 if (pc.hasAssociations(object))
56 {
57 List<String> associationList = pc.getAssociationList(object);
58 Collections.sort(associationList);
59 sb.append(StringUtil.join(associationList, ", "));
60 }
61 }
62 else
63 {
64 Logging.errorPrint(
65 "In SpecialAbility resolution, " + "Error using object of type: " + source.getClass().getName()
66 + " because " + "%CHOICE" + " was requested but the object does not support CHOOSE");
67 sb.append("<undefined>");
68 }
69
70 sb.append(key.substring(idx + 7));
71 return new SpecialAbility(sb.toString(), sa.getSADesc());
72 }
73}

Callers 2

getResolvedMethod · 0.95
getResolvedMethod · 0.95

Calls 11

joinMethod · 0.95
errorPrintMethod · 0.95
getSADescMethod · 0.80
getKeyNameMethod · 0.65
indexOfMethod · 0.65
hasAssociationsMethod · 0.65
getNameMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45
getAssociationListMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected