本文整理汇总了Java中org.eclipse.emf.compare.match.DefaultComparisonFactory类的典型用法代码示例。如果您正苦于以下问题:Java DefaultComparisonFactory类的具体用法?Java DefaultComparisonFactory怎么用?Java DefaultComparisonFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultComparisonFactory类属于org.eclipse.emf.compare.match包,在下文中一共展示了DefaultComparisonFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setupComparator
import org.eclipse.emf.compare.match.DefaultComparisonFactory; //导入依赖的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.DefaultComparisonFactory; //导入依赖的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: create
import org.eclipse.emf.compare.match.DefaultComparisonFactory; //导入依赖的package包/类
public static IMatchEngine create(UseIdentifiers useIDs,
WeightProvider.Descriptor.Registry weightProviderRegistry) {
return new SemanticMatchEngine(SemanticMatchEngine.createDefaultEObjectMatcher(useIDs, weightProviderRegistry), new DefaultComparisonFactory(new DefaultEqualityHelperFactory()));
}
开发者ID:MDEGroup,项目名称:EMFCompare-Semantic-Extension,代码行数:5,代码来源:SemanticMatchEngine.java
示例4: create
import org.eclipse.emf.compare.match.DefaultComparisonFactory; //导入依赖的package包/类
public static IMatchEngine create(UseIdentifiers useIDs, WeightProvider.Descriptor.Registry weightProviderRegistry){
return new SemanticMatchEngine(SemanticMatchEngine.createDefaultEObjectMatcher(useIDs, weightProviderRegistry), new DefaultComparisonFactory(new DefaultEqualityHelperFactory()));
}
开发者ID:MDEGroup,项目名称:EMFCompare-Semantic-Extension,代码行数:4,代码来源:SemanticMatchEngine.java
示例5: merge
import org.eclipse.emf.compare.match.DefaultComparisonFactory; //导入依赖的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
示例6: LazyMatchEngineFactory
import org.eclipse.emf.compare.match.DefaultComparisonFactory; //导入依赖的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.DefaultComparisonFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论