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

Method unparse

code/src/java/plugin/lsttokens/SabLst.java:168–198  ·  view source on GitHub ↗
(LoadContext context, CDOMObject obj)

Source from the content-addressed store, hash-verified

166 }
167
168 @Override
169 public String[] unparse(LoadContext context, CDOMObject obj)
170 {
171 Changes<SpecialAbility> changes = context.getObjectContext().getListChanges(obj, ListKey.SAB);
172 Collection<SpecialAbility> added = changes.getAdded();
173 List<String> list = new ArrayList<>();
174 if (changes.includesGlobalClear())
175 {
176 list.add(Constants.LST_DOT_CLEAR);
177 }
178 else if (added == null || added.isEmpty())
179 {
180 // Zero indicates no Token (and no global clear, so nothing to do)
181 return null;
182 }
183 if (added != null)
184 {
185 for (SpecialAbility ab : added)
186 {
187 StringBuilder sb = new StringBuilder();
188 sb.append(ab.getKeyName());
189 if (ab.hasPrerequisites())
190 {
191 sb.append(Constants.PIPE);
192 sb.append(getPrerequisiteString(context, ab.getPrerequisiteList()));
193 }
194 list.add(sb.toString());
195 }
196 }
197 return list.toArray(new String[0]);
198 }
199
200 @Override
201 public Class<CDOMObject> getTokenClass()

Callers

nothing calls this directly

Calls 13

getListChangesMethod · 0.65
getObjectContextMethod · 0.65
getAddedMethod · 0.65
includesGlobalClearMethod · 0.65
addMethod · 0.65
isEmptyMethod · 0.65
getKeyNameMethod · 0.65
hasPrerequisitesMethod · 0.65
getPrerequisiteStringMethod · 0.65
getPrerequisiteListMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected