@Override
public void moveDescriptionElementsToDescription(Collection<DescriptionElementBase> descriptionElements,
DescriptionBase targetDescription, boolean isCopy) {
- Iterator<DescriptionElementBase> iterator = descriptionElements.iterator();
- while (iterator.hasNext()){
- DescriptionElementBase elementToRemove = iterator.next();
+
+ for (DescriptionElementBase element : descriptionElements){
+ DescriptionBase description = element.getInDescription();
+ try {
+ DescriptionElementBase newElement = (DescriptionElementBase)element.clone();
+ targetDescription.addElement(newElement);
+ } catch (CloneNotSupportedException e) {
+ new RuntimeException ("Clone not yet implemented for class " + element.getClass().getName(), e);
+ }
if (! isCopy){
- iterator.remove();
- }else{
- try {
- elementToRemove = (DescriptionElementBase)elementToRemove.clone();
- } catch (CloneNotSupportedException e) {
- new RuntimeException ("Clone not yet implemented for class " + elementToRemove.getClass().getName(), e);
- }
+ description.removeElement(element);
+// iterator.remove();
}
- targetDescription.addElement(elementToRemove);
+
}
+// Iterator<DescriptionElementBase> iterator = descriptionElements.iterator();
+// while (iterator.hasNext()){
+// DescriptionElementBase elementToRemove = iterator.next();
+// try {
+// elementToRemove = (DescriptionElementBase)elementToRemove.clone();
+// } catch (CloneNotSupportedException e) {
+// new RuntimeException ("Clone not yet implemented for class " + elementToRemove.getClass().getName(), e);
+// }
+//
+// targetDescription.addElement(elementToRemove);
+// if (! isCopy){
+// iterator.remove();
+// }
+// }
}
}