(LoadContext context, CDOMObject obj)
| 129 | } |
| 130 | |
| 131 | @Override |
| 132 | public String[] unparse(LoadContext context, CDOMObject obj) |
| 133 | { |
| 134 | Changes<PersistentTransitionChoice<?>> grantChanges = |
| 135 | context.getObjectContext().getListChanges(obj, ListKey.ADD); |
| 136 | Collection<PersistentTransitionChoice<?>> addedItems = grantChanges.getAdded(); |
| 137 | if (addedItems == null || addedItems.isEmpty()) |
| 138 | { |
| 139 | // Zero indicates no Token |
| 140 | return null; |
| 141 | } |
| 142 | List<String> addStrings = new ArrayList<>(); |
| 143 | for (TransitionChoice<?> container : addedItems) |
| 144 | { |
| 145 | SelectableSet<?> cs = container.getChoices(); |
| 146 | if (EQUIPMENT_CLASS.equals(cs.getChoiceClass())) |
| 147 | { |
| 148 | Formula f = container.getCount(); |
| 149 | if (f == null) |
| 150 | { |
| 151 | context.addWriteMessage("Unable to find " + getFullName() + " Count"); |
| 152 | return null; |
| 153 | } |
| 154 | if (f.isStatic() && f.resolveStatic().doubleValue() <= 0) |
| 155 | { |
| 156 | context.addWriteMessage("Count in " + getFullName() + " must be > 0"); |
| 157 | return null; |
| 158 | } |
| 159 | StringBuilder sb = new StringBuilder(); |
| 160 | if (!FormulaFactory.ONE.equals(f)) |
| 161 | { |
| 162 | sb.append(f).append(Constants.PIPE); |
| 163 | } |
| 164 | sb.append(cs.getLSTformat()); |
| 165 | addStrings.add(sb.toString()); |
| 166 | |
| 167 | // assoc.getAssociation(AssociationKey.CHOICE_MAXCOUNT); |
| 168 | } |
| 169 | } |
| 170 | return addStrings.toArray(new String[0]); |
| 171 | } |
| 172 | |
| 173 | @Override |
| 174 | public Class<CDOMObject> getTokenClass() |
nothing calls this directly
no test coverage detected