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

Method unparse

code/src/java/plugin/lsttokens/DescLst.java:137–178  ·  view source on GitHub ↗
(LoadContext context, CDOMObject obj)

Source from the content-addressed store, hash-verified

135 }
136
137 @Override
138 public String[] unparse(LoadContext context, CDOMObject obj)
139 {
140 PatternChanges<Description> changes =
141 context.getObjectContext().getListPatternChanges(obj, ListKey.DESCRIPTION);
142 if (changes == null || changes.isEmpty())
143 {
144 return null;
145 }
146 List<String> list = new ArrayList<>();
147 Collection<String> removedItems = changes.getRemoved();
148 if (changes.includesGlobalClear())
149 {
150 if (removedItems != null && !removedItems.isEmpty())
151 {
152 context.addWriteMessage(
153 "Non-sensical relationship in " + getTokenName() + ": global .CLEAR and local .CLEAR. performed");
154 return null;
155 }
156 list.add(Constants.LST_DOT_CLEAR);
157 }
158 if (removedItems != null && !removedItems.isEmpty())
159 {
160 for (String d : removedItems)
161 {
162 list.add(Constants.LST_DOT_CLEAR_DOT + d);
163 }
164 }
165 Collection<Description> addedItems = changes.getAdded();
166 if (addedItems != null)
167 {
168 for (Description d : addedItems)
169 {
170 list.add(d.getPCCText());
171 }
172 }
173 if (list.isEmpty())
174 {
175 return null;
176 }
177 return list.toArray(new String[0]);
178 }
179
180 @Override
181 public Class<CDOMObject> getTokenClass()

Callers

nothing calls this directly

Calls 11

getTokenNameMethod · 0.95
getListPatternChangesMethod · 0.65
getObjectContextMethod · 0.65
isEmptyMethod · 0.65
getRemovedMethod · 0.65
includesGlobalClearMethod · 0.65
addWriteMessageMethod · 0.65
addMethod · 0.65
getAddedMethod · 0.65
getPCCTextMethod · 0.45
toArrayMethod · 0.45

Tested by

no test coverage detected