|
Lines 140-146
Link Here
|
| 140 |
|
140 |
|
| 141 |
// Determine the values that will remain and move them into the right order, if necessary. |
141 |
// Determine the values that will remain and move them into the right order, if necessary. |
| 142 |
// |
142 |
// |
| 143 |
List<Object> remainingValues = new BasicEList.FastCompare<Object>(oldValues); |
143 |
EList<Object> remainingValues = new BasicEList.FastCompare<Object>(oldValues); |
| 144 |
remainingValues.removeAll(removedValues); |
144 |
remainingValues.removeAll(removedValues); |
| 145 |
int count = -1; |
145 |
int count = -1; |
| 146 |
for (Object object : values) |
146 |
for (Object object : values) |
|
Lines 149-154
Link Here
|
| 149 |
if (position != -1 && position != ++count) |
149 |
if (position != -1 && position != ++count) |
| 150 |
{ |
150 |
{ |
| 151 |
compound.append(MoveCommand.create(domain, owner, feature, object, count)); |
151 |
compound.append(MoveCommand.create(domain, owner, feature, object, count)); |
|
|
152 |
remainingValues.move(count, position); |
| 152 |
} |
153 |
} |
| 153 |
} |
154 |
} |
| 154 |
|
155 |
|
|
Lines 156-172
Link Here
|
| 156 |
// |
157 |
// |
| 157 |
List<Object> addedValues = new BasicEList.FastCompare<Object>(values); |
158 |
List<Object> addedValues = new BasicEList.FastCompare<Object>(values); |
| 158 |
addedValues.removeAll(remainingValues); |
159 |
addedValues.removeAll(remainingValues); |
| 159 |
int addIndex = remainingValues.size(); |
160 |
if (!addedValues.isEmpty()) |
| 160 |
for (ListIterator<?> i = values.listIterator(values.size()); i.hasPrevious(); ) |
|
|
| 161 |
{ |
161 |
{ |
| 162 |
Object object = i.previous(); |
162 |
int addIndex = remainingValues.size(); |
| 163 |
if (addedValues.contains(object)) |
163 |
for (ListIterator<?> i = values.listIterator(values.size()); i.hasPrevious(); ) |
| 164 |
{ |
164 |
{ |
| 165 |
compound.append(AddCommand.create(domain, owner, feature, object, addIndex)); |
165 |
Object object = i.previous(); |
| 166 |
} |
166 |
if (addedValues.contains(object)) |
| 167 |
else |
167 |
{ |
| 168 |
{ |
168 |
compound.append(AddCommand.create(domain, owner, feature, object, addIndex)); |
| 169 |
--addIndex; |
169 |
} |
|
|
170 |
else |
| 171 |
{ |
| 172 |
--addIndex; |
| 173 |
} |
| 170 |
} |
174 |
} |
| 171 |
} |
175 |
} |
| 172 |
return compound; |
176 |
return compound; |