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

Method unparse

code/src/java/plugin/lsttokens/equipment/SpropToken.java:70–106  ·  view source on GitHub ↗
(LoadContext context, Equipment eq)

Source from the content-addressed store, hash-verified

68 }
69
70 @Override
71 public String[] unparse(LoadContext context, Equipment eq)
72 {
73 Changes<SpecialProperty> changes = context.getObjectContext().getListChanges(eq, ListKey.SPECIAL_PROPERTIES);
74 if (changes == null || changes.isEmpty())
75 {
76 return null;
77 }
78 List<String> list = new ArrayList<>();
79 Collection<SpecialProperty> added = changes.getAdded();
80 boolean globalClear = changes.includesGlobalClear();
81 if (globalClear)
82 {
83 list.add(Constants.LST_DOT_CLEAR);
84 }
85 if (added != null && !added.isEmpty())
86 {
87 for (SpecialProperty sp : added)
88 {
89 StringBuilder sb = new StringBuilder();
90 sb.append(sp.getDisplayName());
91 if (sp.hasPrerequisites())
92 {
93 sb.append(Constants.PIPE);
94 sb.append(getPrerequisiteString(context, sp.getPrerequisiteList()));
95 }
96 list.add(sb.toString());
97 }
98 }
99 if (list.isEmpty())
100 {
101 context.addWriteMessage(
102 getTokenName() + " was expecting non-empty changes to include " + "added items or global clear");
103 return null;
104 }
105 return list.toArray(new String[0]);
106 }
107
108 @Override
109 public Class<Equipment> getTokenClass()

Callers

nothing calls this directly

Calls 15

getTokenNameMethod · 0.95
getListChangesMethod · 0.65
getObjectContextMethod · 0.65
isEmptyMethod · 0.65
getAddedMethod · 0.65
includesGlobalClearMethod · 0.65
addMethod · 0.65
getDisplayNameMethod · 0.65
hasPrerequisitesMethod · 0.65
getPrerequisiteStringMethod · 0.65
getPrerequisiteListMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected