本文整理汇总了Java中org.eclipse.emf.compare.match.DefaultMatchEngine类的典型用法代码示例。如果您正苦于以下问题:Java DefaultMatchEngine类的具体用法?Java DefaultMatchEngine怎么用?Java DefaultMatchEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultMatchEngine类属于org.eclipse.emf.compare.match包,在下文中一共展示了DefaultMatchEngine类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: initEqualityCache
import org.eclipse.emf.compare.match.DefaultMatchEngine; //导入依赖的package包/类
/**
* Initialize a cache to be used by the equality helper.
*
* @return The ready to use cache.
*/
private LoadingCache<EObject, URI> initEqualityCache() {
CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder().maximumSize(
DefaultMatchEngine.DEFAULT_EOBJECT_URI_CACHE_MAX_SIZE);
final LoadingCache<EObject, URI> cache = EqualityHelper.createDefaultCache(cacheBuilder);
return cache;
}
开发者ID:kopl,项目名称:SPLevo,代码行数:12,代码来源:JaMoPPDiffer.java
示例3: 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
示例4: 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
示例5: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论