Commit 5ab9e438 authored by Erwan Bousse's avatar Erwan Bousse

Working version for the paper, and working plugin UI

parent 96371bd5
/**
*/
package somemmdeep;
import ab.A;
import ab.AbPackage;
import ab.B;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>A</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>
* { @link ab.impl.ADeepPImpl#getI <em>I</em>}
* </li>
* <li>
* { @link ab.impl.ADeepPImpl#getJ_m <em>Jm</em>}
* </li>
* <li>
* { @link ab.impl.ADeepPImpl#getB <em>B</em>}
* </li>
* </ul>
* </p>
* @generated
*/
public class ADeepPImpl extends MinimalEObjectImpl.Container implements A {
protected A cloned;
/**
* The default value of the '
* { @link #getI() <em>I</em>}
* ' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getI()
* @generated
* @ordered
*/
protected static final int I_EDEFAULT = 0;
/**
* The default value of the '
* { @link #getJ_m() <em>Jm</em>}
* ' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getJ_m()
* @generated
* @ordered
*/
protected static final int JM_EDEFAULT = 0;
/**
* The cached value of the '
* { @link #getJ_m() <em>Jm</em>}
* ' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getJ_m()
* @generated
* @ordered
*/
protected int j_m = JM_EDEFAULT;
/**
* The cached value of the '
* { @link #getB() <em>B</em>}
* ' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getB()
* @generated
* @ordered
*/
protected EList<B> b;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ADeepPImpl(A clonedParam) {
super();
cloned = clonedParam;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AbPackage.Literals.A;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getI() {
return cloned.getI();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setI(int newI) {
System.out
.println("[Info] ADeepPImpl: i is readonly and cannot be set.");
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getJ_m() {
return j_m;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setJ_m(int newJ_m) {
int oldJ_m = j_m;
j_m = newJ_m;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
AbPackage.A__JM, oldJ_m, j_m));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<B> getB() {
if (b == null) {
b = new EObjectContainmentEList<B>(B.class, this, AbPackage.A__B);
}
return b;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case AbPackage.A__B:
return ((InternalEList<?>) getB()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AbPackage.A__I:
return getI();
case AbPackage.A__JM:
return getJ_m();
case AbPackage.A__B:
return getB();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AbPackage.A__I:
setI((Integer) newValue);
return;
case AbPackage.A__JM:
setJ_m((Integer) newValue);
return;
case AbPackage.A__B:
getB().clear();
getB().addAll((Collection<? extends B>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AbPackage.A__I:
setI(I_EDEFAULT);
return;
case AbPackage.A__JM:
setJ_m(JM_EDEFAULT);
return;
case AbPackage.A__B:
getB().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AbPackage.A__I:
return cloned.getI() != I_EDEFAULT;
case AbPackage.A__JM:
return j_m != JM_EDEFAULT;
case AbPackage.A__B:
return b != null && !b.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (i: ");
result.append(cloned.getI());
result.append(", j_m: ");
result.append(j_m);
result.append(')');
return result.toString();
}
}
//AImpl
/**
*/
package somemmdeep;
import ab.AbPackage;
import ab.B;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>B</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>
* { @link ab.impl.BDeepPImpl#getX <em>X</em>}
* </li>
* </ul>
* </p>
* @generated
*/
public class BDeepPImpl extends MinimalEObjectImpl.Container implements B {
protected B cloned;
/**
* The default value of the '
* { @link #getX() <em>X</em>}
* ' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected static final int X_EDEFAULT = 0;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BDeepPImpl(B clonedParam) {
super();
cloned = clonedParam;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AbPackage.Literals.B;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getX() {
return cloned.getX();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setX(int newX) {
System.out
.println("[Info] BDeepPImpl: x is readonly and cannot be set.");
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AbPackage.B__X:
return getX();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AbPackage.B__X:
setX((Integer) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AbPackage.B__X:
setX(X_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AbPackage.B__X:
return cloned.getX() != X_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (x: ");
result.append(cloned.getX());
result.append(')');
return result.toString();
}
}
//BImpl
package somemmdeep;
import fr.inria.diverse.cloning.cloner.common.CloningMaterial;
import fr.inria.diverse.cloning.cloner.emfextension.impl.LooseCopier;
import fr.inria.diverse.cloning.cloner.common.MetamodelTags;
public class SomeMMDeepCloningMaterial implements CloningMaterial {
private static SomeMMDeepCloningMaterial instance;
private SomeMMDeepTags tags;
private SomeMMDeepCloningMaterial(SomeMMDeepTags tags) {
this.tags = tags;
};
public static SomeMMDeepCloningMaterial getInstance() {
if (instance == null)
instance = new SomeMMDeepCloningMaterial(new SomeMMDeepTags());
return instance;
}
public MetamodelTags getTags() {
return tags;
}
public LooseCopier createLightCopier() {
return new SomeMMDeepLightCopier();
}
}
package somemmdeep;
import org.eclipse.emf.ecore.EObject;
import fr.inria.diverse.cloning.cloner.emfextension.impl.LooseCopier;
import ab.B;
import ab.A;
@SuppressWarnings("serial")
public class SomeMMDeepLightCopier extends LooseCopier {
protected EObject createCopy(EObject eObject) {
if (eObject instanceof B)
return new BDeepPImpl((B) eObject);
if (eObject instanceof A)
return new ADeepPImpl((A) eObject);
else
return super.createCopy(eObject);
}
}
package somemmdeep;
import org.eclipse.emf.ecore.EClass;
import fr.inria.diverse.cloning.cloner.common.ClassTag;
import fr.inria.diverse.cloning.cloner.common.MetamodelTags;
import org.eclipse.emf.ecore.EStructuralFeature;
import ab.B;
import ab.A;
public class SomeMMDeepTags implements MetamodelTags {
public ClassTag getTagOf(EClass eClass) {
if (eClass.equals(ab.AbPackage.eINSTANCE.getB()))
return ClassTag.PARTIALLY_SHAREABLE;
if (eClass.equals(ab.AbPackage.eINSTANCE.getA()))
return ClassTag.PARTIALLY_SHAREABLE;
else
return null;
}
public boolean mayTagClassesShareable() {
return false;
}
public boolean isPropertyShareable(EStructuralFeature prop) {
if (prop.equals(ab.AbPackage.eINSTANCE.getB_X()))
return true;
if (prop.equals(ab.AbPackage.eINSTANCE.getA_I()))
return true;
if (prop.equals(ab.AbPackage.eINSTANCE.getA_J_m()))
return false;
if (prop.equals(ab.AbPackage.eINSTANCE.getA_B()))
return false;
else
return false;
}
public double getCompShareableClassesRatio() {
return 0.0;
}
public double getPartShareableClassesRatio() {
return 1.0;
}
public double getShareablePropertiesInShareableClassesRatio() {
return 0.5;
}
public double getMeanShareablePropertiesInShareableClasses() {
return 1.0;
}
}
/**
*/
package somemmmutclassonly;
import ab.A;
import ab.AbPackage;
import ab.B;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>A</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>
* { @link ab.impl.AMutClassOnlyPImpl#getI <em>I</em>}
* </li>
* <li>
* { @link ab.impl.AMutClassOnlyPImpl#getJ_m <em>Jm</em>}
* </li>
* <li>
* { @link ab.impl.AMutClassOnlyPImpl#getB <em>B</em>}
* </li>
* </ul>
* </p>
* @generated
*/
public class AMutClassOnlyPImpl extends MinimalEObjectImpl.Container implements
A {
protected A cloned;
/**
* The default value of the '
* { @link #getI() <em>I</em>}
* ' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getI()
* @generated
* @ordered
*/
protected static final int I_EDEFAULT = 0;
/**
* The default value of the '
* { @link #getJ_m() <em>Jm</em>}
* ' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getJ_m()
* @generated
* @ordered
*/
protected static final int JM_EDEFAULT = 0;
/**
* The cached value of the '
* { @link #getJ_m() <em>Jm</em>}