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


Java IResourceMatcher.createMappings方法代码示例

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


在下文中一共展示了IResourceMatcher.createMappings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:58,代码来源:LazyMatchEngine.java

示例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);

    }
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:44,代码来源:HierarchicalMatchEngine.java


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