Package ch.uzh.ifi.seal.changedistiller.model.entities

Examples of ch.uzh.ifi.seal.changedistiller.model.entities.SourceCodeEntity


    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


            assertThat(modifier.getLabel(), is(JavaEntityType.MODIFIER));
        }
    }

    private String getSource(Node node) {
        SourceCodeEntity entity = node.getEntity();
        return fCompilation.getSource().substring(entity.getStartPosition(), entity.getEndPosition() + 1);
    }
View Full Code Here

     
      SourceCodeChange singleChange = changes.get(0);
     
      if(singleChange instanceof Update) {
        Update update = (Update) singleChange;
        SourceCodeEntity entity = update.getNewEntity();
        assertThat((JavaEntityType) entity.getType(), is(JavaEntityType.ARRAY_TYPE));
      } else {
        fail("Should be Update but was " + singleChange.getClass());
      }
    }
View Full Code Here

        MatcherAssert.assertThat(actual, matcher);
    }

    protected void createRootNode(EntityType label, String value) {
        fRoot = new Node(label, value);
        fRoot.setEntity(new SourceCodeEntity(value, label, new SourceRange()));
    }
View Full Code Here

        for (Comment comment : comments) {
            visitor.process(comment);
        }
        sComments = visitor.getComments();
        sRoot = new Node(JavaEntityType.METHOD, "foo");
        sRoot.setEntity(new SourceCodeEntity("foo", JavaEntityType.METHOD, new SourceRange()));
        AbstractMethodDeclaration method = CompilationUtils.findMethod(sCompilation.getCompilationUnit(), "foo");
        JavaMethodBodyConverter bodyT = sInjector.getInstance(JavaMethodBodyConverter.class);
        bodyT.initialize(sRoot, method, sComments, sCompilation.getScanner());
        method.traverse(bodyT, (ClassScope) null);
    }
View Full Code Here

        }
        pop();
    }

    private void setSourceRange(Node modifiers) {
        SourceCodeEntity firstModifier = ((Node) modifiers.getFirstLeaf()).getEntity();
        SourceCodeEntity lastModifier = ((Node) modifiers.getLastLeaf()).getEntity();
        modifiers.getEntity().setStartPosition(firstModifier.getStartPosition());
        modifiers.getEntity().setEndPosition(lastModifier.getEndPosition());
    }
View Full Code Here

        push(fASTHelper.convertNode(node), value, 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

        return fASTHelper.convertNode(node.getASTNode());
    }

    @Override
    public SourceCodeEntity createSourceCodeEntity(JavaStructureNode node) {
        return new SourceCodeEntity(
                node.getFullyQualifiedName(),
                convertType(node),
                extractModifier(node.getASTNode()),
                createSourceRange(node.getASTNode()));
    }
View Full Code Here

    private void assertSourceRangeCorrectness() {
        assertSourceRangeCorrectness(getFirstLeaf());
    }

    private void assertSourceRangeCorrectness(Node node) {
        SourceCodeEntity entity = node.getEntity();
        String source = fCompilation.getSource().substring(entity.getStartPosition(), entity.getEndPosition() + 1);
        assertThat(source, is(fSnippet));
    }
View Full Code Here

        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.model.entities.SourceCodeEntity

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.