(LoadContext context, Race race)
| 183 | } |
| 184 | |
| 185 | @Override |
| 186 | public String[] unparse(LoadContext context, Race race) |
| 187 | { |
| 188 | CDOMGroupRef<ClassSkillList> monsterList = |
| 189 | context.getReferenceContext().getCDOMTypeReference(ClassSkillList.class, "Monster"); |
| 190 | AssociatedChanges<CDOMReference<Skill>> changes = |
| 191 | context.getListContext().getChangesInList(getTokenName(), race, monsterList); |
| 192 | Changes<ChooseSelectionActor<?>> listChanges = |
| 193 | context.getObjectContext().getListChanges(race, ListKey.NEW_CHOOSE_ACTOR); |
| 194 | List<String> list = new ArrayList<>(); |
| 195 | Collection<CDOMReference<Skill>> removedItems = changes.getRemoved(); |
| 196 | if (removedItems != null && !removedItems.isEmpty()) |
| 197 | { |
| 198 | if (changes.includesGlobalClear()) |
| 199 | { |
| 200 | context.addWriteMessage( |
| 201 | "Non-sensical relationship in " + getTokenName() + ": global .CLEAR and local .CLEAR. performed"); |
| 202 | return null; |
| 203 | } |
| 204 | list.add(Constants.LST_DOT_CLEAR_DOT + ReferenceUtilities.joinLstFormat(removedItems, "|.CLEAR.")); |
| 205 | } |
| 206 | Collection<ChooseSelectionActor<?>> listRemoved = listChanges.getRemoved(); |
| 207 | if (listRemoved != null && !listRemoved.isEmpty()) |
| 208 | { |
| 209 | if (listRemoved.contains(this)) |
| 210 | { |
| 211 | list.add(".CLEAR.LIST"); |
| 212 | } |
| 213 | } |
| 214 | if (changes.includesGlobalClear()) |
| 215 | { |
| 216 | list.add(Constants.LST_DOT_CLEAR); |
| 217 | } |
| 218 | MapToList<CDOMReference<Skill>, AssociatedPrereqObject> map = changes.getAddedAssociations(); |
| 219 | if (map != null && !map.isEmpty()) |
| 220 | { |
| 221 | Set<CDOMReference<Skill>> added = map.getKeySet(); |
| 222 | for (CDOMReference<Skill> ab : added) |
| 223 | { |
| 224 | for (AssociatedPrereqObject assoc : map.getListFor(ab)) |
| 225 | { |
| 226 | if (!SkillCost.CLASS.equals(assoc.getAssociation(AssociationKey.SKILL_COST))) |
| 227 | { |
| 228 | context.addWriteMessage("Skill Cost must be " + "CLASS for Token " + getTokenName()); |
| 229 | return null; |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | list.add(ReferenceUtilities.joinLstFormat(added, Constants.PIPE)); |
| 234 | } |
| 235 | Collection<ChooseSelectionActor<?>> listAdded = listChanges.getAdded(); |
| 236 | if (listAdded != null && !listAdded.isEmpty()) |
| 237 | { |
| 238 | for (ChooseSelectionActor<?> csa : listAdded) |
| 239 | { |
| 240 | if (csa.getSource().equals(getTokenName())) |
| 241 | { |
| 242 | try |
nothing calls this directly
no test coverage detected