<commit_before>package org.gemoc.execution.engine.commons.trace;

import org.eclipse.emf.common.util.Monitor;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.merge.AbstractMerger;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;

class Merger extends AbstractMerger {

	public Merger() 
	{
		setRegistry(EMFCompareRCPPlugin.getDefault().getMergerRegistry());
	}
	
	@Override
	public boolean isMergerFor(Diff target) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void copyRightToLeft(Diff target, Monitor monitor) {
		this.mergeDiff(target, true, monitor);
	}

	@Override
	public void copyLeftToRight(Diff target, Monitor monitor) {
		this.mergeDiff(target, false, monitor);
	}

}
<commit_msg>Changing the Merger to fix restoreState duplicates<commit_after>package org.gemoc.execution.engine.commons.trace;

import org.eclipse.emf.common.util.Monitor;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.merge.AbstractMerger;
import org.eclipse.emf.compare.merge.ReferenceChangeMerger;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.utils.EMFCompareCopier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;

class Merger extends AbstractMerger {

	/**
	 * We want to bypass the reference merger that is eventually called by the 
	 * abstract merger, so we create this merger with a very high ranking.
	 * 
	 * The goal of the bypass is th replace the operation createCopy, so that
	 * objects are not created multiple times.
	 * 
	 * @author ebousse
	 *
	 */
	public static class CustomReferenceMerger extends ReferenceChangeMerger {

		final EcoreUtil.Copier copier = new EMFCompareCopier();

		protected EObject createCopy(EObject referenceObject) {

			if (copier.containsKey(referenceObject))
				return copier.get(referenceObject);
			return copier.copy(referenceObject);
		}

		@Override
		public int getRanking() {
			return Integer.MAX_VALUE;
		}

	}

	public Merger() {
		setRegistry(EMFCompareRCPPlugin.getDefault().getMergerRegistry());
		getRegistry().add(new CustomReferenceMerger());
	}

	@Override
	public boolean isMergerFor(Diff target) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void copyRightToLeft(Diff target, Monitor monitor) {
		this.mergeDiff(target, true, monitor);
	}

	@Override
	public void copyLeftToRight(Diff target, Monitor monitor) {
		this.mergeDiff(target, false, monitor);
	}

}

{'fraction_non_alphanumeric': 0.09611533840608731, 'fraction_numerical': 0.0, 'mean_word_length': 4.782407407407407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2377159', 'n_tokens_mistral': 823, 'n_tokens_neox': 760, 'n_words': 185}