diff options
Diffstat (limited to 'plugins')
75 files changed, 2375 insertions, 127 deletions
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/META-INF/MANIFEST.MF index 4b04a1947..226144562 100644 --- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.compare.diagram.papyrus.tests;singleton:=true -Bundle-Version: 2.5.0.qualifier +Bundle-Version: 2.5.1.qualifier Require-Bundle: org.eclipse.core.runtime, org.junit, org.eclipse.osgi, @@ -26,9 +26,9 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.compare.rcp.ui;bundle-version="4.0.0", org.eclipse.emf.compare.ide;bundle-version="3.2.0", org.eclipse.emf.compare.ide.ui, - org.eclipse.emf.compare.uml2;bundle-version="2.1.0", - org.eclipse.emf.compare.uml2.edit;bundle-version="2.2.0", - org.eclipse.emf.compare.uml2.rcp.ui;bundle-version="2.2.0", + org.eclipse.emf.compare.uml2;bundle-version="2.5.0", + org.eclipse.emf.compare.uml2.edit;bundle-version="2.5.0", + org.eclipse.emf.compare.uml2.rcp.ui;bundle-version="2.5.0", org.eclipse.emf.compare.diagram, org.eclipse.emf.compare.diagram.edit;bundle-version="2.3.0", org.eclipse.emf.compare.diagram.ide.ui;bundle-version="3.1.0", diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/pom.xml b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/pom.xml index f877b2b2e..1803a3983 100644 --- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/pom.xml +++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>org.eclipse.emf.compare</groupId> <artifactId>org.eclipse.emf.compare.diagram.papyrus.tests</artifactId> - <version>2.5.0-SNAPSHOT</version> + <version>2.5.1-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <build> diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/EdgeMergeTest.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/EdgeMergeTest.java index 0bd21ee1a..f573264c2 100644 --- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/EdgeMergeTest.java +++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/EdgeMergeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 Obeo. + * Copyright (c) 2013, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import java.io.IOException; +import java.util.regex.Pattern; import org.eclipse.emf.common.util.BasicMonitor; import org.eclipse.emf.compare.Comparison; @@ -30,8 +31,10 @@ import org.eclipse.emf.compare.diagram.internal.extensions.NodeChange; import org.eclipse.emf.compare.diagram.papyrus.tests.AbstractTest; import org.eclipse.emf.compare.diagram.papyrus.tests.DiagramInputData; import org.eclipse.emf.compare.diagram.papyrus.tests.merge.data.EdgeMergeInputData; +import org.eclipse.emf.compare.tests.postprocess.data.TestPostProcessor; import org.eclipse.emf.compare.uml2.internal.AssociationChange; import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange; +import org.eclipse.emf.compare.uml2.internal.postprocessor.MultiplicityElementChangePostProcessor; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.uml2.uml.UMLPackage; @@ -42,12 +45,12 @@ public class EdgeMergeTest extends AbstractTest { private EdgeMergeInputData input = new EdgeMergeInputData(); private static final int A1_EDGECHANGE_NB = 19; - private static final int A1_ASSOCHANGE_NB = 14; + private static final int A1_ASSOCHANGE_NB = 18; private static final int A1_DIFFS_NB = A1_EDGECHANGE_NB + A1_ASSOCHANGE_NB; private static final int A2_EDGECHANGE_NB = 19; private static final int A2_NODECHANGE_NB = 26; - private static final int A2_ASSOCHANGE_NB = 14; + private static final int A2_ASSOCHANGE_NB = 18; private static final int A2_CLASSCHANGE_NB = 1; private static final int A2_DIFFS_NB = A2_EDGECHANGE_NB + A2_NODECHANGE_NB + A2_ASSOCHANGE_NB + A2_CLASSCHANGE_NB; @@ -107,7 +110,7 @@ public class EdgeMergeTest extends AbstractTest { private static final int A6_SUBSTITUTION_CHANGE1_NB = 6; private static final int A6_IREAL_CHANGE1_NB = 6; private static final int A6_DEPENDENCY_CHANGES_NB = 8 * A6_DEPENDENCY_CHANGE1_NB + 2 * A6_SUBSTITUTION_CHANGE1_NB + A6_IREAL_CHANGE1_NB; - private static final int A6_ASSO_CHANGE1_NB = 14; + private static final int A6_ASSO_CHANGE1_NB = 18; private static final int A6_ASSO_CHANGES_NB = 2 * A6_ASSO_CHANGE1_NB; private static final int A6_IMPORT_CHANGE1_NB = 3; private static final int A6_IMPORT_CHANGES_NB = 2 * A6_IMPORT_CHANGE1_NB; @@ -1739,5 +1742,17 @@ public class EdgeMergeTest extends AbstractTest { protected DiagramInputData getInput() { return input; } - + + @Override + protected void registerPostProcessors() { + super.registerPostProcessors(); + getPostProcessorRegistry() + .put(MultiplicityElementChangePostProcessor.class.getName(), + new TestPostProcessor.TestPostProcessorDescriptor( + Pattern.compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), + null, + new MultiplicityElementChangePostProcessor(), + 25)); + } + } diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/NodeMergeTest.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/NodeMergeTest.java index 03365c541..9169f7800 100644 --- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/NodeMergeTest.java +++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/merge/NodeMergeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 Obeo and others. + * Copyright (c) 2013, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * Obeo - initial API and implementation * Philip Langer - bug 482404 + * Alexandra Buzila - Bug 479449 *******************************************************************************/ package org.eclipse.emf.compare.diagram.papyrus.tests.merge; @@ -23,6 +24,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import java.io.IOException; +import java.util.regex.Pattern; import org.eclipse.emf.common.util.BasicMonitor; import org.eclipse.emf.compare.AttributeChange; @@ -38,7 +40,9 @@ import org.eclipse.emf.compare.diagram.internal.extensions.NodeChange; import org.eclipse.emf.compare.diagram.papyrus.tests.AbstractTest; import org.eclipse.emf.compare.diagram.papyrus.tests.DiagramInputData; import org.eclipse.emf.compare.diagram.papyrus.tests.merge.data.NodeMergeInputData; +import org.eclipse.emf.compare.tests.postprocess.data.TestPostProcessor; import org.eclipse.emf.compare.uml2.internal.AssociationChange; +import org.eclipse.emf.compare.uml2.internal.postprocessor.MultiplicityElementChangePostProcessor; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.uml2.uml.UMLPackage; @@ -68,7 +72,7 @@ public class NodeMergeTest extends AbstractTest { private static final int A1_ELTCHANGES_NB = 8 * A1_ELTCHANGE1_NB; - private static final int A1_ASSOCHANGE1_NB = 14; + private static final int A1_ASSOCHANGE1_NB = 18; private static final int A1_ASSOCHANGES_NB = 3 * A1_ASSOCHANGE1_NB; @@ -1509,4 +1513,16 @@ public class NodeMergeTest extends AbstractTest { }; } + @Override + protected void registerPostProcessors() { + super.registerPostProcessors(); + getPostProcessorRegistry() + .put(MultiplicityElementChangePostProcessor.class.getName(), + new TestPostProcessor.TestPostProcessorDescriptor( + Pattern.compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), + null, + new MultiplicityElementChangePostProcessor(), + 25)); + } + } diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2.edit/META-INF/MANIFEST.MF index 34d915077..d917dcba7 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.uml2.edit/META-INF/MANIFEST.MF @@ -2,22 +2,22 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.compare.uml2.edit;singleton:=true -Bundle-Version: 2.4.0.qualifier +Bundle-Version: 2.5.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.emf.compare.uml2.internal.provider.UMLCompareEditPlugin$Implementation Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.core.runtime, - org.eclipse.emf.compare.uml2;visibility:=reexport, + org.eclipse.emf.compare.uml2;bundle-version="2.5.0";visibility:=reexport, org.eclipse.emf.edit;visibility:=reexport, org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.emf.ecore.edit;visibility:=reexport, - org.eclipse.uml2.uml;bundle-version="5.0.0", - org.eclipse.emf.compare, - org.eclipse.uml2.uml.edit;bundle-version="5.0.0", - org.eclipse.uml2.types, - org.eclipse.emf.compare.edit + org.eclipse.uml2.uml;bundle-version="5.0.0";visibility:=reexport, + org.eclipse.emf.compare;bundle-version="3.4.0";visibility:=reexport, + org.eclipse.uml2.uml.edit;bundle-version="5.0.0";visibility:=reexport, + org.eclipse.uml2.types;visibility:=reexport, + org.eclipse.emf.compare.edit;bundle-version="4.2.0";visibility:=reexport Bundle-ActivationPolicy: lazy Import-Package: com.google.common.base;version="[11.0.0,16.0.0)", com.google.common.collect;version="[11.0.0,16.0.0)", diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/MultiplicityElementChange.gif b/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/MultiplicityElementChange.gif Binary files differnew file mode 100644 index 000000000..98b351f1c --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/MultiplicityElementChange.gif diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/MultiplicityReferenceChange.gif b/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/MultiplicityReferenceChange.gif Binary files differnew file mode 100644 index 000000000..1e5345fb3 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/MultiplicityReferenceChange.gif diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties b/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties index 6270b66ba..ff5fe7a53 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties +++ b/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties @@ -166,7 +166,9 @@ _UI_StereotypedElementChange_type = Stereotyped Element Change _UI_StereotypedElementChange_stereotypeApplications_feature = Stereotype Applications _UI_OpaqueElementBodyChange_type = Opaque Element Body Change _UI_OpaqueElementBodyChange_language_feature = Language +_UI_DanglingStereotypeApplication_type = Dangling Stereotype Application +_UI_MultiplicityReferenceChange_type = Multiplicity Reference Change -#Error messaged +#Error messages Unable_To_Retreive_Icon_Error_Message = "Unable to retrieve the icon at location {0} -_UI_DanglingStereotypeApplication_type = Dangling Stereotype Application +_UI_MultiplicityElementChange_type = Multiplicity Element Change diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/pom.xml b/plugins/org.eclipse.emf.compare.uml2.edit/pom.xml index c67ead258..efbaa1c29 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/pom.xml +++ b/plugins/org.eclipse.emf.compare.uml2.edit/pom.xml @@ -10,6 +10,6 @@ </parent> <groupId>org.eclipse.emf.compare</groupId> <artifactId>org.eclipse.emf.compare.uml2.edit</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.5.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/MultiplicityElementChangeItemProvider.java b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/MultiplicityElementChangeItemProvider.java new file mode 100644 index 000000000..684a9b634 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/MultiplicityElementChangeItemProvider.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + */ +package org.eclipse.emf.compare.uml2.internal.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.compare.DifferenceKind; + +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; + +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class MultiplicityElementChangeItemProvider extends UMLDiffItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MultiplicityElementChangeItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This returns MultiplicityElementChange.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/MultiplicityElementChange")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) { + DifferenceKind labelValue = ((MultiplicityElementChange)object).getKind(); + String label = labelValue == null ? null : labelValue.toString(); + return label == null || label.length() == 0 ? getString("_UI_MultiplicityElementChange_type") : //$NON-NLS-1$ + getString("_UI_MultiplicityElementChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java index 24e9feecc..fa29b773d 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java @@ -261,6 +261,29 @@ public class UMLCompareItemProviderAdapterFactory extends UMLCompareAdapterFacto } /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MultiplicityElementChangeItemProvider multiplicityElementChangeItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createMultiplicityElementChangeAdapter() { + if (multiplicityElementChangeItemProvider == null) { + multiplicityElementChangeItemProvider = new MultiplicityElementChangeItemProvider(this); + } + + return multiplicityElementChangeItemProvider; + } + + /** * This returns the root adapter factory that contains this factory. * <!-- begin-user-doc --> <!-- * end-user-doc --> diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/MultiplicityElementCustomItemProvider.java b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/MultiplicityElementCustomItemProvider.java new file mode 100644 index 000000000..bbc183ce2 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/MultiplicityElementCustomItemProvider.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.internal.provider.custom; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.compare.DifferenceKind; +import org.eclipse.emf.compare.provider.ExtendedAdapterFactoryItemDelegator; +import org.eclipse.emf.compare.provider.utils.ComposedStyledString; +import org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString; +import org.eclipse.emf.compare.provider.utils.IStyledString.Style; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.ecore.EObject; + +/** + * Custom {@link UMLDiffCustomItemProvider} for {@link MultiplicityElementChange MultiplicityElementChanges} + * that handles {@link org.eclipse.emf.compare.provider.IItemStyledLabelProvider} . + * + * @author Alexandra Buzila + */ +public class MultiplicityElementCustomItemProvider extends UMLDiffCustomItemProvider { + + /** Item delegator that reuses the root adapter factory (if any). */ + private ExtendedAdapterFactoryItemDelegator itemDelegator; + + /** + * Constructs a new instance of the item provider. + * + * @param adapterFactory + * the adapter factory to use. + */ + public MultiplicityElementCustomItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + itemDelegator = new ExtendedAdapterFactoryItemDelegator(getRootAdapterFactory()); + } + + @Override + public IComposedStyledString getStyledText(Object object) { + MultiplicityElementChange diff = (MultiplicityElementChange)object; + IComposedStyledString styledText = new ComposedStyledString(getInternalText(diff)); + String changedFeature = getChangedFeatureText(diff); + styledText.append(" [" + changedFeature, Style.DECORATIONS_STYLER); //$NON-NLS-1$ + switch (diff.getKind()) { + case ADD: + styledText.append(" add", Style.DECORATIONS_STYLER); //$NON-NLS-1$ + break; + case DELETE: + styledText.append(" delete", Style.DECORATIONS_STYLER); //$NON-NLS-1$ + break; + case CHANGE: + styledText.append(" change", Style.DECORATIONS_STYLER); //$NON-NLS-1$ + break; + default: + throw new IllegalStateException("Unsupported " + DifferenceKind.class.getSimpleName() //$NON-NLS-1$ + + " value: " + diff.getKind()); //$NON-NLS-1$ + } + styledText.append("]", Style.DECORATIONS_STYLER); //$NON-NLS-1$ + return styledText; + + } + + /** + * Provides the name of the MultiplicityElement's structural feature affected by this diff. This will be + * either the <code>lowerValue</code> or <code>upperValue</code>. + * + * @param diff + * the {@link MultiplicityElementChange} + * @return the name of the feature + */ + private String getChangedFeatureText(MultiplicityElementChange diff) { + return diff.getDiscriminant().eContainmentFeature().getName(); + } + + /** + * Provides the default label of the given diff. + * + * @param diff + * the {@link MultiplicityElementChange} for which the label is returned + * @return the label + */ + private String getInternalText(MultiplicityElementChange diff) { + EObject discriminant = diff.getDiscriminant(); + String text = itemDelegator.getText(discriminant); + if (text == null) { + text = "<null>"; //$NON-NLS-1$ + } + return text; + } +} diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java index 8238ba659..db59d5d72 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2012, 2015 Obeo and others. + * Copyright (c) 2012, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * Obeo - initial API and implementation * Philip Langer - added OpaqueElementBodyChange adapter + * Alexandra Buzila - MultiplicityElementChange adapter */ package org.eclipse.emf.compare.uml2.internal.provider.custom; @@ -128,6 +129,11 @@ public class UMLCompareCustomItemProviderAdapterFactory extends UMLCompareAdapte return new DanglingStereotypeApplicationCustomItemProvider(this); } + @Override + public Adapter createMultiplicityElementChangeAdapter() { + return new MultiplicityElementCustomItemProvider(this); + } + /** * {@inheritDoc} * diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF index 46ddd4656..714f308ed 100644 --- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.compare.uml2.rcp.ui;singleton:=true -Bundle-Version: 2.4.0.qualifier +Bundle-Version: 2.5.0.qualifier Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.emf.edit.ui;bundle-version="2.5.0", - org.eclipse.emf.compare.uml2.edit;bundle-version="2.0.1", - org.eclipse.emf.compare;bundle-version="2.0.1", + org.eclipse.emf.compare.uml2.edit;bundle-version="2.5.0", + org.eclipse.emf.compare;bundle-version="3.4.0", org.eclipse.swt;bundle-version="3.5.0", - org.eclipse.emf.compare.rcp.ui;bundle-version="2.0.1", + org.eclipse.emf.compare.rcp.ui;bundle-version="4.3.0", org.eclipse.core.runtime;bundle-version="3.5.0", org.eclipse.uml2.uml;bundle-version="5.0.0", org.eclipse.emf.compare.edit;bundle-version="3.0.0" diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml index 0705d28a3..3cad92600 100644 --- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml @@ -35,6 +35,10 @@ class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.UMLDanglingStereotypeApplicationAccessorFactory" ranking="25"> </factory> + <factory + class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.MultiplicityElementAttributeChangeAccessorFactory" + ranking="25"> + </factory> </extension> <extension point="org.eclipse.emf.compare.rcp.ui.filters"> diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/pom.xml b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/pom.xml index 1d49393a2..2c6abad95 100644 --- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/pom.xml +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/pom.xml @@ -10,6 +10,6 @@ </parent> <groupId>org.eclipse.emf.compare</groupId> <artifactId>org.eclipse.emf.compare.uml2.rcp.ui</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.5.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/MultiplicityElementAttributeChangeAccessor.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/MultiplicityElementAttributeChangeAccessor.java new file mode 100644 index 000000000..07b44dfc3 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/MultiplicityElementAttributeChangeAccessor.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.compare.AttributeChange; +import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.Match; +import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.SingleStructuralFeatureAccessorImpl; +import org.eclipse.emf.compare.rcp.ui.internal.util.MergeViewerUtil; +import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.utils.ReferenceUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; + +/** + * Change accessor for {@link MultiplicityElementChange MultiplicityElementChanges} whose prime refining is an + * {@link AttributeChange}. + * + * @author Alexandra Buzila + */ +@SuppressWarnings("restriction") +public class MultiplicityElementAttributeChangeAccessor extends SingleStructuralFeatureAccessorImpl { + + /** + * A specific {@link SingleStructuralFeatureAccessorImpl} for {@link MultiplicityElementChange + * MultiplicityElementChanges}. + * + * @param adapterFactory + * the adapter factory used to create the accessor + * @param diff + * the diff associated with this accessor + * @param side + * the side of the accessor + */ + public MultiplicityElementAttributeChangeAccessor(AdapterFactory adapterFactory, Diff diff, + MergeViewerSide side) { + super(adapterFactory, diff, side); + } + + @Override + protected EStructuralFeature getAffectedFeature(Diff diff) { + Diff primeRefining = diff.getPrimeRefining(); + return MergeViewerUtil.getAffectedFeature(primeRefining); + } + + @Override + public EObject getEObject(MergeViewerSide side) { + Match match = getInitialDiff().getMatch(); + EObject multiplicityElement = MergeViewerUtil.getEObject(match, side); + if (multiplicityElement == null) { + return null; + } + MultiplicityElementChange change = (MultiplicityElementChange)getInitialDiff(); + // the lowerValue/upperValue feature affected by the diff + EReference multiplicityElementFeature = change.getDiscriminant().eContainmentFeature(); + return (EObject)ReferenceUtil.safeEGet(multiplicityElement, multiplicityElementFeature); + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/MultiplicityElementAttributeChangeAccessorFactory.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/MultiplicityElementAttributeChangeAccessorFactory.java new file mode 100644 index 000000000..873cacb09 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/MultiplicityElementAttributeChangeAccessorFactory.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.compare.AttributeChange; +import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement; +import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory.impl.AbstractAccessorFactory; +import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.MultiplicityElementAttributeChangeAccessor; + +/** + * Custom {@link AbstractAccessorFactory} for {@link MultiplicityElementChange} elements. + * + * @author Alexandra Buzila + */ +@SuppressWarnings("restriction") +public class MultiplicityElementAttributeChangeAccessorFactory extends AbstractAccessorFactory { + + /** + * {@inheritDoc} + */ + public boolean isFactoryFor(Object target) { + return target instanceof MultiplicityElementChange && ((MultiplicityElementChange)target) + .getPrimeRefining() instanceof AttributeChange; + } + + /** + * {@inheritDoc} + */ + public ITypedElement createAncestor(AdapterFactory adapterFactory, Object target) { + return new MultiplicityElementAttributeChangeAccessor(adapterFactory, (Diff)target, + MergeViewerSide.ANCESTOR); + } + + /** + * {@inheritDoc} + */ + public ITypedElement createLeft(AdapterFactory adapterFactory, Object target) { + return new MultiplicityElementAttributeChangeAccessor(adapterFactory, (Diff)target, + MergeViewerSide.LEFT); + } + + /** + * {@inheritDoc} + */ + public ITypedElement createRight(AdapterFactory adapterFactory, Object target) { + return new MultiplicityElementAttributeChangeAccessor(adapterFactory, (Diff)target, + MergeViewerSide.RIGHT); + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF index 61b3200bf..4ece10f39 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.compare.uml2.tests;singleton:=true -Bundle-Version: 2.4.0.qualifier +Bundle-Version: 2.5.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml b/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml index 93d597e19..01ef916f0 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml +++ b/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>org.eclipse.emf.compare</groupId> <artifactId>org.eclipse.emf.compare.uml2.tests</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.5.0-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <build> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java index 3fb9e82b0..96c07f7b5 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Obeo. + * Copyright (c) 2012, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,11 +29,16 @@ import com.google.common.collect.Iterators; import java.io.IOException; import java.util.List; +import java.util.regex.Pattern; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.Diff; import org.eclipse.emf.compare.DifferenceKind; +import org.eclipse.emf.compare.postprocessor.IPostProcessor.Descriptor.Registry; +import org.eclipse.emf.compare.tests.postprocess.data.TestPostProcessor; import org.eclipse.emf.compare.uml2.internal.AssociationChange; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.uml2.internal.postprocessor.MultiplicityElementChangePostProcessor; import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData; import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest; import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData; @@ -159,7 +164,7 @@ public class AddAssociation2Test extends AbstractUMLTest { private void testAB1(TestKind kind, final Comparison comparison) { final List<Diff> differences = comparison.getDifferences(); - assertEquals(14, differences.size()); + assertEquals(18, differences.size()); Predicate<? super Diff> addAssociationDescription = null; Predicate<? super Diff> addPropertyClass1Description = null; @@ -281,10 +286,20 @@ public class AddAssociation2Test extends AbstractUMLTest { assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1)); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass0)); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass0)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass0)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass0)); + + // MultiplicityElementChanges + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addLiteralIntegerInClass1.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addUnlimitedNaturalInClass1.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addLiteralIntegerInClass0.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addUnlimitedNaturalInClass0.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); // CHECK REQUIREMENT if (kind.equals(TestKind.ADD)) { @@ -353,7 +368,6 @@ public class AddAssociation2Test extends AbstractUMLTest { assertTrue(addAssociation.getRequires().contains(addPropertyClass1InAssociation)); assertEquals(0, addUMLAssociation.getRequires().size()); - assertEquals(0, addLiteralIntegerInClass1.getRequires().size()); assertEquals(0, addUnlimitedNaturalInClass1.getRequires().size()); assertEquals(0, addLiteralIntegerInClass0.getRequires().size()); @@ -389,4 +403,13 @@ public class AddAssociation2Test extends AbstractUMLTest { return input; } + @Override + protected void registerPostProcessors(Registry<String> postProcessorRegistry) { + super.registerPostProcessors(postProcessorRegistry); + postProcessorRegistry.put(MultiplicityElementChangePostProcessor.class.getName(), + new TestPostProcessor.TestPostProcessorDescriptor(Pattern + .compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), null, + new MultiplicityElementChangePostProcessor(), 25)); + } + } diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java index 0ce97f232..b54f65296 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Obeo. + * Copyright (c) 2012, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,11 +29,16 @@ import com.google.common.collect.Iterators; import java.io.IOException; import java.util.List; +import java.util.regex.Pattern; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.Diff; import org.eclipse.emf.compare.DifferenceKind; +import org.eclipse.emf.compare.postprocessor.IPostProcessor.Descriptor.Registry; +import org.eclipse.emf.compare.tests.postprocess.data.TestPostProcessor; import org.eclipse.emf.compare.uml2.internal.AssociationChange; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.uml2.internal.postprocessor.MultiplicityElementChangePostProcessor; import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData; import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest; import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData; @@ -160,7 +165,7 @@ public class AddAssociation3Test extends AbstractUMLTest { private void testAB1(TestKind kind, final Comparison comparison) { final List<Diff> differences = comparison.getDifferences(); - assertEquals(14, differences.size()); + assertEquals(18, differences.size()); Predicate<? super Diff> addAssociationDescription = null; Predicate<? super Diff> addPropertyClass1Description = null; @@ -274,12 +279,8 @@ public class AddAssociation3Test extends AbstractUMLTest { assertNotNull(addUMLAssociation); assertEquals(13, addUMLAssociation.getRefinedBy().size()); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1)); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1)); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass0)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass0)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass0)); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass0)); assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation)); assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0)); @@ -287,6 +288,20 @@ public class AddAssociation3Test extends AbstractUMLTest { assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1InAssociation)); assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0InAssociation)); + // MultiplicityElementChanges + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addLiteralIntegerInClass1.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addUnlimitedNaturalInClass1.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addLiteralIntegerInClass0.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addUnlimitedNaturalInClass0.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + // CHECK REQUIREMENT if (kind.equals(TestKind.ADD)) { assertEquals(1, addPropertyClass0.getRequires().size()); @@ -354,7 +369,6 @@ public class AddAssociation3Test extends AbstractUMLTest { assertTrue(addAssociation.getRequires().contains(addPropertyClass0InAssociation)); assertEquals(0, addUMLAssociation.getRequires().size()); - assertEquals(0, addLiteralIntegerInClass1.getRequires().size()); assertEquals(0, addUnlimitedNaturalInClass1.getRequires().size()); assertEquals(0, addLiteralIntegerInClass0.getRequires().size()); @@ -388,4 +402,13 @@ public class AddAssociation3Test extends AbstractUMLTest { protected AbstractUMLInputData getInput() { return input; } + + @Override + protected void registerPostProcessors(Registry<String> postProcessorRegistry) { + super.registerPostProcessors(postProcessorRegistry); + postProcessorRegistry.put(MultiplicityElementChangePostProcessor.class.getName(), + new TestPostProcessor.TestPostProcessorDescriptor(Pattern + .compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), null, + new MultiplicityElementChangePostProcessor(), 25)); + } } diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java index ec43a5d68..504faee99 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Obeo. + * Copyright (c) 2012, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,11 +29,16 @@ import com.google.common.collect.Iterators; import java.io.IOException; import java.util.List; +import java.util.regex.Pattern; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.Diff; import org.eclipse.emf.compare.DifferenceKind; +import org.eclipse.emf.compare.postprocessor.IPostProcessor.Descriptor.Registry; +import org.eclipse.emf.compare.tests.postprocess.data.TestPostProcessor; import org.eclipse.emf.compare.uml2.internal.AssociationChange; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.uml2.internal.postprocessor.MultiplicityElementChangePostProcessor; import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData; import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest; import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData; @@ -160,8 +165,8 @@ public class AddAssociationTest extends AbstractUMLTest { private void testAB1(TestKind kind, final Comparison comparison) { final List<Diff> differences = comparison.getDifferences(); - // We should have no less and no more than 16 differences - assertEquals(16, differences.size()); + // We should have no less and no more than 20 differences + assertEquals(20, differences.size()); Predicate<? super Diff> addAssociationDescription = null; Predicate<? super Diff> addNavigableOwnedEndClass1InAssociationDescription = null; @@ -298,14 +303,23 @@ public class AddAssociationTest extends AbstractUMLTest { assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1)); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass2)); assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass2)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass2)); - assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass2)); assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass1InAssociation)); assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass2InAssociation)); assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass1InAssociation)); assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass2InAssociation)); + // MultiplicityElementChanges + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addLiteralIntegerInClass1.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addUnlimitedNaturalInClass1.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addLiteralIntegerInClass2.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); + assertTrue(addUMLAssociation.getRefinedBy().contains( + Iterators.find(addUnlimitedNaturalInClass2.getRefines().iterator(), + instanceOf(MultiplicityElementChange.class)))); // CHECK REQUIREMENT if (kind.equals(TestKind.ADD)) { @@ -370,7 +384,6 @@ public class AddAssociationTest extends AbstractUMLTest { assertTrue(addAssociation.getRequires().contains(addMemberEndClass2InAssociation)); assertEquals(0, addUMLAssociation.getRequires().size()); - assertEquals(0, addLiteralIntegerInClass1.getRequires().size()); assertEquals(0, addUnlimitedNaturalInClass1.getRequires().size()); assertEquals(0, addLiteralIntegerInClass2.getRequires().size()); @@ -400,4 +413,13 @@ public class AddAssociationTest extends AbstractUMLTest { protected AbstractUMLInputData getInput() { return input; } + + @Override + protected void registerPostProcessors(Registry<String> postProcessorRegistry) { + super.registerPostProcessors(postProcessorRegistry); + postProcessorRegistry.put(MultiplicityElementChangePostProcessor.class.getName(), + new TestPostProcessor.TestPostProcessorDescriptor(Pattern + .compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), null, + new MultiplicityElementChangePostProcessor(), 25)); + } } diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java index 705e07ed3..c638cd3a3 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Obeo. + * Copyright (c) 2012, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -159,8 +159,8 @@ public class ChangeAssociationTest extends AbstractUMLTest { private void testAB1(TestKind kind, final Comparison comparison) { final List<Diff> differences = comparison.getDifferences(); - // We should have no less and no more than 5 differences - assertEquals(6, differences.size()); + // We should have no less and no more than 7 differences + assertEquals(8, differences.size()); Predicate<? super Diff> addPropertyClass2Description = null; Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null; diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java index 603fdeba3..09be485d8 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Obeo. + * Copyright (c) 2012, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,6 +35,7 @@ import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.Diff; import org.eclipse.emf.compare.DifferenceKind; import org.eclipse.emf.compare.uml2.internal.AssociationChange; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData; import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest; import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData; @@ -46,7 +47,8 @@ import org.junit.Test; @SuppressWarnings("nls") public class ImplicationsAssociationTest extends AbstractUMLTest { - private static final int NB_DIFFS = 16; + // 16 diffs of interest and 4 MultiplicityElementChanges + private static final int NB_DIFFS = 20; private ImplicationsInputData input = new ImplicationsInputData(); @@ -265,7 +267,8 @@ public class ImplicationsAssociationTest extends AbstractUMLTest { } private void checkMergeDeleteNavigableOwnedEnd(Comparison comparison, DiffsOfInterest diffs) { - assertEquals(NB_DIFFS - 7, comparison.getDifferences().size()); + // 7 diffs of interest + 2 MultiplicityElementChanges + assertEquals(NB_DIFFS - 9, comparison.getDifferences().size()); assertNull(diffs.addNavigableOwnedEndClass1InAssociation); assertNull(diffs.addOwnedEndClass1InAssociation); assertNull(diffs.addMemberEndClass1InAssociation); @@ -343,7 +346,8 @@ public class ImplicationsAssociationTest extends AbstractUMLTest { } private void checkMergeDeleteOwnedEnd(Comparison comparison, DiffsOfInterest diffs) { - assertEquals(NB_DIFFS - 7, comparison.getDifferences().size()); + // 7 diffs of interest+ 2 MultiplicityElementChanges + assertEquals(NB_DIFFS - 9, comparison.getDifferences().size()); assertNull(diffs.addOwnedEndClass1InAssociation); assertNull(diffs.addMemberEndClass1InAssociation); assertNull(diffs.addRefAssociationInPropertyClass1); @@ -1018,19 +1022,32 @@ public class ImplicationsAssociationTest extends AbstractUMLTest { } private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) { - return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue")); + return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"), + refinesMultiplicityElementChange()); } private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) { - return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue")); + return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"), + refinesMultiplicityElementChange()); } private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) { - return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue")); + return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"), + refinesMultiplicityElementChange()); } private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) { - return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue")); + return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"), + refinesMultiplicityElementChange()); + } + + private static Predicate<? super Diff> refinesMultiplicityElementChange() { + return new Predicate<Diff>() { + public boolean apply(Diff input) { + return Iterators.any(input.getRefines().iterator(), instanceOf( + MultiplicityElementChange.class)); + } + }; } private class DiffsOfInterest { diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/MultiplicityElementChangesTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/MultiplicityElementChangesTest.java new file mode 100644 index 000000000..fd13628fd --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/MultiplicityElementChangesTest.java @@ -0,0 +1,600 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.tests.multiplicitychanges; + +import static com.google.common.base.Predicates.and; +import static com.google.common.collect.Iterables.filter; +import static com.google.common.collect.Iterables.size; +import static org.eclipse.emf.compare.DifferenceSource.LEFT; +import static org.eclipse.emf.compare.DifferenceSource.RIGHT; +import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import com.google.common.base.Predicate; +import com.google.common.collect.Lists; + +import java.io.IOException; +import java.util.ArrayList; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.compare.AttributeChange; +import org.eclipse.emf.compare.Comparison; +import org.eclipse.emf.compare.Conflict; +import org.eclipse.emf.compare.ConflictKind; +import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.DifferenceKind; +import org.eclipse.emf.compare.ReferenceChange; +import org.eclipse.emf.compare.ide.ui.tests.framework.ResolutionStrategyID; +import org.eclipse.emf.compare.ide.ui.tests.framework.RuntimeTestRunner; +import org.eclipse.emf.compare.ide.ui.tests.framework.annotations.Compare; +import org.eclipse.emf.compare.ide.ui.tests.framework.annotations.ResolutionStrategies; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.utils.MatchUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.uml2.uml.LiteralInteger; +import org.eclipse.uml2.uml.LiteralUnlimitedNatural; +import org.eclipse.uml2.uml.UMLPackage; +import org.junit.runner.RunWith; + +@RunWith(RuntimeTestRunner.class) +@ResolutionStrategies(ResolutionStrategyID.PROJECT) +public class MultiplicityElementChangesTest { + + private static final Predicate<Diff> IS_MULTIPLICITY_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return diff instanceof MultiplicityElementChange; + } + }; + + private static final Predicate<Diff> IS_LOWER_VALUE_REFERENCE_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + if (!(diff instanceof ReferenceChange)) { + return false; + } + ReferenceChange refChange = (ReferenceChange)diff; + return refChange.getReference() == UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue(); + } + }; + + private static final Predicate<Diff> IS_LOWER_VALUE_ATTRIBUTE_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + if (!(diff instanceof AttributeChange)) { + return false; + } + EObject container = MatchUtil.getContainer(diff.getMatch().getComparison(), diff); + if (container instanceof LiteralInteger || container instanceof LiteralUnlimitedNatural) { + EStructuralFeature eContainingFeature = container.eContainingFeature(); + return eContainingFeature == UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue(); + } + return false; + } + }; + + private static final Predicate<Diff> IS_UPPER_VALUE_REFERENCE_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + if (!(diff instanceof ReferenceChange)) { + return false; + } + ReferenceChange refChange = (ReferenceChange)diff; + return refChange.getReference() == UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue(); + } + }; + + private static final Predicate<Diff> IS_UPPER_VALUE_ATTRIBUTE_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + if (!(diff instanceof AttributeChange)) { + return false; + } + EObject container = MatchUtil.getContainer(diff.getMatch().getComparison(), diff); + if (container instanceof LiteralInteger || container instanceof LiteralUnlimitedNatural) { + EStructuralFeature eContainingFeature = container.eContainingFeature(); + return eContainingFeature == UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue(); + } + return false; + } + }; + + private static final Predicate<Diff> IS_UPPER_VALUE_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return IS_UPPER_VALUE_REFERENCE_CHANGE.apply(diff) || IS_UPPER_VALUE_ATTRIBUTE_CHANGE.apply(diff); + } + }; + + private static final Predicate<Diff> IS_LOWER_VALUE_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return IS_LOWER_VALUE_REFERENCE_CHANGE.apply(diff) || IS_LOWER_VALUE_ATTRIBUTE_CHANGE.apply(diff); + } + }; + + /** + * <b>origin:</b> an activity with an input pin <br> + * <b>left:</b> multiplicity lower value is added to the input pin <br> + * <b>right:</b> multiplicity upper value is added to the input pin + */ + @Compare(left = "a1/left.uml", right = "a1/right.uml", ancestor = "a1/origin.uml") + public void testNonConflictingAddition(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + Iterable<Diff> leftChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(LEFT))); + Iterable<Diff> rightChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(RIGHT))); + + assertEquals(1, size(leftChanges)); + assertEquals(1, size(rightChanges)); + + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.iterator().next(); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, leftChange.getKind()); + + MultiplicityElementChange rightChange = (MultiplicityElementChange)rightChanges.iterator().next(); + assertEquals(1, rightChange.getRefinedBy().size()); + assertTrue(rightChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange.getKind()); + + assertEquals(0, comparison.getConflicts().size()); + } + + /** + * <b>origin:</b> an activity with an input pin <br> + * <b>left:</b> multiplicity lower value is added to the input pin <br> + * <b>right:</b> multiplicity lower and upper values are added to the input pin, but the lower value is + * the same value as in the left change + */ + @Compare(left = "a2/left.uml", right = "a2/right.uml", ancestor = "a2/origin.uml") + public void testAdditionsWithPseudoconflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + ArrayList<Diff> leftChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(LEFT)))); + ArrayList<Diff> rightChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(RIGHT)))); + + assertEquals(1, size(leftChanges)); + assertEquals(2, size(rightChanges)); + + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.get(0); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, leftChange.getKind()); + + MultiplicityElementChange rightChange1 = (MultiplicityElementChange)rightChanges.get(0); + assertEquals(1, rightChange1.getRefinedBy().size()); + assertTrue(rightChange1.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange1.getKind()); + + MultiplicityElementChange rightChange2 = (MultiplicityElementChange)rightChanges.get(1); + assertEquals(1, rightChange2.getRefinedBy().size()); + assertTrue(rightChange2.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange2.getKind()); + + assertEquals(1, comparison.getConflicts().size()); + Conflict conflict = comparison.getConflicts().get(0); + assertEquals(ConflictKind.PSEUDO, conflict.getKind()); + assertTrue(conflict.getDifferences().contains(leftChange)); + + if (isLowerValueChange(rightChange1)) { + assertEquals(conflict, rightChange1.getConflict()); + } else { + assertTrue(isLowerValueChange(rightChange2)); + assertEquals(conflict, rightChange2.getConflict()); + } + } + + /** + * <b>origin:</b> an activity with an input pin <br> + * <b>left:</b> multiplicity lower value is added to the input pin <br> + * <b>right:</b> multiplicity lower and upper values are added to the input pin, but the lower value is + * different than the one in the left change + */ + @Compare(left = "a3/left.uml", right = "a3/right.uml", ancestor = "a3/origin.uml") + public void testAdditionsWithConflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + ArrayList<Diff> leftChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(LEFT)))); + ArrayList<Diff> rightChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(RIGHT)))); + + assertEquals(1, size(leftChanges)); + assertEquals(2, size(rightChanges)); + + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.get(0); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, leftChange.getKind()); + + MultiplicityElementChange rightChange1 = (MultiplicityElementChange)rightChanges.get(0); + assertEquals(1, rightChange1.getRefinedBy().size()); + assertTrue(rightChange1.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange1.getKind()); + + MultiplicityElementChange rightChange2 = (MultiplicityElementChange)rightChanges.get(1); + assertEquals(1, rightChange2.getRefinedBy().size()); + assertTrue(rightChange2.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange2.getKind()); + + assertEquals(1, comparison.getConflicts().size()); + Conflict conflict = comparison.getConflicts().get(0); + assertEquals(ConflictKind.REAL, conflict.getKind()); + + if (isLowerValueChange(rightChange1)) { + assertEquals(conflict, rightChange1.getConflict()); + } else { + assertTrue(isLowerValueChange(rightChange2)); + assertEquals(conflict, rightChange2.getConflict()); + } + } + + /** + * <b>origin:</b> an activity with an input pin, with a lower and upper value <br> + * <b>left:</b> multiplicity lower value is changed to 1 <br> + * <b>right:</b> multiplicity lower value is changed to 2 <br> + * A real conflict should be produced. + */ + @Compare(left = "a4/left.uml", right = "a4/right.uml", ancestor = "a4/origin.uml") + public void testChangesWithConflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + Iterable<Diff> leftChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(LEFT))); + Iterable<Diff> rightChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(RIGHT))); + + assertEquals(1, size(leftChanges)); + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.iterator().next(); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof AttributeChange); + assertEquals(DifferenceKind.CHANGE, leftChange.getKind()); + + assertEquals(1, size(rightChanges)); + MultiplicityElementChange rightChange = (MultiplicityElementChange)rightChanges.iterator().next(); + assertEquals(1, rightChange.getRefinedBy().size()); + assertTrue(rightChange.getRefinedBy().get(0) instanceof AttributeChange); + assertEquals(DifferenceKind.CHANGE, rightChange.getKind()); + + assertEquals(1, comparison.getConflicts().size()); + Conflict conflict = comparison.getConflicts().get(0); + assertEquals(ConflictKind.REAL, conflict.getKind()); + assertEquals(conflict, rightChange.getConflict()); + } + + /** + * <b>origin:</b> an activity with an input pin, with a lower and upper value <br> + * <b>left:</b> multiplicity lower value is changed to 1 <br> + * <b>right:</b> multiplicity lower value is changed to 1 <br> + * A pseudo conflict should be produced. + */ + @Compare(left = "a5/left.uml", right = "a5/right.uml", ancestor = "a5/origin.uml") + public void testChangesWithPseudoconflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + Iterable<Diff> leftChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(LEFT))); + Iterable<Diff> rightChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(RIGHT))); + + assertEquals(1, size(leftChanges)); + Diff leftChange = leftChanges.iterator().next(); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof AttributeChange); + assertEquals(DifferenceKind.CHANGE, leftChange.getKind()); + + assertEquals(1, size(rightChanges)); + Diff rightChange = rightChanges.iterator().next(); + assertEquals(1, rightChange.getRefinedBy().size()); + assertTrue(rightChange.getRefinedBy().get(0) instanceof AttributeChange); + assertEquals(DifferenceKind.CHANGE, rightChange.getKind()); + + assertEquals(1, comparison.getConflicts().size()); + Conflict conflict = comparison.getConflicts().get(0); + assertEquals(ConflictKind.PSEUDO, conflict.getKind()); + assertEquals(conflict, rightChange.getConflict()); + + } + + /** + * <b>origin:</b> an activity with an input pin, with a lower and upper value <br> + * <b>left:</b> multiplicity lower value is changed to 1 <br> + * <b>right:</b> multiplicity lower and upper values are removed <br> + */ + @Compare(left = "a6/left.uml", right = "a6/right.uml", ancestor = "a6/origin.uml") + public void testRemoveConflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + ArrayList<Diff> leftChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(LEFT)))); + ArrayList<Diff> rightChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(RIGHT)))); + + assertEquals(1, size(leftChanges)); + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.iterator().next(); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof AttributeChange); + assertEquals(DifferenceKind.CHANGE, leftChange.getKind()); + + assertEquals(2, size(rightChanges)); + + MultiplicityElementChange rightChange1 = (MultiplicityElementChange)rightChanges.get(0); + assertEquals(1, rightChange1.getRefinedBy().size()); + assertTrue(rightChange1.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.DELETE, rightChange1.getKind()); + + MultiplicityElementChange rightChange2 = (MultiplicityElementChange)rightChanges.get(1); + assertEquals(1, rightChange2.getRefinedBy().size()); + assertTrue(rightChange2.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.DELETE, rightChange2.getKind()); + + assertEquals(1, comparison.getConflicts().size()); + Conflict conflict = comparison.getConflicts().get(0); + assertEquals(ConflictKind.REAL, conflict.getKind()); + + if (isLowerValueChange(rightChange1)) { + assertTrue(isUpperValueChange(rightChange2)); + assertEquals(conflict, rightChange1.getConflict()); + } else { + assertTrue(isUpperValueChange(rightChange1)); + assertTrue(isLowerValueChange(rightChange2)); + assertEquals(conflict, rightChange2.getConflict()); + } + } + + /** + * <b>origin:</b> an activity with an input pin, with a lower and upper value <br> + * <b>left:</b> multiplicity upper value is removed <br> + * <b>right:</b> multiplicity lower value is changed to 1 <br> + */ + @Compare(left = "a7/left.uml", right = "a7/right.uml", ancestor = "a7/origin.uml") + public void testRemoveNoConflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + Iterable<Diff> leftChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(LEFT))); + Iterable<Diff> rightChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(RIGHT))); + + assertEquals(1, size(leftChanges)); + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.iterator().next(); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.DELETE, leftChange.getKind()); + + assertEquals(1, size(rightChanges)); + MultiplicityElementChange rightChange = (MultiplicityElementChange)rightChanges.iterator().next(); + assertEquals(1, rightChange.getRefinedBy().size()); + assertTrue(rightChange.getRefinedBy().get(0) instanceof AttributeChange); + assertEquals(DifferenceKind.CHANGE, rightChange.getKind()); + + assertEquals(0, comparison.getConflicts().size()); + + } + + /** + * <b>origin:</b> an activity with an input pin, with a lower and upper value <br> + * <b>left:</b> multiplicity upper value is removed <br> + * <b>right:</b> multiplicity upper value is removed <br> + */ + @Compare(left = "a8/left.uml", right = "a8/right.uml", ancestor = "a8/origin.uml") + public void testRemovePseudoConflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + Iterable<Diff> leftChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(LEFT))); + Iterable<Diff> rightChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(RIGHT))); + + assertEquals(1, size(leftChanges)); + assertEquals(1, size(rightChanges)); + + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.iterator().next(); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.DELETE, leftChange.getKind()); + + MultiplicityElementChange rightChange = (MultiplicityElementChange)rightChanges.iterator().next(); + assertEquals(1, rightChange.getRefinedBy().size()); + assertTrue(rightChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.DELETE, rightChange.getKind()); + + assertEquals(1, comparison.getConflicts().size()); + Conflict conflict = comparison.getConflicts().get(0); + assertEquals(ConflictKind.PSEUDO, conflict.getKind()); + + } + + /** + * <b>origin:</b> an activity with an input pin, with an upper value <br> + * <b>left:</b> multiplicity upper value is removed <br> + * <b>right:</b> multiplicity lower value is added <br> + */ + @Compare(left = "a9/left.uml", right = "a9/right.uml", ancestor = "a9/origin.uml") + public void testRemoveAndAddNoConflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + Iterable<Diff> leftChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(LEFT))); + Iterable<Diff> rightChanges = filter(diffs, and(IS_MULTIPLICITY_CHANGE, fromSide(RIGHT))); + + assertEquals(1, size(leftChanges)); + assertEquals(1, size(rightChanges)); + + MultiplicityElementChange leftChange = (MultiplicityElementChange)leftChanges.iterator().next(); + assertEquals(1, leftChange.getRefinedBy().size()); + assertTrue(leftChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.DELETE, leftChange.getKind()); + + MultiplicityElementChange rightChange = (MultiplicityElementChange)rightChanges.iterator().next(); + assertEquals(1, rightChange.getRefinedBy().size()); + assertTrue(rightChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange.getKind()); + + assertEquals(0, comparison.getConflicts().size()); + } + + /** + * <b>origin:</b> an activity with an input pin, with an upper value <br> + * <b>left:</b> multiplicity upper (0) and lower (1) value are added<br> + * <b>right:</b> multiplicity upper (1) and lower (1) value are added<br> + * These changes should produce a real and a pseudo conflict for the same multiplicity change + */ + @Compare(left = "a10/left.uml", right = "a10/right.uml", ancestor = "a10/origin.uml") + public void testRealAndPseudoConflict(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + ArrayList<Diff> leftChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(LEFT)))); + ArrayList<Diff> rightChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(RIGHT)))); + + assertEquals(2, size(leftChanges)); + assertEquals(2, size(rightChanges)); + + MultiplicityElementChange leftChange1 = (MultiplicityElementChange)leftChanges.get(0); + assertEquals(1, leftChange1.getRefinedBy().size()); + assertTrue(leftChange1.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, leftChange1.getKind()); + + MultiplicityElementChange leftChange2 = (MultiplicityElementChange)leftChanges.get(1); + assertEquals(1, leftChange2.getRefinedBy().size()); + assertTrue(leftChange2.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, leftChange2.getKind()); + + MultiplicityElementChange rightChange1 = (MultiplicityElementChange)rightChanges.get(0); + assertEquals(1, rightChange1.getRefinedBy().size()); + assertTrue(rightChange1.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange1.getKind()); + + MultiplicityElementChange rightChange2 = (MultiplicityElementChange)rightChanges.get(1); + assertEquals(1, rightChange2.getRefinedBy().size()); + assertTrue(rightChange2.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightChange2.getKind()); + + assertEquals(2, comparison.getConflicts().size()); + Conflict conflict1 = comparison.getConflicts().get(0); + Conflict conflict2 = comparison.getConflicts().get(1); + + if (conflict1.getKind() == ConflictKind.PSEUDO) { + assertEquals(ConflictKind.REAL, conflict2.getKind()); + } else { + assertEquals(ConflictKind.PSEUDO, conflict2.getKind()); + } + + if (isUpperValueChange(leftChange1)) { + assertTrue(isLowerValueChange(leftChange2)); + assertNotNull(leftChange1.getConflict()); + assertEquals(ConflictKind.REAL, leftChange1.getConflict().getKind()); + assertNotNull(leftChange2.getConflict()); + assertEquals(ConflictKind.PSEUDO, leftChange2.getConflict().getKind()); + } else { + assertTrue(isLowerValueChange(leftChange1)); + assertTrue(isUpperValueChange(leftChange2)); + assertNotNull(leftChange1.getConflict()); + assertEquals(ConflictKind.PSEUDO, leftChange1.getConflict().getKind()); + assertNotNull(leftChange2.getConflict()); + assertEquals(ConflictKind.REAL, leftChange2.getConflict().getKind()); + } + + if (isUpperValueChange(rightChange1)) { + assertTrue(isLowerValueChange(rightChange2)); + assertNotNull(rightChange1.getConflict()); + assertEquals(ConflictKind.REAL, rightChange1.getConflict().getKind()); + assertNotNull(rightChange2.getConflict()); + assertEquals(ConflictKind.PSEUDO, rightChange2.getConflict().getKind()); + } else { + assertTrue(isLowerValueChange(rightChange1)); + assertTrue(isUpperValueChange(rightChange2)); + assertNotNull(rightChange1.getConflict()); + assertEquals(ConflictKind.PSEUDO, rightChange1.getConflict().getKind()); + assertNotNull(rightChange2.getConflict()); + assertEquals(ConflictKind.REAL, rightChange2.getConflict().getKind()); + } + + } + + private boolean isLowerValueChange(MultiplicityElementChange multiplicityElementChange) { + if (multiplicityElementChange.getRefinedBy().size() != 1) { + return false; + } + return IS_LOWER_VALUE_CHANGE.apply(multiplicityElementChange.getRefinedBy().get(0)); + } + + private boolean isUpperValueChange(MultiplicityElementChange multiplicityElementChange) { + if (multiplicityElementChange.getRefinedBy().size() != 1) { + return false; + } + return IS_UPPER_VALUE_CHANGE.apply(multiplicityElementChange.getRefinedBy().get(0)); + } + + /** + * <b>origin:</b> an activity with an input pin, with a lower value <br> + * <b>left:</b> multiplicity lower value is deleted and upper value is added (0)<br> + * <b>right:</b> multiplicity upper value is added, with the same value as in the left change and the + * lower value is changed to a different value than the one in the left change<br> + * These changes should produce a real and a pseudo conflict for the same multiplicity change + */ + @Compare(left = "a11/left.uml", right = "a11/right.uml", ancestor = "a11/origin.uml") + public void testRealAndPseudoConflictWithChangeAndDelete(Comparison comparison) throws IOException { + EList<Diff> diffs = comparison.getDifferences(); + ArrayList<Diff> leftChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(LEFT)))); + ArrayList<Diff> rightChanges = Lists.newArrayList(filter(diffs, and(IS_MULTIPLICITY_CHANGE, + fromSide(RIGHT)))); + + assertEquals(2, size(leftChanges)); + assertEquals(2, size(rightChanges)); + + MultiplicityElementChange leftAddChange; + MultiplicityElementChange leftDeleteChange; + + if (leftChanges.get(0).getKind() == DifferenceKind.ADD) { + leftAddChange = (MultiplicityElementChange)leftChanges.get(0); + leftDeleteChange = (MultiplicityElementChange)leftChanges.get(1); + } else { + leftAddChange = (MultiplicityElementChange)leftChanges.get(1); + leftDeleteChange = (MultiplicityElementChange)leftChanges.get(0); + } + + assertEquals(1, leftAddChange.getRefinedBy().size()); + assertTrue(leftAddChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, leftAddChange.getKind()); + + assertEquals(1, leftDeleteChange.getRefinedBy().size()); + assertTrue(leftDeleteChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.DELETE, leftDeleteChange.getKind()); + + MultiplicityElementChange rightChange; + MultiplicityElementChange rightAddChange; + + if (rightChanges.get(0).getKind() == DifferenceKind.ADD) { + rightAddChange = (MultiplicityElementChange)rightChanges.get(0); + rightChange = (MultiplicityElementChange)rightChanges.get(1); + } else { + rightAddChange = (MultiplicityElementChange)rightChanges.get(1); + rightChange = (MultiplicityElementChange)rightChanges.get(0); + } + + assertEquals(1, rightAddChange.getRefinedBy().size()); + assertTrue(rightAddChange.getRefinedBy().get(0) instanceof ReferenceChange); + assertEquals(DifferenceKind.ADD, rightAddChange.getKind()); + + assertEquals(1, rightChange.getRefinedBy().size()); + assertTrue(rightChange.getRefinedBy().get(0) instanceof AttributeChange); + assertEquals(DifferenceKind.CHANGE, rightChange.getKind()); + + assertEquals(2, comparison.getConflicts().size()); + Conflict conflict1 = comparison.getConflicts().get(0); + Conflict conflict2 = comparison.getConflicts().get(1); + + if (conflict1.getKind() == ConflictKind.PSEUDO) { + assertEquals(ConflictKind.REAL, conflict2.getKind()); + } else { + assertEquals(ConflictKind.PSEUDO, conflict2.getKind()); + } + assertEquals(ConflictKind.REAL, leftDeleteChange.getConflict().getKind()); + assertEquals(leftDeleteChange.getConflict(), rightChange.getConflict()); + assertEquals(ConflictKind.PSEUDO, leftAddChange.getConflict().getKind()); + assertEquals(leftAddChange.getConflict(), rightAddChange.getConflict()); + } + + // @Override + // protected void registerPostProcessors( + // org.eclipse.emf.compare.postprocessor.IPostProcessor.Descriptor.Registry<String> postProcessorRegistry) + // { + // super.registerPostProcessors(postProcessorRegistry); + // postProcessorRegistry.put(MultiplicityElementChangePostProcessor.class.getName(), + // new TestPostProcessor.TestPostProcessorDescriptor(Pattern + // .compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), null, //$NON-NLS-1$ + // new MultiplicityElementChangePostProcessor(), 25)); + // } +} diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/left.uml new file mode 100644 index 000000000..8750ba0ac --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/left.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/origin.uml new file mode 100644 index 000000000..530742ca6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/origin.uml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/right.uml new file mode 100644 index 000000000..3de259bc5 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a1/right.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_y4nCEL6MEeWfFPKKpMWCyw" value="2"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/left.uml new file mode 100644 index 000000000..6da8962cd --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/left.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/origin.uml new file mode 100644 index 000000000..530742ca6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/origin.uml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/right.uml new file mode 100644 index 000000000..44a0d8e47 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a10/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_bXa-MWYwEeWdseMo2ly0ug" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_jPlpwGYvEeWdseMo2ly0ug" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/left.uml new file mode 100644 index 000000000..fd39ace1f --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/left.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/origin.uml new file mode 100644 index 000000000..8750ba0ac --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/origin.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/right.uml new file mode 100644 index 000000000..9f1166561 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a11/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="2"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_1234L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/left.uml new file mode 100644 index 000000000..ad48eeefa --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/left.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Fic2AWYwEeWdseMo2ly0ug" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/origin.uml new file mode 100644 index 000000000..530742ca6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/origin.uml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/right.uml new file mode 100644 index 000000000..171c268e6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a2/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="2"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/left.uml new file mode 100644 index 000000000..7e3fc4c56 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/left.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="2"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/origin.uml new file mode 100644 index 000000000..530742ca6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/origin.uml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/right.uml new file mode 100644 index 000000000..7e95aa91d --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a3/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Fic2AWYwEeWdseMo2ly0ug" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/left.uml new file mode 100644 index 000000000..b9fd37539 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/left.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/origin.uml new file mode 100644 index 000000000..42239eabf --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/origin.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/right.uml new file mode 100644 index 000000000..76f3de022 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a4/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="2"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/left.uml new file mode 100644 index 000000000..b9fd37539 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/left.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/origin.uml new file mode 100644 index 000000000..42239eabf --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/origin.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/right.uml new file mode 100644 index 000000000..b9fd37539 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a5/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/left.uml new file mode 100644 index 000000000..b9fd37539 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/left.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/origin.uml new file mode 100644 index 000000000..42239eabf --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/origin.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/right.uml new file mode 100644 index 000000000..530742ca6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a6/right.uml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/left.uml new file mode 100644 index 000000000..bea951449 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/left.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/origin.uml new file mode 100644 index 000000000..42239eabf --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/origin.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/right.uml new file mode 100644 index 000000000..b9fd37539 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a7/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/left.uml new file mode 100644 index 000000000..bea951449 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/left.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/origin.uml new file mode 100644 index 000000000..42239eabf --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/origin.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/right.uml new file mode 100644 index 000000000..bea951449 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a8/right.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/left.uml new file mode 100644 index 000000000..530742ca6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/left.uml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/origin.uml new file mode 100644 index 000000000..fd39ace1f --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/origin.uml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/right.uml new file mode 100644 index 000000000..76f3de022 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/multiplicitychanges/a9/right.uml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_M2-I4L6KEeWfFPKKpMWCyw" name="RootElement"> + <packagedElement xmi:type="uml:Activity" xmi:id="_Qrq3oL6MEeWfFPKKpMWCyw" name="Activity1" node="_SgUFEL6MEeWfFPKKpMWCyw"> + <node xmi:type="uml:ActionInputPin" xmi:id="_SgUFEL6MEeWfFPKKpMWCyw" name="ActionInputPin1"> + <upperBound xmi:type="uml:LiteralInteger" xmi:id="_SgdPAL6MEeWfFPKKpMWCyw" value="1"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_g7jmoL6MEeWfFPKKpMWCyw" value="2"/> + <upperValue xmi:type="uml:LiteralInteger" xmi:id="_WPbo4L6REeWfFPKKpMWCyw" value="0"/> + </node> + </packagedElement> +</uml:Model> diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java index 0b92adb86..e00e2bca8 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java @@ -13,6 +13,10 @@ *******************************************************************************/ package org.eclipse.emf.compare.uml2.tests.suite; +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import junit.textui.TestRunner; + import org.eclipse.emf.compare.uml2.tests.association.AddAssociation2Test; import org.eclipse.emf.compare.uml2.tests.association.AddAssociation3Test; import org.eclipse.emf.compare.uml2.tests.association.AddAssociationTest; @@ -39,6 +43,7 @@ import org.eclipse.emf.compare.uml2.tests.include.AddIncludeTest; import org.eclipse.emf.compare.uml2.tests.merge.ExtensionMergeTest; import org.eclipse.emf.compare.uml2.tests.merge.MergeDiffInvolvingRefineDiffTest; import org.eclipse.emf.compare.uml2.tests.message.AddMessageTest; +import org.eclipse.emf.compare.uml2.tests.multiplicitychanges.MultiplicityElementChangesTest; import org.eclipse.emf.compare.uml2.tests.nonreg.bug484576_pseudoconflicts.TestNonRegPseudoConflict_484576; import org.eclipse.emf.compare.uml2.tests.opaque.OpaqueElementBodyChangeDiffTest; import org.eclipse.emf.compare.uml2.tests.opaque.OpaqueElementBodyChangeMergeTest; @@ -55,10 +60,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import junit.framework.JUnit4TestAdapter; -import junit.framework.Test; -import junit.textui.TestRunner; - /** * This test suite allows us to launch all tests for EMF Compare at once. * @@ -79,7 +80,8 @@ import junit.textui.TestRunner; StaticStereotypedElementItemProviderTest.class, DynamicStereotypedElementItemProviderTest.class, OpaqueElementBodyChangeDiffTest.class, OpaqueElementBodyChangeMergeTest.class, DanglingStereotypeApplicationTest.class, MergeDiffInvolvingRefineDiffTest.class, - TestNonRegPseudoConflict_484576.class, RemoveStereotypeApplicationPseudoConflictTest.class }) + TestNonRegPseudoConflict_484576.class, RemoveStereotypeApplicationPseudoConflictTest.class, + MultiplicityElementChangesTest.class }) public class AllTests { /** diff --git a/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF index 3aa97b365..0e2fd56a2 100644 --- a/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF @@ -2,16 +2,16 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.compare.uml2;singleton:=true -Bundle-Version: 2.4.0.qualifier +Bundle-Version: 2.5.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, - org.eclipse.uml2.uml;bundle-version="5.0.0", - org.eclipse.uml2.types, - org.eclipse.emf.compare + org.eclipse.uml2.uml;bundle-version="5.0.0";visibility:=reexport, + org.eclipse.uml2.types;visibility:=reexport, + org.eclipse.emf.compare;bundle-version="3.4.0";visibility:=reexport Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.emf.compare.uml2.internal.UMLComparePlugin Import-Package: com.google.common.base;version="[11.0.0,16.0.0)", diff --git a/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore b/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore index c739777ee..b73dfd26c 100644 --- a/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore +++ b/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore @@ -25,4 +25,5 @@ <eStructuralFeatures xsi:type="ecore:EAttribute" name="language" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="DanglingStereotypeApplication" eSuperTypes="platform:/plugin/org.eclipse.emf.compare/model/compare.ecore#//ResourceAttachmentChange #//UMLDiff"/> + <eClassifiers xsi:type="ecore:EClass" name="MultiplicityElementChange" eSuperTypes="#//UMLDiff"/> </ecore:EPackage> diff --git a/plugins/org.eclipse.emf.compare.uml2/plugin.xml b/plugins/org.eclipse.emf.compare.uml2/plugin.xml index 47cc9638c..dd9757364 100644 --- a/plugins/org.eclipse.emf.compare.uml2/plugin.xml +++ b/plugins/org.eclipse.emf.compare.uml2/plugin.xml @@ -50,6 +50,15 @@ Contributors: value="http://www.eclipse.org/uml2/\d.0.0/UML"> </nsURI> </processor> + <processor + class="org.eclipse.emf.compare.uml2.internal.postprocessor.MultiplicityElementChangePostProcessor" + description="Post Processor for handling UML MultiplicityElement changes" + label="Multiplicity Element Change Post Processor" + ordinal="25"> + <nsURI + value="http://www.eclipse.org/uml2/\d.0.0/UML"> + </nsURI> + </processor> </extension> <extension point="org.eclipse.emf.compare.rcp.merger"> diff --git a/plugins/org.eclipse.emf.compare.uml2/pom.xml b/plugins/org.eclipse.emf.compare.uml2/pom.xml index 930263655..502392fd8 100644 --- a/plugins/org.eclipse.emf.compare.uml2/pom.xml +++ b/plugins/org.eclipse.emf.compare.uml2/pom.xml @@ -10,6 +10,6 @@ </parent> <groupId>org.eclipse.emf.compare</groupId> <artifactId>org.eclipse.emf.compare.uml2</artifactId> - <version>2.4.0-SNAPSHOT</version> + <version>2.5.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/MultiplicityElementChange.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/MultiplicityElementChange.java new file mode 100644 index 000000000..18f27d99b --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/MultiplicityElementChange.java @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + */ +package org.eclipse.emf.compare.uml2.internal; + +/** + * <!-- begin-user-doc --> A representation of the model object '<em><b>Multiplicity Element Change</b></em> + * '. <!-- end-user-doc --> + * + * + * @see org.eclipse.emf.compare.uml2.internal.UMLComparePackage#getMultiplicityElementChange() + * @model + * @generated + */ +public interface MultiplicityElementChange extends UMLDiff { +} // MultiplicityElementChange diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java index 7f62f99ca..24a6f31e5 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java @@ -151,6 +151,15 @@ public interface UMLCompareFactory extends EFactory { DanglingStereotypeApplication createDanglingStereotypeApplication(); /** + * Returns a new object of class '<em>Multiplicity Element Change</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Multiplicity Element Change</em>'. + * @generated + */ + MultiplicityElementChange createMultiplicityElementChange(); + + /** * Returns the package supported by this factory. * <!-- begin-user-doc --> <!-- end-user-doc --> * @return the package supported by this factory. diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java index 50aaec75b..6b4600df0 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java @@ -69,7 +69,7 @@ public interface UMLComparePackage extends EPackage { int UML_DIFF = 11; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -220,7 +220,7 @@ public interface UMLComparePackage extends EPackage { int ASSOCIATION_CHANGE = 0; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -371,7 +371,7 @@ public interface UMLComparePackage extends EPackage { int EXTEND_CHANGE = 1; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -522,7 +522,7 @@ public interface UMLComparePackage extends EPackage { int GENERALIZATION_SET_CHANGE = 2; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -673,7 +673,7 @@ public interface UMLComparePackage extends EPackage { int EXECUTION_SPECIFICATION_CHANGE = 3; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -824,7 +824,7 @@ public interface UMLComparePackage extends EPackage { int INTERVAL_CONSTRAINT_CHANGE = 4; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -975,7 +975,7 @@ public interface UMLComparePackage extends EPackage { int MESSAGE_CHANGE = 5; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -1126,7 +1126,7 @@ public interface UMLComparePackage extends EPackage { int STEREOTYPE_ATTRIBUTE_CHANGE = 6; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -1277,7 +1277,7 @@ public interface UMLComparePackage extends EPackage { int STEREOTYPE_APPLICATION_CHANGE = 7; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -1437,7 +1437,7 @@ public interface UMLComparePackage extends EPackage { int STEREOTYPE_REFERENCE_CHANGE = 8; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -1588,7 +1588,7 @@ public interface UMLComparePackage extends EPackage { int PROFILE_APPLICATION_CHANGE = 9; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -1748,7 +1748,7 @@ public interface UMLComparePackage extends EPackage { int DIRECTED_RELATIONSHIP_CHANGE = 10; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -1899,7 +1899,7 @@ public interface UMLComparePackage extends EPackage { int STEREOTYPED_ELEMENT_CHANGE = 12; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -2050,7 +2050,7 @@ public interface UMLComparePackage extends EPackage { int OPAQUE_ELEMENT_BODY_CHANGE = 13; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated @@ -2211,7 +2211,7 @@ public interface UMLComparePackage extends EPackage { int DANGLING_STEREOTYPE_APPLICATION = 14; /** - * The feature id for the '<em><b>Match</b></em>' reference. + * The feature id for the '<em><b>Match</b></em>' container reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -2364,6 +2364,160 @@ public interface UMLComparePackage extends EPackage { int DANGLING_STEREOTYPE_APPLICATION_FEATURE_COUNT = ComparePackage.RESOURCE_ATTACHMENT_CHANGE_FEATURE_COUNT + 2; /** + * The meta object id for the '{@link org.eclipse.emf.compare.uml2.internal.impl.MultiplicityElementChangeImpl <em>Multiplicity Element Change</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.compare.uml2.internal.impl.MultiplicityElementChangeImpl + * @see org.eclipse.emf.compare.uml2.internal.impl.UMLComparePackageImpl#getMultiplicityElementChange() + * @generated + */ + int MULTIPLICITY_ELEMENT_CHANGE = 15; + + /** + * The feature id for the '<em><b>Match</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__MATCH = UML_DIFF__MATCH; + + /** + * The feature id for the '<em><b>Requires</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__REQUIRES = UML_DIFF__REQUIRES; + + /** + * The feature id for the '<em><b>Required By</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__REQUIRED_BY = UML_DIFF__REQUIRED_BY; + + /** + * The feature id for the '<em><b>Implies</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__IMPLIES = UML_DIFF__IMPLIES; + + /** + * The feature id for the '<em><b>Implied By</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__IMPLIED_BY = UML_DIFF__IMPLIED_BY; + + /** + * The feature id for the '<em><b>Refines</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__REFINES = UML_DIFF__REFINES; + + /** + * The feature id for the '<em><b>Refined By</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__REFINED_BY = UML_DIFF__REFINED_BY; + + /** + * The feature id for the '<em><b>Prime Refining</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__PRIME_REFINING = UML_DIFF__PRIME_REFINING; + + /** + * The feature id for the '<em><b>Kind</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__KIND = UML_DIFF__KIND; + + /** + * The feature id for the '<em><b>Source</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__SOURCE = UML_DIFF__SOURCE; + + /** + * The feature id for the '<em><b>State</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__STATE = UML_DIFF__STATE; + + /** + * The feature id for the '<em><b>Equivalence</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__EQUIVALENCE = UML_DIFF__EQUIVALENCE; + + /** + * The feature id for the '<em><b>Conflict</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__CONFLICT = UML_DIFF__CONFLICT; + + /** + * The feature id for the '<em><b>Discriminant</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__DISCRIMINANT = UML_DIFF__DISCRIMINANT; + + /** + * The feature id for the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE__EREFERENCE = UML_DIFF__EREFERENCE; + + /** + * The number of structural features of the '<em>Multiplicity Element Change</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTIPLICITY_ELEMENT_CHANGE_FEATURE_COUNT = UML_DIFF_FEATURE_COUNT + 0; + + /** * Returns the meta object for class '{@link org.eclipse.emf.compare.uml2.internal.AssociationChange <em>Association Change</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> * @return the meta object for class '<em>Association Change</em>'. @@ -2554,6 +2708,16 @@ public interface UMLComparePackage extends EPackage { EClass getDanglingStereotypeApplication(); /** + * Returns the meta object for class '{@link org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange <em>Multiplicity Element Change</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Multiplicity Element Change</em>'. + * @see org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange + * @generated + */ + EClass getMultiplicityElementChange(); + + /** * Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc * --> * @@ -2753,6 +2917,16 @@ public interface UMLComparePackage extends EPackage { */ EClass DANGLING_STEREOTYPE_APPLICATION = eINSTANCE.getDanglingStereotypeApplication(); + /** + * The meta object literal for the '{@link org.eclipse.emf.compare.uml2.internal.impl.MultiplicityElementChangeImpl <em>Multiplicity Element Change</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.compare.uml2.internal.impl.MultiplicityElementChangeImpl + * @see org.eclipse.emf.compare.uml2.internal.impl.UMLComparePackageImpl#getMultiplicityElementChange() + * @generated + */ + EClass MULTIPLICITY_ELEMENT_CHANGE = eINSTANCE.getMultiplicityElementChange(); + } } // UMLComparePackage diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/MultiplicityElementChangeImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/MultiplicityElementChangeImpl.java new file mode 100644 index 000000000..f0a198e92 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/MultiplicityElementChangeImpl.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + */ +package org.eclipse.emf.compare.uml2.internal.impl; + +import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.uml2.internal.UMLComparePackage; +import org.eclipse.emf.compare.uml2.internal.spec.UMLDiffSpec; +import org.eclipse.emf.ecore.EClass; + +/** + * <!-- begin-user-doc --> An implementation of the model object '<em><b>Multiplicity Element Change</b></em> + * '. <!-- end-user-doc --> + * <p> + * </p> + * + * @generated + */ +public class MultiplicityElementChangeImpl extends UMLDiffSpec implements MultiplicityElementChange { + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected MultiplicityElementChangeImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return UMLComparePackage.Literals.MULTIPLICITY_ELEMENT_CHANGE; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + @Override + public Diff getPrimeRefining() { + if (getRefinedBy().isEmpty()) { + return super.getPrimeRefining(); + } else { + return getRefinedBy().get(0); + } + } + +} // MultiplicityElementChangeImpl diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java index 6867e7a8b..631ddc778 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java @@ -99,6 +99,8 @@ public class UMLCompareFactoryImpl extends EFactoryImpl implements UMLCompareFac return createOpaqueElementBodyChange(); case UMLComparePackage.DANGLING_STEREOTYPE_APPLICATION: return createDanglingStereotypeApplication(); + case UMLComparePackage.MULTIPLICITY_ELEMENT_CHANGE: + return createMultiplicityElementChange(); default: throw new IllegalArgumentException( "The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -234,6 +236,16 @@ public class UMLCompareFactoryImpl extends EFactoryImpl implements UMLCompareFac } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MultiplicityElementChange createMultiplicityElementChange() { + MultiplicityElementChangeImpl multiplicityElementChange = new MultiplicityElementChangeImpl(); + return multiplicityElementChange; + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java index a6cf18c4e..6d7a7b7e0 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java @@ -19,6 +19,7 @@ import org.eclipse.emf.compare.uml2.internal.ExtendChange; import org.eclipse.emf.compare.uml2.internal.GeneralizationSetChange; import org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange; import org.eclipse.emf.compare.uml2.internal.MessageChange; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; import org.eclipse.emf.compare.uml2.internal.OpaqueElementBodyChange; import org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange; import org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange; @@ -38,112 +39,130 @@ import org.eclipse.uml2.uml.UMLPackage; /** * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc --> + * * @generated */ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePackage { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass associationChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass extendChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass generalizationSetChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass executionSpecificationChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass intervalConstraintChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass messageChangeEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass stereotypeAttributeChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass stereotypeApplicationChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass stereotypeReferenceChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass profileApplicationChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass directedRelationshipChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass umlDiffEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass stereotypedElementChangeEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass opaqueElementBodyChangeEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass danglingStereotypeApplicationEClass = null; /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private EClass multiplicityElementChangeEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package package URI value. + * <p> + * Note: the correct way to create the package is via the static factory method {@link #init init()}, + * which also performs initialization of the package, or returns the registered package, if one already + * exists. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.emf.compare.uml2.internal.UMLComparePackage#eNS_URI * @see #init() @@ -155,24 +174,28 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private static boolean isInited = false; /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it + * depends. + * <p> + * This method is used to initialize {@link UMLComparePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the + * package. <!-- begin-user-doc --> <!-- end-user-doc --> * - * <p>This method is used to initialize {@link UMLComparePackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */ public static UMLComparePackage init() { - if (isInited) + if (isInited) { return (UMLComparePackage)EPackage.Registry.INSTANCE.getEPackage(UMLComparePackage.eNS_URI); + } // Obtain or create and register package UMLComparePackageImpl theUMLComparePackage = (UMLComparePackageImpl)(EPackage.Registry.INSTANCE @@ -201,6 +224,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getAssociationChange() { @@ -209,6 +233,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getExtendChange() { @@ -217,6 +242,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getGeneralizationSetChange() { @@ -225,6 +251,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getExecutionSpecificationChange() { @@ -233,6 +260,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getIntervalConstraintChange() { @@ -241,6 +269,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getMessageChange() { @@ -248,8 +277,8 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getStereotypeAttributeChange() { @@ -258,6 +287,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getStereotypeApplicationChange() { @@ -266,6 +296,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EReference getStereotypeApplicationChange_Stereotype() { @@ -274,6 +305,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getStereotypeReferenceChange() { @@ -282,6 +314,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getProfileApplicationChange() { @@ -290,6 +323,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EReference getProfileApplicationChange_Profile() { @@ -298,6 +332,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getDirectedRelationshipChange() { @@ -306,6 +341,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getUMLDiff() { @@ -314,6 +350,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EReference getUMLDiff_Discriminant() { @@ -322,6 +359,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EReference getUMLDiff_EReference() { @@ -329,8 +367,8 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getStereotypedElementChange() { @@ -338,8 +376,8 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getOpaqueElementBodyChange() { @@ -347,8 +385,8 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EAttribute getOpaqueElementBodyChange_Language() { @@ -356,8 +394,8 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public EClass getDanglingStereotypeApplication() { @@ -366,6 +404,16 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClass getMultiplicityElementChange() { + return multiplicityElementChangeEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public UMLCompareFactory getUMLCompareFactory() { @@ -374,19 +422,21 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private boolean isCreated = false; /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Creates the meta-model objects for the package. This method is guarded to have no affect on any + * invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public void createPackageContents() { - if (isCreated) + if (isCreated) { return; + } isCreated = true; // Create classes and their features @@ -424,23 +474,27 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac createEAttribute(opaqueElementBodyChangeEClass, OPAQUE_ELEMENT_BODY_CHANGE__LANGUAGE); danglingStereotypeApplicationEClass = createEClass(DANGLING_STEREOTYPE_APPLICATION); + + multiplicityElementChangeEClass = createEClass(MULTIPLICITY_ELEMENT_CHANGE); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private boolean isInitialized = false; /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * Complete the initialization of the package and its meta-model. This method is guarded to have no affect + * on any invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public void initializePackageContents() { - if (isInitialized) + if (isInitialized) { return; + } isInitialized = true; // Initialize package @@ -477,6 +531,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac danglingStereotypeApplicationEClass.getESuperTypes().add( theComparePackage.getResourceAttachmentChange()); danglingStereotypeApplicationEClass.getESuperTypes().add(this.getUMLDiff()); + multiplicityElementChangeEClass.getESuperTypes().add(this.getUMLDiff()); // Initialize classes and features; add operations and parameters initEClass(associationChangeEClass, AssociationChange.class, @@ -548,6 +603,9 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac initEClass(danglingStereotypeApplicationEClass, DanglingStereotypeApplication.class, "DanglingStereotypeApplication", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEClass(multiplicityElementChangeEClass, MultiplicityElementChange.class, + "MultiplicityElementChange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + // Create resource createResource(eNS_URI); } diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java index 7d63b8f76..870697aad 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java @@ -145,6 +145,11 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } @Override + public Adapter caseMultiplicityElementChange(MultiplicityElementChange object) { + return createMultiplicityElementChangeAdapter(); + } + + @Override public Adapter caseDiff(Diff object) { return createDiffAdapter(); } @@ -373,6 +378,20 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange <em>Multiplicity Element Change</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange + * @generated + */ + public Adapter createMultiplicityElementChangeAdapter() { + return null; + } + + /** * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.Diff <em>Diff</em>}'. <!-- * begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's * useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java index 0b1c31129..6161766db 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java @@ -258,6 +258,17 @@ public class UMLCompareSwitch<T> { result = defaultCase(theEObject); return result; } + case UMLComparePackage.MULTIPLICITY_ELEMENT_CHANGE: { + MultiplicityElementChange multiplicityElementChange = (MultiplicityElementChange)theEObject; + T result = caseMultiplicityElementChange(multiplicityElementChange); + if (result == null) + result = caseUMLDiff(multiplicityElementChange); + if (result == null) + result = caseDiff(multiplicityElementChange); + if (result == null) + result = defaultCase(theEObject); + return result; + } default: return defaultCase(theEObject); } @@ -475,6 +486,21 @@ public class UMLCompareSwitch<T> { } /** + * Returns the result of interpreting the object as an instance of '<em>Multiplicity Element Change</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Multiplicity Element Change</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseMultiplicityElementChange(MultiplicityElementChange object) { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>Diff</em>'. * <!-- begin-user-doc * --> This implementation returns null; returning a non-null result will terminate the switch. <!-- diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/MultiplicityElementChangePostProcessor.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/MultiplicityElementChangePostProcessor.java new file mode 100644 index 000000000..f106a972e --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/MultiplicityElementChangePostProcessor.java @@ -0,0 +1,303 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.internal.postprocessor; + +import static com.google.common.collect.Iterables.filter; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterators; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.Monitor; +import org.eclipse.emf.compare.Comparison; +import org.eclipse.emf.compare.Conflict; +import org.eclipse.emf.compare.ConflictKind; +import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.DifferenceSource; +import org.eclipse.emf.compare.Match; +import org.eclipse.emf.compare.ReferenceChange; +import org.eclipse.emf.compare.postprocessor.IPostProcessor; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.uml2.uml.MultiplicityElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Post processor handling conflicts of {@link MultiplicityElementChange MultiplicityElementChanges}. + * + * @author Alexandra Buzila <abuzila@eclipsesource.com> + */ +public class MultiplicityElementChangePostProcessor implements IPostProcessor { + + /** + * A predicate that can be used to check whether a {@link Diff} is a {@link MultiplicityElementChange}. + */ + private static final Predicate<Diff> IS_MULTIPLICITY_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return diff instanceof MultiplicityElementChange; + } + }; + + /** + * A predicate that can be used to check whether a {@link Diff} is a {@link MultiplicityElementChange} and + * its {@link DifferenceSource} is LEFT. + */ + private static final Predicate<Diff> IS_LEFT_MULTIPLICITY_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return DifferenceSource.LEFT.equals(diff.getSource()) && IS_MULTIPLICITY_CHANGE.apply(diff); + } + }; + + /** + * A predicate that can be used to check whether a {@link Diff} is a {@link MultiplicityElementChange} and + * its {@link DifferenceSource} is RIGHT. + */ + private static final Predicate<Diff> IS_RIGHT_MULTIPLICITY_CHANGE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return DifferenceSource.RIGHT.equals(diff.getSource()) && IS_MULTIPLICITY_CHANGE.apply(diff); + } + }; + + /** {@inheritDoc} */ + public void postMatch(Comparison comparison, Monitor monitor) { + // do nothing + } + + /** {@inheritDoc} */ + public void postDiff(Comparison comparison, Monitor monitor) { + // do nothing + } + + /** {@inheritDoc} */ + public void postRequirements(Comparison comparison, Monitor monitor) { + // do nothing + } + + /** {@inheritDoc} */ + public void postEquivalences(Comparison comparison, Monitor monitor) { + // do nothing + } + + /** {@inheritDoc} */ + public void postConflicts(Comparison comparison, Monitor monitor) { + // do nothing + } + + /** {@inheritDoc} */ + public void postComparison(Comparison comparison, Monitor monitor) { + updateRequiresAndRefines(comparison); + verifyConflicts(comparison); + } + + /** + * Update the "refinedBy" and "requiredBy" relationships for the MultiplicityElementChanges. + * <p> + * If a MultiplicityElementChange is refined by a difference, <b>refiningDiff</b>, which in turn refines + * another diff, <b>refinedDiff</b>, then the refinement relationships will be updated such that the + * MultiplicityElementChange will refine the <b>refinedDiff</b>, instead of the <b>refiningDiff</b>. + * <p> + * This is done to avoid having diffs that refine multiple elements. Moreover, since any refined diffs of + * a refining diff are marked as required by the {@link UMLPostProcessor}, the requirement relationship + * needs to be updated accordingly. + * + * @param comparison + * the current comparison + */ + private void updateRequiresAndRefines(Comparison comparison) { + Iterator<Diff> multiplicityChanges = Iterators.filter(comparison.getDifferences().iterator(), + IS_MULTIPLICITY_CHANGE); + while (multiplicityChanges.hasNext()) { + MultiplicityElementChange refChange = (MultiplicityElementChange)multiplicityChanges.next(); + for (Diff refiningDiff : refChange.getRefinedBy()) { + ArrayList<Diff> refinedChangesToUpdate = new ArrayList<Diff>(); + for (Diff refinedDiff : refiningDiff.getRefines()) { + if (refinedDiff != refChange) { + refinedChangesToUpdate.add(refinedDiff); + } + } + for (Diff refined : refinedChangesToUpdate) { + refined.getRefinedBy().remove(refiningDiff); + refined.getRefinedBy().add(refChange); + refined.getRequires().remove(refChange); + } + } + } + } + + /** + * Verifies whether the {@link ConflictKind} of conflicts between MultiplicityChanges is correct. + * + * @param comparison + * the comparison containing the conflicts + */ + private void verifyConflicts(Comparison comparison) { + final EList<Diff> diffs = comparison.getDifferences(); + final Iterable<Diff> leftChanges = filter(diffs, IS_LEFT_MULTIPLICITY_CHANGE); + for (Diff leftDiff : leftChanges) { + final MultiplicityElementChange leftChange = (MultiplicityElementChange)leftDiff; + + final Match match = leftChange.getMatch(); + final Iterable<Diff> rightChanges = filter(diffs, IS_RIGHT_MULTIPLICITY_CHANGE); + for (Diff rightDiff : rightChanges) { + MultiplicityElementChange rightChange = (MultiplicityElementChange)rightDiff; + if (leftChange.getConflict() != null) { + verifyConflict(match, leftChange, rightChange); + } + } + } + } + + /** + * Verifies whether the {@link ConflictKind} of conflicts between MultiplicityChanges is correct, for a + * given match. Specifically, it checks whether the type of all the diffs refining the multiplicity + * reference changes is correct and makes sure that if a change contains both PSEUDO and REAL conflicts, + * the conflict of the multiplicity change is marked as REAL. + * + * @param match + * the {@link Match} for the object the multiplicity changes refer to + * @param leftChange + * the left side change + * @param rightChange + * the right side change + */ + private void verifyConflict(Match match, MultiplicityElementChange leftChange, + MultiplicityElementChange rightChange) { + if (!isRefinedByReferenceChange(leftChange) || !isRefinedByReferenceChange(rightChange)) { + return; + } + ReferenceChange leftRefChange = (ReferenceChange)leftChange.getRefinedBy().get(0); + EReference reference = leftRefChange.getReference(); + + if (!affectsReference(reference, rightChange)) { + return; + } + boolean sameValue = sameValue(reference, match.getLeft(), match.getRight()); + updateConflict(leftChange, rightChange, sameValue); + + } + + /** + * Updates the conflict kind of the given MultiplicityElementChanges. + * + * @param leftChange + * the change from the left side + * @param rightChange + * the change from the right side + * @param sameValue + * specifies whether the conflicting references have the same value (pseudo conflict) or not + * (real conflict) + */ + private void updateConflict(MultiplicityElementChange leftChange, MultiplicityElementChange rightChange, + boolean sameValue) { + if (sameValue && leftChange.getConflict().getKind() != ConflictKind.PSEUDO + && containsOnlyMultiplicityReferenceChanges(leftChange.getConflict())) { + leftChange.getConflict().setKind(ConflictKind.PSEUDO); + } else if (!sameValue && (leftChange.getConflict().getKind() != ConflictKind.REAL || rightChange + .getConflict().getKind() != ConflictKind.REAL)) { + Conflict conflict = leftChange.getConflict(); + conflict.setKind(ConflictKind.REAL); + // make sure the multiplicity changes' conflict is the real one + leftChange.setConflict(conflict); + rightChange.setConflict(conflict); + } + + } + + /** + * Returns true if the prime refining of the multiplicity element change is a reference change. + * + * @param change + * the {@link MultiplicityElementChange} to check + * @return whether the given change has a {@link ReferenceChange} as its prime refining + */ + private boolean isRefinedByReferenceChange(MultiplicityElementChange change) { + return change.getPrimeRefining() instanceof ReferenceChange; + } + + /** + * Checks if the given conflict contains differences that are not of type + * {@link MultiplicityElementChange} or are not {@link ReferenceChange reference changes} of + * {@link MultiplicityElement multiplicity elements}. + * + * @param conflict + * the conflict to check + * @return <code>true</code> if the conflict contains only {@link MultiplicityElementChange} diffs + */ + private boolean containsOnlyMultiplicityReferenceChanges(Conflict conflict) { + for (Diff diff : conflict.getDifferences()) { + if (diff instanceof MultiplicityElementChange) { + continue; + } + if (!(diff instanceof ReferenceChange)) { + return false; + } + EReference reference = ((ReferenceChange)diff).getReference(); + if (reference != UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue() + && reference != UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue()) { + return false; + } + } + return true; + } + + /** + * Checks whether the given change affects the specified eReference. + * + * @param eReference + * the {@link EReference} + * @param change + * the {@link MultiplicityElementChange} + * @return true if the given {@link MultiplicityElementChange} contains a refining {@link ReferenceChange} + * affecting the provided {@link EReference} + */ + private boolean affectsReference(EReference eReference, MultiplicityElementChange change) { + for (ReferenceChange diff : filter(change.getRefinedBy(), ReferenceChange.class)) { + if (diff.getReference() == eReference) { + return true; + } + } + return false; + } + + /** + * Checks whether the given EObjects have the same value for the specified {@link EStructuralFeature}. + * + * @param feature + * the {@link EStructuralFeature} to check + * @param object1 + * the first object + * @param object2 + * the second object + * @return true if the two given {@link EObject}s have the same value for the given + * {@link EStructuralFeature}. + */ + private boolean sameValue(EStructuralFeature feature, EObject object1, EObject object2) { + if (object1 == null || object2 == null) { + return object1 == object2; + } + Object value1 = object1.eGet(feature); + Object value2 = object2.eGet(feature); + if (value1 == null || value2 == null) { + return value1 == value2; + } + if (value1 instanceof EObject && value2 instanceof EObject) { + return EcoreUtil.equals((EObject)value1, (EObject)value2); + } + return value1.equals(value2); + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/MultiplicityElementChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/MultiplicityElementChangeFactory.java new file mode 100644 index 000000000..74f899a99 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/MultiplicityElementChangeFactory.java @@ -0,0 +1,156 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.internal.postprocessor.extension; + +import static com.google.common.base.Predicates.instanceOf; +import static com.google.common.collect.Iterables.any; +import static com.google.common.collect.Iterables.find; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.emf.compare.AttributeChange; +import org.eclipse.emf.compare.Comparison; +import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.DifferenceKind; +import org.eclipse.emf.compare.Match; +import org.eclipse.emf.compare.ReferenceChange; +import org.eclipse.emf.compare.internal.utils.ComparisonUtil; +import org.eclipse.emf.compare.uml2.internal.MultiplicityElementChange; +import org.eclipse.emf.compare.uml2.internal.UMLCompareFactory; +import org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory; +import org.eclipse.emf.compare.utils.MatchUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.Switch; +import org.eclipse.uml2.uml.LiteralInteger; +import org.eclipse.uml2.uml.LiteralUnlimitedNatural; +import org.eclipse.uml2.uml.MultiplicityElement; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValueSpecification; + +/** + * Factory for diffs affecting {@link MultiplicityElement MultiplicityElements}. + * + * @author Alexandra Buzila <abuzila@eclipsesource.com> + */ +public class MultiplicityElementChangeFactory extends AbstractUMLChangeFactory { + + @Override + public boolean handles(Diff input) { + return isChangeOfMultiplicityElement(input) && !refinesMultiplicityChange(input); + } + + /** + * Check whether the given Diff represents a change of a {@link MultiplicityElement}. + * + * @param input + * the difference to be checked + * @return <code>true</code> if the diff is a change of a {@link MultiplicityElement}, <code>false</code> + * otherwise. + */ + private boolean isChangeOfMultiplicityElement(Diff input) { + if (input instanceof ReferenceChange) { + EReference reference = ((ReferenceChange)input).getReference(); + return reference == UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue() + || reference == UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue(); + } else if (input instanceof AttributeChange) { + EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input); + if (container instanceof LiteralInteger || container instanceof LiteralUnlimitedNatural) { + EStructuralFeature eContainingFeature = container.eContainingFeature(); + return eContainingFeature == UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue() + || eContainingFeature == UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue(); + } + } + return false; + } + + /** + * Verify if the given diff refines a {@link MultiplicityElementChange} type diff. + * + * @param input + * the diff + * @return true if the diff refines a {@link MultiplicityElementChange} + */ + private boolean refinesMultiplicityChange(Diff input) { + return any(input.getRefines(), instanceOf(MultiplicityElementChange.class)); + } + + @Override + public void fillRequiredDifferences(Comparison comparison, Diff extension) { + // do nothing + } + + @Override + public void setRefiningChanges(Diff extension, DifferenceKind extensionKind, Diff refiningDiff) { + if (refiningDiff.getSource() == extension.getSource()) { + addRefiningDiffAndDependencies(extension, refiningDiff); + } + } + + /** + * Add the extension's refining diff and update the its kind, based on the refining diff's kind. + * + * @param extension + * The diff to which the refining diff must be added + * @param refiningDiff + * The refining diff to add + */ + private void addRefiningDiffAndDependencies(Diff extension, Diff refiningDiff) { + extension.getRefinedBy().add(refiningDiff); + extension.setKind(refiningDiff.getKind()); + } + + @Override + protected Switch<Set<EObject>> getDiscriminantsGetter() { + return new DiscriminantsGetter() { + @Override + public Set<EObject> caseValueSpecification(ValueSpecification object) { + Set<EObject> result = new HashSet<EObject>(); + result.add(object); + return result; + } + }; + } + + @Override + public Class<? extends Diff> getExtensionKind() { + return MultiplicityElementChange.class; + } + + @Override + protected EObject getDiscriminant(Diff input) { + return find(getDiscriminants(input), instanceOf(ValueSpecification.class), null); + } + + @Override + public Match getParentMatch(Diff input) { + EObject multiplicityElement = getDiscriminant(input).eContainer(); + return ComparisonUtil.getComparison(input).getMatch(multiplicityElement); + } + + @Override + protected boolean isRelatedToAnExtensionAdd(ReferenceChange input) { + return input.getKind() == DifferenceKind.ADD; + } + + @Override + protected boolean isRelatedToAnExtensionDelete(ReferenceChange input) { + return input.getKind() == DifferenceKind.DELETE; + } + + @Override + public Diff createExtension() { + return UMLCompareFactory.eINSTANCE.createMultiplicityElementChange(); + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java index 6190d4abf..db81acbd5 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 Obeo. + * Copyright (c) 2013, 2016 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -67,6 +67,7 @@ public final class UMLExtensionFactoryRegistry { factories.add(new UMLStereotypeApplicationChangeFactory()); factories.add(new UMLOpaqueElementBodyChangeFactory()); factories.add(new UMLDanglingStereotypeApplicationFactory()); + factories.add(new MultiplicityElementChangeFactory()); for (IChangeFactory iDiffExtensionFactory : factories) { dataset.put(iDiffExtensionFactory.getExtensionKind(), iDiffExtensionFactory); |