use of pcgen.core.SpecialProperty in project pcgen by PCGen.
the class SpropToken method unparse.
@Override
public String[] unparse(LoadContext context, Equipment eq) {
Changes<SpecialProperty> changes = context.getObjectContext().getListChanges(eq, ListKey.SPECIAL_PROPERTIES);
if (changes == null || changes.isEmpty()) {
return null;
}
List<String> list = new ArrayList<>();
Collection<SpecialProperty> added = changes.getAdded();
boolean globalClear = changes.includesGlobalClear();
if (globalClear) {
list.add(Constants.LST_DOT_CLEAR);
}
if (added != null && !added.isEmpty()) {
for (SpecialProperty sp : added) {
StringBuilder sb = new StringBuilder();
sb.append(sp.getDisplayName());
if (sp.hasPrerequisites()) {
sb.append(Constants.PIPE);
sb.append(getPrerequisiteString(context, sp.getPrerequisiteList()));
}
list.add(sb.toString());
}
}
if (list.isEmpty()) {
context.addWriteMessage(getTokenName() + " was expecting non-empty changes to include " + "added items or global clear");
return null;
}
return list.toArray(new String[list.size()]);
}
Aggregations