Package ch.uzh.ifi.seal.changedistiller.treedifferencing

Examples of ch.uzh.ifi.seal.changedistiller.treedifferencing.Node


        assertThat(move.getNewNode().getValue(), is(methodInvocation.getValue()));
    }

    @Test
    public void changedNodeShouldProduceUpdateOperation() throws Exception {
        Node methodInvocationLeft = addToLeft(METHOD_INVOCATION, "foo.bar();");
        Node methodInvocationRight = addToRight(METHOD_INVOCATION, "foo.beer();");
        createEditScript();
        assertThat(fEditScript.size(), is(1));
        TreeEditOperation operation = fEditScript.get(0);
        assertThat(operation.getOperationType(), is(OperationType.UPDATE));
        UpdateOperation update = (UpdateOperation) operation;
View Full Code Here


   
   
    @Test
  public void insertShouldWork() throws Exception {
      /* test case for https://bitbucket.org/sealuzh/tools-changedistiller/issue/1 */
    Node outerTryRight = addToRight(JavaEntityType.TRY_STATEMENT, "");
    Node innerTryRight = addToNode(outerTryRight,
        JavaEntityType.TRY_STATEMENT, "");
    createEditScript();
   
    assertThat(fEditScript.size(), is(2));
    TreeEditOperation firstOperation = fEditScript.get(0);
    assertThat(firstOperation.getOperationType(), is(OperationType.INSERT));
    InsertOperation firstInsert = (InsertOperation) firstOperation;
    assertThat(firstInsert.getNodeToInsert().getLabel(), is(outerTryRight.getLabel()));
    assertThat(firstInsert.getNodeToInsert().getValue(), is(outerTryRight.getValue()));

    TreeEditOperation secondOperation = fEditScript.get(1);
    assertThat(secondOperation.getOperationType(), is(OperationType.INSERT));
    InsertOperation insert = (InsertOperation) secondOperation;
    assertThat(insert.getNodeToInsert().getLabel(), is(innerTryRight.getLabel()));
    assertThat(insert.getNodeToInsert().getValue(), is(innerTryRight.getValue()));
   
    assertThat(((Node)insert.getNodeToInsert().getParent()).getLabel(), is(innerTryRight.getLabel()));
    assertThat(((Node)insert.getNodeToInsert().getParent()).getValue(), is(innerTryRight.getValue()));
  }
View Full Code Here

    }

    @Override
    public Node createDeclarationTree(JavaStructureNode node) {
        ASTNode astNode = node.getASTNode();
        Node root = createRootNode(node, astNode);
        return createDeclarationTree(astNode, root);
    }
View Full Code Here

    }

    @Override
    public Node createDeclarationTree(JavaStructureNode node, String qualifiedName) {
        ASTNode astNode = node.getASTNode();
        Node root = createRootNode(node, astNode);
        root.setValue(qualifiedName);
        return createDeclarationTree(astNode, root);
    }
View Full Code Here

        root.setValue(qualifiedName);
        return createDeclarationTree(astNode, root);
    }

    private Node createRootNode(JavaStructureNode node, ASTNode astNode) {
        Node root = new Node(fASTHelper.convertNode(astNode), node.getFullyQualifiedName());
        root.setEntity(createSourceCodeEntity(node));
        return root;
    }
View Full Code Here

    @Override
    public Node createMethodBodyTree(JavaStructureNode node) {
        ASTNode astNode = node.getASTNode();
        if (astNode instanceof AbstractMethodDeclaration) {
            Node root = createRootNode(node, astNode);
            fBodyConverter.initialize(root, astNode, fComments, fCompilation.getScanner());
            ((AbstractMethodDeclaration) astNode).traverse(fBodyConverter, (ClassScope) null);
            return root;
        }
        return null;
View Full Code Here

    private void pushEmptyNode(ASTNode node) {
        push(fASTHelper.convertNode(node), "", node.sourceStart(), node.sourceEnd());
    }

    private void push(EntityType label, String value, int start, int end) {
        Node n = new Node(label, value.trim());
        n.setEntity(new SourceCodeEntity(value.trim(), label, new SourceRange(start, end)));
        getCurrentParent().add(n);
        fNodeStack.push(n);
    }
View Full Code Here

TOP

Related Classes of ch.uzh.ifi.seal.changedistiller.treedifferencing.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.