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

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


    private int numberOfCommentNodes(Node node) {
        int count = 0;

        Enumeration<Node> nodes = node.breadthFirstEnumeration();
        while (nodes.hasMoreElements()) {
            Node child = nodes.nextElement();
            if (isComment(child)) {
                count++;
            }
        }
View Full Code Here


    protected Node fRootLeft;
    protected Node fRootRight;

    @Before
    public void setup() throws Exception {
        fRootLeft = new Node(JavaEntityType.ROOT_NODE, "method()");
        fRootRight = new Node(JavaEntityType.ROOT_NODE, "method()");
    }
View Full Code Here

    protected Node addToRight(EntityType label, String value) {
        return addToNode(fRootRight, label, value);
    }

    protected Node addToNode(Node root, EntityType label, String value) {
        Node node = new Node(label, value);
        root.add(node);
        return node;
    }
View Full Code Here

    }

    private Node convertFieldDeclaration(String fieldName, String sourceCode) {
        JavaCompilation compilation = CompilationUtils.compileSource(sourceCode);
        FieldDeclaration field = CompilationUtils.findField(compilation.getCompilationUnit(), fieldName);
        Node root = new Node(JavaEntityType.FIELD, fieldName);
        root.setEntity(new SourceCodeEntity(fieldName, JavaEntityType.FIELD, new SourceRange(
                field.declarationSourceStart,
                field.declarationSourceEnd)));
        sDeclarationConverter.initialize(root, compilation.getScanner());
        field.traverse(sDeclarationConverter, (MethodScope) null);
        return root;
View Full Code Here

    }

    private Node convertClassDeclaration(String className, String sourceCode) {
        JavaCompilation compilation = CompilationUtils.compileSource(sourceCode);
        TypeDeclaration type = CompilationUtils.findType(compilation.getCompilationUnit(), className);
        Node root = new Node(JavaEntityType.CLASS, className);
        root.setEntity(new SourceCodeEntity(className, JavaEntityType.CLASS, new SourceRange(
                type.declarationSourceStart,
                type.declarationSourceEnd)));
        sDeclarationConverter.initialize(root, compilation.getScanner());
        type.traverse(sDeclarationConverter, (ClassScope) null);
        return root;
View Full Code Here

        type.traverse(sDeclarationConverter, (ClassScope) null);
        return root;
    }

    private void extractClassDeclarationChanges(String className) {
        Node leftDeclaration = convertClassDeclaration(className, fLeftSnippet);
        Node rootDeclaration = convertClassDeclaration(className, fRightSnippet);
        structureEntity = new StructureEntityVersion(JavaEntityType.CLASS, className, 0);
        distill(leftDeclaration, rootDeclaration);
    }
View Full Code Here

        structureEntity = new StructureEntityVersion(JavaEntityType.CLASS, className, 0);
        distill(leftDeclaration, rootDeclaration);
    }

    private void extractFieldDeclarationChanges(String fieldName) {
        Node leftDeclaration = convertFieldDeclaration(fieldName, fLeftSnippet);
        Node rootDeclaration = convertFieldDeclaration(fieldName, fRightSnippet);
        structureEntity = new StructureEntityVersion(JavaEntityType.FIELD, fieldName, 0);
        distill(leftDeclaration, rootDeclaration);
    }
View Full Code Here

        structureEntity = new StructureEntityVersion(JavaEntityType.FIELD, fieldName, 0);
        distill(leftDeclaration, rootDeclaration);
    }

    private void extractMethodDeclarationChanges(String methodName) {
        Node leftDeclaration = convertMethodDeclaration(methodName, fLeftSnippet);
        Node rootDeclaration = convertMethodDeclaration(methodName, fRightSnippet);
        structureEntity = new StructureEntityVersion(JavaEntityType.METHOD, methodName, 0);
        distill(leftDeclaration, rootDeclaration);
    }
View Full Code Here

        structureEntity = new StructureEntityVersion(JavaEntityType.METHOD, methodName, 0);
        distill(leftDeclaration, rootDeclaration);
    }

    private void extractMethodChanges(String methodName) {
        Node leftMethod = convertMethodBody(methodName, fLeftSnippet);
        Node rightMethod = convertMethodBody(methodName, fRightSnippet);
        structureEntity = new StructureEntityVersion(JavaEntityType.METHOD, methodName, 0);
        distill(leftMethod, rightMethod);
    }
View Full Code Here

        fSnippet = "private String fField;";
        prepareCompilation();
        convertField("fField");
        assertThat(getTreeString(), is("fField {  { private },String }"));
        assertModifiersCorrectness(getFirstChild(), "private");
        Node type = getFieldType();
        assertThat(getSource(type), is("String"));
        assertThat(type.getLabel(), is(JavaEntityType.SINGLE_TYPE));
    }
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.