Commit 178b9440 authored by Erwan Bousse's avatar Erwan Bousse
Browse files

Beggining maveninsation

parent 5ab9e438
......@@ -21,9 +21,9 @@ import fr.inria.diverse.cloning.runtime.util.Log;
* @author ebousse
*
*/
public class MutClassesOnlyTagger extends AbstractTagger {
public class ShareAllTagger extends AbstractTagger {
public MutClassesOnlyTagger(ResourceSet metamodel, String metamodelname) {
public ShareAllTagger(ResourceSet metamodel, String metamodelname) {
super(metamodel,metamodelname);
}
......@@ -108,11 +108,6 @@ public class MutClassesOnlyTagger extends AbstractTagger {
if (tarjanLowlinks.get(v).equals(tarjanIndexes.get(v))) {
//System.out.println("PLAP");
if (v.getName().equals("Class701"))
System.out.println("zzzzzzzzz");
StronglyConnectedComponent scc = new StronglyConnectedComponent();
EClass w;
do {
......@@ -263,7 +258,7 @@ public class MutClassesOnlyTagger extends AbstractTagger {
*/
@Override
public void recomputeTags() {
Log.info("Tagging with MutClassesOnlyTagger.");
Log.info("Tagging with ShareAllTagger.");
tarjanWithTagging(classesTags.keySet());
Log.info("Computed mutabilities:");
Log.plusLevel();
......@@ -290,7 +285,7 @@ public class MutClassesOnlyTagger extends AbstractTagger {
*/
@Override
public String getSuffix() {
return "MutClassOnlyPImpl";
return "ShareAllProxy";
}
/*
......@@ -300,7 +295,12 @@ public class MutClassesOnlyTagger extends AbstractTagger {
*/
@Override
public String getCloningName() {
return "MutClassOnly";
return "ShareAll";
}
@Override
public boolean mayTagClassesPartShareable() {
return true;
}
......
......@@ -12,16 +12,16 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import fr.inria.diverse.cloning.runtime.common.ClassTag;
import fr.inria.diverse.cloning.runtime.util.Log;
public class DeepTagger extends AbstractTagger {
public class ShareFieldsOnlyTagger extends AbstractTagger {
public DeepTagger(ResourceSet metamodel, String metamodelname) {
public ShareFieldsOnlyTagger(ResourceSet metamodel, String metamodelname) {
super(metamodel, metamodelname);
}
@Override
public void recomputeTags() {
Log.info("Tagging with DeepTagger.");
Log.info("Tagging with ShareFieldsOnlyTagger.");
for (Resource res : metamodel.getResources()) {
for (Iterator<EObject> i = res.getAllContents(); i.hasNext();) {
EObject next = i.next();
......@@ -65,12 +65,18 @@ public class DeepTagger extends AbstractTagger {
@Override
public String getSuffix() {
return "DeepPImpl";
return "ShareFieldsOnlyProxy";
}
@Override
public String getCloningName() {
return "Deep";
return "ShareFieldsOnly";
}
@Override
public boolean mayTagClassesPartShareable() {
return true;
}
}
package fr.inria.diverse.cloning.materialgenerator.tagger.impl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
import fr.inria.diverse.cloning.runtime.common.ClassTag;
public class ShareObjOnlyTagger extends ShareAllTagger {
public ShareObjOnlyTagger(ResourceSet metamodel, String metamodelname) {
super(metamodel, metamodelname);
}
@Override
public String getSuffix() {
return "ShareObjOnlyProxy";
}
@Override
public String getCloningName() {
return "ShareObjOnly";
}
@Override
public ClassTag getTagOfEClass(EClass c) {
ClassTag result = super.getTagOfEClass(c);
if (result == ClassTag.PARTIALLY_SHAREABLE)
return ClassTag.NOT_SHAREABLE;
else
return result;
}
@Override
public boolean isPropertyShareable(EStructuralFeature property) {
return false;
}
@Override
public boolean mayTagClassesShareable() {
return super.mayTagClassesShareable();
}
@Override
public boolean mayTagClassesPartShareable() {
return false;
}
}
package fr.inria.diverse.cloning.materialgenerator.tagger.impl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
import fr.inria.diverse.cloning.runtime.common.ClassTag;
import fr.inria.diverse.cloning.runtime.util.EcoreHelper;
import fr.inria.diverse.cloning.runtime.util.EcoreHelper.NoSingleRootException;
public class WeakMutClassesOnlyTagger extends AbstractTagger {
public WeakMutClassesOnlyTagger(ResourceSet metamodel, String metamodelname) {
super(metamodel, metamodelname);
}
/**
* Tags a containment tree of EClasses.
*
* @param root
* The root EClass of the containment tree.
* @return True if this (sub)tree has a mutable. Required for the recursive calls.
* @throws NoSingleRootException
*/
private boolean treeTagging(EClass root) throws NoSingleRootException {
boolean hasMutables = false;
boolean hasReadonlys = false;
// For each property
for (EStructuralFeature prop : root.getEAllStructuralFeatures()) {
// We check if it was designed mutable ("_m"), in which case we're done
// (BUT need to call recursivement if containment)
if (isPropertyDesignedMutable(prop)) {
hasMutables = true;
propertiesTags.put(prop, true);
if (prop instanceof EReference) {
EReference ref = (EReference) prop;
if (ref.isContainment()) {
treeTagging(ref.getEReferenceType());
}
}
}
// Else
else {
// If it is a containment
if (prop instanceof EReference) {
EReference ref = (EReference) prop;
if (ref.isContainment()) {
if (treeTagging(ref.getEReferenceType())) {
hasMutables = true;
propertiesTags.put(prop, true);
} else {
hasReadonlys = true;
propertiesTags.put(prop, false);
}
} else {
hasReadonlys = true;
propertiesTags.put(prop, false);
}
}
// If it is an attribute, must be readonly
else if (prop instanceof EAttribute) {
hasReadonlys = true;
propertiesTags.put(prop, false);
}
}
}
// After analyzing the class, if all settled, we tag it
if (hasMutables && hasReadonlys)
classesTags.put(root, ClassTag.PARTIALLY_SHAREABLE);
else if (hasMutables && !hasReadonlys)
classesTags.put(root, ClassTag.NOT_SHAREABLE);
else
classesTags.put(root, ClassTag.COMPLETELY_SHAREABLE);
return hasMutables;
/*
* // Is this class mutable or can reach a mutable through containment ? // At first, false boolean hasMutable =
* false;
*
* // We first make recursive calls looking for mutables at lower levels // If some contained classes are
* mutable, we change hasMutable for (EReference cont : root.getEAllContainments()) { hasMutable = hasMutable ||
* treeTagging(cont.getEReferenceType()); }
*
* // Then depending on the local attributes, we tag the current class PropertiesMutability localMut =
* findLocalMutability(root); switch (localMut) { case someMutable: hasMutable = true; classesTags.put(root,
* ClassTag.partiallyMutable); break; case allMutable: hasMutable = true; classesTags.put(root,
* ClassTag.completelyMutable); break; case noneMutable: // if (hasMutable) // classesTags.put(root,
* ClassTag.canReachMutable); // else classesTags.put(root, ClassTag.completelyReadonly); break; }
*
* // And we return true if the class is considered mutable return hasMutable;
*/
}
@Override
public void recomputeTags() {
try {
treeTagging(EcoreHelper.findRoot(this.classesTags.keySet()));
} catch (NoSingleRootException e) {
System.out.println(e.getMessage());
System.out.println("No tagging possible for WeakMutClassesOnlyMetamodelTagger.");
}
System.out.println("Computed mutabilities:");
if (classesTags.size() == 0)
System.out.println("No mutable class!");
for (EClass c : classesTags.keySet()) {
System.out.println(c.getName() + " : " + classesTags.get(c));
}
}
@Override
public boolean mayTagClassesShareable() {
return true;
}
@Override
public String getSuffix() {
return "TreeMutClassOnlyPImpl";
}
@Override
public String getCloningName() {
return "TreeMutClassOnly";
}
}
Manifest-Version: 1.0
Export-Package: fr.inria.diverse.cloning.materialgenerator.generators,
fr.inria.diverse.cloning.materialgenerator.metrics,fr.inria.diverse.c
loning.materialgenerator.tagger,fr.inria.diverse.cloning.materialgene
rator.tagger.impl,fr.inria.diverse.cloning.materialgenerator.util
Require-Bundle: org.eclipse.core.runtime,org.eclipse.gmt.modisco.java.
generation;bundle-version="0.11.1",org.eclipse.emf.common,org.eclipse
.emf.ecore;bundle-version="2.9.1",org.eclipse.modisco.java.discoverer
;bundle-version="0.11.1",org.eclipse.modisco.infra.discovery.core;bun
dle-version="0.11.1",org.eclipse.core.resources;bundle-version="3.8.1
01",org.eclipse.jdt.core;bundle-version="3.9.1",org.eclipse.equinox.r
egistry,org.eclipse.gmt.modisco.java;bundle-version="0.11.1",org.ecli
pse.emf.ecore.xmi;bundle-version="2.9.1",org.eclipse.gmf.runtime.emf.
core;bundle-version="1.7.0",fr.inria.diverse.cloning.runtime;bundle-v
ersion="0.1.0",org.eclipse.emf.codegen;bundle-version="2.9.0",org.ecl
ipse.emf.codegen.ecore;bundle-version="2.9.1",org.eclipse.jface.text;
bundle-version="3.8.101",org.eclipse.ui;bundle-version="3.105.0",org.
eclipse.core.variables;bundle-version="3.2.700",org.eclipse.debug.cor
e;bundle-version="3.8.0",org.eclipse.jdt.launching;bundle-version="3.
7.0",org.eclipse.debug.ui;bundle-version="3.9.0",org.eclipse.jdt.debu
g.ui;bundle-version="3.6.200",org.eclipse.ui.ide;bundle-version="3.9.
1",org.eclipse.ui.console
Bundle-ClassPath: .,lib/jopt-simple-4.6.jar
Bundle-Version: 0.1.0.201404010852
Bundle-Name: CloningMaterialGenerator
Bundle-ManifestVersion: 2
Bundle-SymbolicName: fr.inria.diverse.cloning.materialgenerator;single
ton:=true
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment