当前位置: 首页>>代码示例>>Java>>正文


Java DefaultMatchEngine.createDefaultEObjectMatcher方法代码示例

本文整理汇总了Java中org.eclipse.emf.compare.match.DefaultMatchEngine.createDefaultEObjectMatcher方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultMatchEngine.createDefaultEObjectMatcher方法的具体用法?Java DefaultMatchEngine.createDefaultEObjectMatcher怎么用?Java DefaultMatchEngine.createDefaultEObjectMatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.compare.match.DefaultMatchEngine的用法示例。


在下文中一共展示了DefaultMatchEngine.createDefaultEObjectMatcher方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupComparator

import org.eclipse.emf.compare.match.DefaultMatchEngine; //导入方法依赖的package包/类
/**
 * setups a default emf comparator. This is just copy & paste from the
 * EMFCompare tutorial.
 * 
 * @return default emf comparator.
 */
private EMFCompare setupComparator() {
	IEObjectMatcher matcher = DefaultMatchEngine
			.createDefaultEObjectMatcher(UseIdentifiers.NEVER);
	IComparisonFactory comparisonFactory = new DefaultComparisonFactory(
			new DefaultEqualityHelperFactory());
	IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(
			matcher, comparisonFactory);
	matchEngineFactory.setRanking(20);
	IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
	matchEngineRegistry.add(matchEngineFactory);
	EMFCompare comparator = EMFCompare.builder()
			.setMatchEngineFactoryRegistry(matchEngineRegistry).build();

	return comparator;
}
 
开发者ID:leondart,项目名称:FRaMED,代码行数:22,代码来源:TransformationTestSuite.java

示例2: getMatchEngine

import org.eclipse.emf.compare.match.DefaultMatchEngine; //导入方法依赖的package包/类
@Override
public IMatchEngine getMatchEngine() {
	final IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
	final IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.WHEN_AVAILABLE);
	return new SCTMatchEngine(matcher, comparisonFactory);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:7,代码来源:SCTMatchEngineFactory.java

示例3: merge

import org.eclipse.emf.compare.match.DefaultMatchEngine; //导入方法依赖的package包/类
public static EObject merge(URI localChanges, URI original, URI remote) throws IncQueryException {
	Resource originalModel = new ResourceSetImpl().getResource(original, true);
	Resource remoteModel = new ResourceSetImpl().getResource(remote, true);
	
	
	// Configure EMF Compare
	IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.WHEN_AVAILABLE);
	IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
	IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(matcher, comparisonFactory);
	matchEngineFactory.setRanking(20);
	IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
	matchEngineRegistry.add(matchEngineFactory);
	EMFCompare comparator = EMFCompare.builder().setMatchEngineFactoryRegistry(matchEngineRegistry).build();

	// Compare the two models
	IComparisonScope scopeOR = EMFCompare.createDefaultScope(remoteModel, originalModel);
	Comparison comparisonOR = comparator.compare(scopeOR);

	ChangeSet changeSetOR = EMFCompareTranslator.translate(comparisonOR);
	ChangeSet changeSetOL = null;
	boolean hasLocalChanges = new File(localChanges.toFileString()).exists(); 
	if(hasLocalChanges) {
		changeSetOL = (ChangeSet) new ResourceSetImpl().getResource(localChanges, true).getContents().get(0);
		EList<Change> changes = changeSetOL.getChanges();
		for (Change change : changes) {
			change.setExecutable(true);
		}
	} else {
		changeSetOL = ModelFactory.eINSTANCE.createChangeSet();
	}
	
	Collection<DSETransformationRule<?,?>>rules = Lists.<DSETransformationRule<?,?>>newArrayList(
	new DSETransformationRule<CreateMatch,CreateMatcher>(CreateQuerySpecification.instance(), new CreateOperation()),
	new DSETransformationRule<DeleteMatch,DeleteMatcher>(DeleteQuerySpecification.instance(), new DeleteOperation()),
	new DSETransformationRule<SetReferenceMatch,SetReferenceMatcher>(SetReferenceQuerySpecification.instance(), new SetReferenceOperation()),
	new DSETransformationRule<AddReferenceMatch,AddReferenceMatcher>(AddReferenceQuerySpecification.instance(), new AddReferenceOperation()),
	new DSETransformationRule<RemoveReferenceMatch,RemoveReferenceMatcher>(RemoveReferenceQuerySpecification.instance(), new RemoveReferenceOperation()),
	new DSETransformationRule<SetAttributeMatch,SetAttributeMatcher>(SetAttributeQuerySpecification.instance(), new SetAttributeOperation()),
	new DSETransformationRule<AddAttributeMatch,AddAttributeMatcher>(AddAttributeQuerySpecification.instance(), new AddAttributeOperation()),
	new DSETransformationRule<RemoveAttributeMatch,RemoveAttributeMatcher>(RemoveAttributeQuerySpecification.instance(), new RemoveAttributeOperation()));

	Collection<IQuerySpecification<?>>goals = Lists.<IQuerySpecification<?>>newArrayList(
			GoalPatternQuerySpecification.instance()
	);		

	
	DSEMergeManager manager = DSEMergeManager.create(originalModel.getContents().get(0), changeSetOL, changeSetOR);
	manager.setMetamodel(WTSpec4MPackage.eINSTANCE);
	manager.setId2EObject(Id2objectQuerySpecification.instance());
	manager.setRules(rules);
	manager.setObjectives(goals);

	Collection<Solution> solutions = manager.start();
	EObject merged = solutions.iterator().next().getScope().getOrigin();
	return merged;		
}
 
开发者ID:FTSRG,项目名称:mondo-collab-framework,代码行数:57,代码来源:Activator.java

示例4: LazyMatchEngineFactory

import org.eclipse.emf.compare.match.DefaultMatchEngine; //导入方法依赖的package包/类
/**
 * Constructor that instantiate a {@link LazyMatchEngine} that will use
 * identifiers as specified by the given {@code useIDs} enumeration.
 * 
 * @param useIDs
 *            the kinds of matcher to use.
 * @param registry
 *            A match engine needs a WeightProvider in case of this match
 *            engine do not use identifiers.
 */
public LazyMatchEngineFactory(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry registry) {
    final IComparisonFactory comparisonFactory = new DefaultComparisonFactory(
            new LazyEqualityHelperFactory());
    final IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(useIDs,
            registry);
    NeoLogger.info("LazyMatchEngine with LazyEqualityHelper created");
    matchEngine = new LazyMatchEngine(matcher, comparisonFactory);
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:19,代码来源:LazyMatchEngineFactory.java


注:本文中的org.eclipse.emf.compare.match.DefaultMatchEngine.createDefaultEObjectMatcher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。