Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7a83a4fad0ec23b09f0d072a6ce4ef1c88e44079 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*******************************************************************************
 * Copyright (c) 2006, 2011 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.match.engine.internal;

import org.eclipse.emf.compare.FactoryException;
import org.eclipse.emf.compare.match.statistic.MetamodelFilter;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;

/**
 * Specialization of the heuristic based similarity checker making sure before computing complex metrics that
 * both EClasses are the same.
 * 
 * @author <a href="mailto:cedric.brun@obeo.fr">Cedric Brun</a>
 */
public class DistinctEcoreSimilarityChecker extends StatisticBasedSimilarityChecker {
	/**
	 * Create a new checker.
	 * 
	 * @param filter
	 *            a metamodel filter the checker can use to know whether a feature alwaas has the same value
	 *            or not in the models.
	 * @param bridge
	 *            utility class to keep API compatibility.
	 */
	public DistinctEcoreSimilarityChecker(MetamodelFilter filter, GenericMatchEngineToCheckerBridge bridge) {
		super(filter, bridge);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean isSimilar(EObject obj1, EObject obj2) throws FactoryException {
		if (!EcoreUtil.equals(obj1.eClass(), obj2.eClass())) {
			return false;
		}
		return super.isSimilar(obj1, obj2);
	}

}

Back to the top