本文整理汇总了Java中org.eclipse.emf.compare.match.resource.IResourceMatcher类的典型用法代码示例。如果您正苦于以下问题:Java IResourceMatcher类的具体用法?Java IResourceMatcher怎么用?Java IResourceMatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IResourceMatcher类属于org.eclipse.emf.compare.match.resource包,在下文中一共展示了IResourceMatcher类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: match
import org.eclipse.emf.compare.match.resource.IResourceMatcher; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* <b>Note:</b> This method overrides
* {@link DefaultMatchEngine#match(Comparison, IComparisonScope, ResourceSet, ResourceSet, ResourceSet, Monitor)}
* to remove incompatible Guava dependencies. It should be removed if/when
* Guava dependencies become compatible with NeoEMF.
*/
@Override
protected void match(Comparison comparison, IComparisonScope scope, ResourceSet left,
ResourceSet right, ResourceSet origin, Monitor monitor) {
final Iterator<? extends Resource> leftChildren = scope.getCoveredResources(left);
final Iterator<? extends Resource> rightChildren = scope.getCoveredResources(right);
final Iterator<? extends Resource> originChildren;
if (origin != null) {
originChildren = scope.getCoveredResources(origin);
} else {
originChildren = Collections.emptyIterator();
}
final IResourceMatcher resourceMatcher = createResourceMatcher();
final Iterable<MatchResource> mappings = resourceMatcher.createMappings(leftChildren,
rightChildren, originChildren);
final List<Iterator<? extends EObject>> leftIterators = Lists.newLinkedList();
final List<Iterator<? extends EObject>> rightIterators = Lists.newLinkedList();
final List<Iterator<? extends EObject>> originIterators = Lists.newLinkedList();
for (MatchResource mapping : mappings) {
comparison.getMatchedResources().add(mapping);
final Resource leftRes = mapping.getLeft();
final Resource rightRes = mapping.getRight();
final Resource originRes = mapping.getOrigin();
if (leftRes != null) {
leftIterators.add(scope.getCoveredEObjects(leftRes));
}
if (rightRes != null) {
rightIterators.add(scope.getCoveredEObjects(rightRes));
}
if (originRes != null) {
originIterators.add(scope.getCoveredEObjects(originRes));
}
}
final Iterator<? extends EObject> leftEObjects = Iterators.concat(leftIterators.iterator());
final Iterator<? extends EObject> rightEObjects = Iterators.concat(rightIterators
.iterator());
final Iterator<? extends EObject> originEObjects = Iterators.concat(originIterators
.iterator());
getEObjectMatcher().createMatches(comparison, leftEObjects, rightEObjects, originEObjects,
monitor);
}
示例2: match
import org.eclipse.emf.compare.match.resource.IResourceMatcher; //导入依赖的package包/类
/**
* This will be used to match the given {@link ResourceSet}s. This default implementation will
* query the comparison scope for these resource sets children, then delegate to an
* {@link IResourceMatcher} to determine the resource mappings.
*
* The content of the matched resources is then pushed into the resource specific match method.<br>
*
* <b>Note:</b><br>
* In contrast to the DefaultMatchEngine, the match for eObjects recursively iterates through
* sub elements of the models. As a result, only the root elements of the resources are matched
* and not the plain list of all all contained elements.
*
* @param comparison
* The comparison to which will be added detected matches.
* @param scope
* The comparison scope that should be used by this engine to determine the objects
* to match.
* @param left
* The left {@link ResourceSet}.
* @param right
* The right {@link ResourceSet}.
* @param monitor
* The monitor to report progress or to check for cancellation
*/
protected void match(Comparison comparison, IComparisonScope scope, ResourceSet left, ResourceSet right,
Monitor monitor) {
final Iterator<? extends Resource> leftChildren = scope.getCoveredResources(left);
final Iterator<? extends Resource> rightChildren = scope.getCoveredResources(right);
final Iterator<? extends Resource> originChildren = Iterators.emptyIterator();
final IResourceMatcher matcher = createResourceMatcher();
final Iterable<MatchResource> mappings = matcher.createMappings(leftChildren, rightChildren, originChildren);
for (MatchResource mapping : mappings) {
comparison.getMatchedResources().add(mapping);
final Resource leftRes = mapping.getLeft();
final Resource rightRes = mapping.getRight();
match(comparison, leftRes, rightRes, monitor);
}
}
示例3: HierarchicalMatchEngineFactory
import org.eclipse.emf.compare.match.resource.IResourceMatcher; //导入依赖的package包/类
/**
* Constructor to set the required match engine dependencies.
*
* @param equalityHelper
* The equality helper to wire with the comparison model.
* @param equalityStrategy
* The equality strategy to use for element matching.
* @param ignoreStrategy
* The strategy to use to ignore elements.
* @param resourceMatcher
* The resource matcher to identify matching resources.
*/
public HierarchicalMatchEngineFactory(IEqualityHelper equalityHelper,
EqualityStrategy equalityStrategy, IgnoreStrategy ignoreStrategy,
IResourceMatcher resourceMatcher) {
this.equalityHelper = equalityHelper;
this.equalityStrategy = equalityStrategy;
this.ignoreStrategy = ignoreStrategy;
this.resourceMatcher = resourceMatcher;
}
示例4: HierarchicalMatchEngine
import org.eclipse.emf.compare.match.resource.IResourceMatcher; //导入依赖的package包/类
/**
* Constructor to set the required dependencies.
*
* @param equalityHelper
* The equality helper to check equality and to be wired with the comparison model.
* @param equalityStrategy
* The equality strategy to use.
* @param ignoreStrategy
* the strategy which elements must not be matched and can be ignored.
* @param resourceMatcher
* The matcher to decide if two resources belong to each other.
*/
public HierarchicalMatchEngine(IEqualityHelper equalityHelper, EqualityStrategy equalityStrategy,
IgnoreStrategy ignoreStrategy, IResourceMatcher resourceMatcher) {
this.equalityHelper = equalityHelper;
this.equalityStrategy = equalityStrategy;
this.ignoreStrategy = ignoreStrategy;
this.resourceMatcher = resourceMatcher;
}
示例5: createResourceMatcher
import org.eclipse.emf.compare.match.resource.IResourceMatcher; //导入依赖的package包/类
/**
* This will be used to create the resource matcher that will be used by this match engine.
*
* @return An {@link IResourceMatcher} that can be used to retrieve the {@link MatchResource}s
* for this comparison.
*/
protected IResourceMatcher createResourceMatcher() {
return resourceMatcher;
}