• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Diff类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.emf.compare.Diff的典型用法代码示例。如果您正苦于以下问题:Java Diff类的具体用法?Java Diff怎么用?Java Diff使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Diff类属于org.eclipse.emf.compare包,在下文中一共展示了Diff类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: hasDiffForFeature

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Tells if there is a difference in the given {@link Match} for the given {@link EStructuralFeature}.
 * 
 * @param match
 *            the {@link Match}
 * @param feature
 *            the {@link EStructuralFeature}
 * @return <code>true</code> if there is a difference in the given {@link Match} for the given
 *         {@link EStructuralFeature}, <code>false</code> otherwise
 */
protected boolean hasDiffForFeature(Match match, EStructuralFeature feature) {
	boolean res = false;

	for (Diff diff : match.getDifferences()) {
		if (diff instanceof AttributeChange) {
			if (((AttributeChange)diff).getAttribute() == feature) {
				res = true;
				break;
			}
		} else if (diff instanceof ReferenceChange) {
			if (((ReferenceChange)diff).getReference() == feature) {
				res = true;
				break;
			}
		}
	}

	return res;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:30,代码来源:EObjectConnector.java


示例2: postComparison

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
@Override
public void postComparison(Comparison comparison, Monitor monitor) {
	for (Diff diff : comparison.getDifferences()) {
		if (diff instanceof EdgeChange) {
			EdgeChange edgeChange = (EdgeChange) diff;
			switch (edgeChange.getKind()) {
			case ADD:
				postProcessEdgeAddition(edgeChange);
				break;
			case DELETE:
				postProcessEdgeDeletion(edgeChange);
				break;
			default: // do nothing
			}

		}
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:EdgeChangePostProcessor.java


示例3: postProcessEdgeAddition

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * In this case by default following dependencies are created:<br>
 * <br>
 * EdgeDeletion --requires-> OutgoingTransitionDeletion <-requires--
 * IncomingTransitionDeletion<br>
 * <br>
 * Needs to be changed into:<br>
 * <br>
 * EdgeDeletion --requires-> IncomingTransitionDeletion --requires->
 * OutgoingTransitionDeletion<br>
 * 
 * @param edgeChange
 */
private void postProcessEdgeAddition(EdgeChange edgeChange) {
	Set<Diff> requiredIncomingTransitionAdditions = new HashSet<Diff>();
	for (Diff requireds : edgeChange.getRequires()) {
		if (requireds instanceof ReferenceChange) {
			ReferenceChange requiredRefChange = (ReferenceChange) requireds;
			// for required changes in outgoing transition refs we also need
			// to add the corresponding change in incoming transition refs
			if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS
					&& requiredRefChange.getKind() == DifferenceKind.ADD) {
				requiredIncomingTransitionAdditions
						.addAll(findRequiredIncomingTransitionRefChange(
								requiredRefChange, DifferenceKind.ADD));
			}
		}
	}
	edgeChange.getRequires().addAll(requiredIncomingTransitionAdditions);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:31,代码来源:EdgeChangePostProcessor.java


示例4: postProcessEdgeDeletion

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * In this case by default following dependencies are created:<br>
 * <br>
 * EdgeDeletion <-requires-- OutgoingTransitionDeletion --requires->
 * IncomingTransitionDeletion<br>
 * <br>
 * Needs to be changed into:<br>
 * <br>
 * EdgeDeletion --requires-> OutgoingTransitionDeletion --requires->
 * IncomingTransitionDeletion<br>
 * 
 * @param edgeChange
 */
private void postProcessEdgeDeletion(EdgeChange edgeChange) {
	Set<Diff> requiredOutgoingTransitionDeletions = new HashSet<Diff>();
	for (Diff requireds : edgeChange.getRequiredBy()) {
		if (requireds instanceof ReferenceChange) {
			ReferenceChange requiredRefChange = (ReferenceChange) requireds;
			// for required changes in outgoing transition refs we also need
			// to add the corresponding change in incoming transition refs
			if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS
					&& requiredRefChange.getKind() == DifferenceKind.DELETE) {
				requiredOutgoingTransitionDeletions.add(requiredRefChange);
			}
		}
	}
	edgeChange.getRequires().addAll(requiredOutgoingTransitionDeletions);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:29,代码来源:EdgeChangePostProcessor.java


示例5: prettyPrintCustom

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
private static String prettyPrintCustom(Diff diff) {
    CompareSwitch<String> printer = new CompareSwitch<String>() {

        @Override
        public String caseReferenceChange(ReferenceChange object) {
            EObject actual = object.getMatch().getRight();
            EObject expected = object.getMatch().getLeft();
            EReference reference = object.getReference();

            if (actual != null && expected != null) {
                EObject parent = actual;
                String referenceName = String.format("%s::%s", reference.getEContainingClass().getName(),
                        object.getReference().getName());
                Object actualValue = actual.eGet(reference);
                Object expectedValue = expected.eGet(reference);

                return String.format(
                        "ReferenceChange%n\tParent: %s%n\tReference: %s%n\tExpected Value: %s%n\tActual Value: %s",
                        parent, referenceName, expectedValue, actualValue);
            }
            return defaultCase(object);
        }

    };
    return printer.doSwitch(diff);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:27,代码来源:PlainTransformationTestBase.java


示例6: testRegular

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
protected void testRegular(String modelName, Function<Collection<Diff>, Collection<Diff>> diffProcessor)
        throws Exception {
    URI sourceModelURI = createResourceModelURI(resourcePluginId, modelName + "." + sourceFileExtension);
    URI umlModelURI = createResourceModelURI(resourcePluginId, modelName + ".uml");
    URI resultModelURI = createResourceModelURI(resourcePluginId, modelName + "." + targetFileExtension);

    ModelExtent transformationResult = runTransformation(transformationURI, sourceModelURI, umlModelURI);

    EObject expected = getRootElement(resultModelURI);
    assertEquals(1, transformationResult.getContents().size());
    EObject actual = transformationResult.getContents().get(0);
    EcoreUtil.resolveAll(getResourceSet());

    debugSerialize(expected, actual);

    assertModelEquals(expected, actual, diffProcessor);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:DirectionalTransformationTestBase.java


示例7: testArrayFieldDeclarationDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test diffing of changed array field declarations.
 *
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testArrayFieldDeclarationDiff() throws Exception {

    TestUtil.setUp();
    File testFileA = new File(basePathA + "ArrayFieldDeclarationChange.java");
    File testFileB = new File(basePathB + "ArrayFieldDeclarationChange.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("1 difference should be detected", differences.size(), is(1));
    FieldChange change = (FieldChange) differences.get(0);
    assertThat("Wrong diff kind", change.getKind(), is(DifferenceKind.CHANGE));
    assertThat("Diff should be FieldChange", change, is(instanceOf(FieldChange.class)));
    Field field = change.getChangedField();
    assertThat("Wrong field name", field.getName(), is("newValueArray"));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:28,代码来源:FieldDeclarationTest.java


示例8: testNewInTheMiddleDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test new field declarations to ignore field order.
 *
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testNewInTheMiddleDiff() throws Exception {

    TestUtil.setUp();
    File testFileA = new File(basePathA + "NewInTheMiddle.java");
    File testFileB = new File(basePathB + "NewInTheMiddle.java");
    ResourceSet rsLeading = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsIntegration = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsLeading, rsIntegration, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("1 difference should be detected", differences.size(), is(1));
    FieldChange change = (FieldChange) differences.get(0);
    assertThat("Diff should be FieldChange", change, is(instanceOf(FieldChange.class)));
    assertThat("Wrong diff kind", change.getKind(), is(DifferenceKind.ADD));
    Field field = change.getChangedField();
    assertThat("Wrong field name", field.getName(), is("newField"));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:28,代码来源:FieldDeclarationTest.java


示例9: testRemovedFromTheMiddleDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test new field declarations to ignore field order.
 *
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testRemovedFromTheMiddleDiff() throws Exception {

    TestUtil.setUp();
    File testFileA = new File(basePathA + "RemovedFromTheMiddle.java");
    File testFileB = new File(basePathB + "RemovedFromTheMiddle.java");
    ResourceSet rsLeading = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsIntegration = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsLeading, rsIntegration, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("1 difference should be detected", differences.size(), is(1));
    FieldChange change = (FieldChange) differences.get(0);
    assertThat("Diff should be FieldChange", change, is(instanceOf(FieldChange.class)));
    assertThat("Wrong diff kind", change.getKind(), is(DifferenceKind.DELETE));
    Field field = change.getChangedField();
    assertThat("Wrong field name", field.getName(), is("removeField"));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:28,代码来源:FieldDeclarationTest.java


示例10: testPrimitivesDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test primitive declarations
 *
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testPrimitivesDiff() throws Exception {

    File testFileA = new File(basePath + "a/Primitives.java");
    File testFileB = new File(basePath + "b/Primitives.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(2));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:22,代码来源:PrimitivesTest.java


示例11: testDerivedCopyWithIgnoreImports

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test method to detect changes in the class and package declarations.
 *
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testDerivedCopyWithIgnoreImports() throws Exception {

    String basePath = "testmodels/implementation/derivedcopyimport/";
    ResourceSet setA = TestUtil.extractModel(basePath + "a");
    ResourceSet setB = TestUtil.extractModel(basePath + "b");

    StringBuilder packageMapping = new StringBuilder();

    StringBuilder classifierNormalization = new StringBuilder();
    classifierNormalization.append("*Custom");

    JaMoPPDiffer differ = new JaMoPPDiffer();

    Map<String, String> diffOptions = TestUtil.getDiffOptions();
    diffOptions.put(JaMoPPDiffer.OPTION_JAVA_PACKAGE_NORMALIZATION, packageMapping.toString());
    diffOptions.put(JaMoPPDiffer.OPTION_JAVA_CLASSIFIER_NORMALIZATION, classifierNormalization.toString());
    diffOptions.put(JaMoPPPostProcessor.OPTION_DIFF_CLEANUP_DERIVED_COPIES, "true");

    Comparison comparison = differ.doDiff(setA, setB, diffOptions);

    EList<Diff> differences = comparison.getDifferences();
    assertThat("No diff because not present imports must not be detected as deleted", differences.size(), is(0));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:31,代码来源:DerivedCopyTest.java


示例12: testDerivedCopyWithChangedMethodCounterpart

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test that the derived method delete is not filtered if anyway.
 *
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testDerivedCopyWithChangedMethodCounterpart() throws Exception {

    String basePath = "testmodels/implementation/derivedcopymethod/";
    ResourceSet setA = TestUtil.extractModel(basePath + "a");
    ResourceSet setB = TestUtil.extractModel(basePath + "b");

    StringBuilder packageMapping = new StringBuilder();

    StringBuilder classifierNormalization = new StringBuilder();
    classifierNormalization.append("*Custom");

    JaMoPPDiffer differ = new JaMoPPDiffer();

    Map<String, String> diffOptions = TestUtil.getDiffOptions();
    diffOptions.put(JaMoPPDiffer.OPTION_JAVA_PACKAGE_NORMALIZATION, packageMapping.toString());
    diffOptions.put(JaMoPPDiffer.OPTION_JAVA_CLASSIFIER_NORMALIZATION, classifierNormalization.toString());
    diffOptions.put(JaMoPPPostProcessor.OPTION_DIFF_CLEANUP_DERIVED_COPIES, "true");
    diffOptions.put(JaMoPPPostProcessor.OPTION_DIFF_CLEANUP_DERIVED_COPIES_CLEAN_METHODS, null);

    Comparison comparison = differ.doDiff(setA, setB, diffOptions);

    EList<Diff> differences = comparison.getDifferences();
    assertThat("Wrong number of differences", differences.size(), is(3));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:32,代码来源:DerivedCopyTest.java


示例13: testDerivedCopyWithIgnoreConstructor

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test that the derived method delete is not filtered if anyway.
 *
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testDerivedCopyWithIgnoreConstructor() throws Exception {

    String basePath = "testmodels/implementation/derivedcopyconstructor/";
    ResourceSet setA = TestUtil.extractModel(basePath + "a");
    ResourceSet setB = TestUtil.extractModel(basePath + "b");

    StringBuilder packageMapping = new StringBuilder();

    StringBuilder classifierNormalization = new StringBuilder();
    classifierNormalization.append("*Custom");

    JaMoPPDiffer differ = new JaMoPPDiffer();

    Map<String, String> diffOptions = TestUtil.getDiffOptions();
    diffOptions.put(JaMoPPDiffer.OPTION_JAVA_PACKAGE_NORMALIZATION, packageMapping.toString());
    diffOptions.put(JaMoPPDiffer.OPTION_JAVA_CLASSIFIER_NORMALIZATION, classifierNormalization.toString());
    diffOptions.put(JaMoPPPostProcessor.OPTION_DIFF_CLEANUP_DERIVED_COPIES, "true");

    Comparison comparison = differ.doDiff(setA, setB, diffOptions);

    EList<Diff> differences = comparison.getDifferences();
    assertThat("There should be no differences", differences.size(), is(0));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:31,代码来源:DerivedCopyTest.java


示例14: testArrayAccessesDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test diffing of changed array field declarations.
 * 
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testArrayAccessesDiff() throws Exception {

    File testFileA = new File(basePath + "a/ArrayAccesses.java");
    File testFileB = new File(basePath + "b/ArrayAccesses.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(0));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:22,代码来源:StatementTest.java


示例15: testArrayItemAccessesDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test diffing of changed array field declarations.
 * 
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testArrayItemAccessesDiff() throws Exception {

    File testFileA = new File(basePath + "a/ArrayItemAccess.java");
    File testFileB = new File(basePath + "b/ArrayItemAccess.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(1));

    StatementChange change = (StatementChange) differences.get(0);
    ExpressionStatement statement = (ExpressionStatement) change.getChangedStatement();
    AssignmentExpression exp = (AssignmentExpression) statement.getExpression();
    NewConstructorCall call = (NewConstructorCall) exp.getValue();
    StringReference stringRef = (StringReference) call.getArguments().get(0);
    assertThat(stringRef.getValue(), equalTo("3"));

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


示例16: testArrayItemAccessWithSameContainerIdentifierDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test diffing of array access by an identifier within the same container. This test case is
 * part of the fix for a bug causing a StackOverflowError (SPLEVO-427).
 * 
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testArrayItemAccessWithSameContainerIdentifierDiff() throws Exception {

    File testFileA = new File(basePath + "a/ArrayItemAccessWithSameContainerIdentifier.java");
    File testFileB = new File(basePath + "b/ArrayItemAccessWithSameContainerIdentifier.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(0));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:23,代码来源:StatementTest.java


示例17: testEnumAccessesDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test diffing of enum value accesses.
 * 
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testEnumAccessesDiff() throws Exception {

    File testFileA = new File(basePath + "a/EnumAccesses.java");
    File testFileB = new File(basePath + "b/EnumAccesses.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(0));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:22,代码来源:StatementTest.java


示例18: testClassStatementInsertDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test insertion of new statements and order changes
 * 
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testClassStatementInsertDiff() throws Exception {

    File testFileA = new File(basePath + "a/ClassStatementInsert.java");
    File testFileB = new File(basePath + "b/ClassStatementInsert.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(7));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:22,代码来源:StatementTest.java


示例19: testSynchronizedDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test insertion of new statements
 * 
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testSynchronizedDiff() throws Exception {

    File testFileA = new File(basePath + "a/Synchronized.java");
    File testFileB = new File(basePath + "b/Synchronized.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(1));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:22,代码来源:StatementTest.java


示例20: testIfStatementDiff

import org.eclipse.emf.compare.Diff; //导入依赖的package包/类
/**
 * Test insertion of new statements
 * 
 * @throws Exception
 *             Identifies a failed diffing.
 */
@Test
public void testIfStatementDiff() throws Exception {

    File testFileA = new File(basePath + "a/IfStatements.java");
    File testFileB = new File(basePath + "b/IfStatements.java");
    ResourceSet rsA = TestUtil.loadResourceSet(Sets.newHashSet(testFileA));
    ResourceSet rsB = TestUtil.loadResourceSet(Sets.newHashSet(testFileB));

    JaMoPPDiffer differ = new JaMoPPDiffer();
    Comparison comparison = differ.doDiff(rsA, rsB, TestUtil.getDiffOptions());

    EList<Diff> differences = comparison.getDifferences();

    assertThat("Wrong number of differences", differences.size(), is(4));
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:22,代码来源:StatementTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HiveAuthzPluginException类代码示例发布时间:2022-05-22
下一篇:
Java PBES2Parameters类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap