本文整理汇总了Java中org.eclipse.emf.compare.match.IComparisonFactory类的典型用法代码示例。如果您正苦于以下问题:Java IComparisonFactory类的具体用法?Java IComparisonFactory怎么用?Java IComparisonFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IComparisonFactory类属于org.eclipse.emf.compare.match包,在下文中一共展示了IComparisonFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupComparator
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的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;
}
示例2: getMatchEngine
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的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);
}
示例3: SCTMatchEngine
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的package包/类
public SCTMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) {
super(matcher, comparisonFactory);
}
示例4: SemanticMatchEngine
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的package包/类
public SemanticMatchEngine(IEObjectMatcher matcher,
IComparisonFactory comparisonFactory) {
super(matcher, comparisonFactory);
}
示例5: SemanticMatchEngine
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的package包/类
public SemanticMatchEngine(IEObjectMatcher eObjectMatcher, IComparisonFactory comparisonFactory){
super(eObjectMatcher, comparisonFactory);
}
示例6: merge
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的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;
}
示例7: LazyMatchEngineFactory
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的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);
}
示例8: LazyMatchEngine
import org.eclipse.emf.compare.match.IComparisonFactory; //导入依赖的package包/类
/**
* Creates a new LazyMatchEngine.
*
* @param matcher
* the matcher to use
* @param comparisonFactory
* the {@link IComparisonFactory} to use
*/
public LazyMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) {
super(matcher, comparisonFactory);
}