/** */ package mutator.impl; import de.mdelab.workflow.WorkflowExecutionContext; import de.mdelab.workflow.components.impl.WorkflowComponentImpl; import de.mdelab.workflow.impl.WorkflowExecutionException; import fr.tpt.mem4csd.loss.modelMutationUtils.SiteOfLossGenerator; import mutator.MutatorPackage; import mutator.RandomMutateModel; import java.io.IOException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.EMap; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.resource.Resource; /** * * An implementation of the model object 'Random Mutate Model'. * *

* The following features are implemented: *

* * * @generated */ public class RandomMutateModelImpl extends WorkflowComponentImpl implements RandomMutateModel { /** * The default value of the '{@link #getModelSlot() Model Slot}' attribute. * * * @see #getModelSlot() * @generated * @ordered */ protected static final String MODEL_SLOT_EDEFAULT = null; /** * The cached value of the '{@link #getModelSlot() Model Slot}' attribute. * * * @see #getModelSlot() * @generated * @ordered */ protected String modelSlot = MODEL_SLOT_EDEFAULT; /** * * * @generated */ protected RandomMutateModelImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return MutatorPackage.Literals.RANDOM_MUTATE_MODEL; } /** * * * @generated */ @Override public String getModelSlot() { return modelSlot; } /** * * * @generated */ @Override public void setModelSlot(String newModelSlot) { String oldModelSlot = modelSlot; modelSlot = newModelSlot; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MutatorPackage.RANDOM_MUTATE_MODEL__MODEL_SLOT, oldModelSlot, modelSlot)); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case MutatorPackage.RANDOM_MUTATE_MODEL__MODEL_SLOT: return getModelSlot(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case MutatorPackage.RANDOM_MUTATE_MODEL__MODEL_SLOT: setModelSlot((String)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case MutatorPackage.RANDOM_MUTATE_MODEL__MODEL_SLOT: setModelSlot(MODEL_SLOT_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case MutatorPackage.RANDOM_MUTATE_MODEL__MODEL_SLOT: return MODEL_SLOT_EDEFAULT == null ? modelSlot != null : !MODEL_SLOT_EDEFAULT.equals(modelSlot); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (modelSlot: "); result.append(modelSlot); result.append(')'); return result.toString(); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void execute(final WorkflowExecutionContext context, final IProgressMonitor monitor) throws WorkflowExecutionException, IOException { final SubMonitor subMonitor = SubMonitor.convert(monitor, 2); context.getLogger().addInfo("Modifying a slot.", this); subMonitor.setTaskName("RandomMutation"); Resource model = getModelResource(context, modelSlot, "temp", true); EList contents = model.getContents(); SiteOfLossGenerator gen = new SiteOfLossGenerator(3); gen.generateSiteOfLoss(contents); subMonitor.done(); context.getLogger().addInfo("Done.", this); } } //RandomMutateModelImpl