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

Examples of ch.uzh.ifi.seal.changedistiller.model.classifiers.SourceRange


    }

    public Node convertMethodBody(String methodName, JavaCompilation compilation) {
        AbstractMethodDeclaration method = CompilationUtils.findMethod(compilation.getCompilationUnit(), methodName);
        Node root = new Node(JavaEntityType.METHOD, methodName);
        root.setEntity(new SourceCodeEntity(methodName, JavaEntityType.METHOD, new SourceRange(
                method.declarationSourceStart,
                method.declarationSourceEnd)));
        List<Comment> comments = CompilationUtils.extractComments(compilation);
        sMethodBodyConverter.initialize(root, method, comments, compilation.getScanner());
        method.traverse(sMethodBodyConverter, (ClassScope) null);
View Full Code Here


    }

    public Node convertMethodDeclaration(String methodName, JavaCompilation compilation) {
        AbstractMethodDeclaration method = CompilationUtils.findMethod(compilation.getCompilationUnit(), methodName);
        Node root = new Node(JavaEntityType.METHOD, methodName);
        root.setEntity(new SourceCodeEntity(methodName, JavaEntityType.METHOD, new SourceRange(
                method.declarationSourceStart,
                method.declarationSourceEnd)));
        sDeclarationConverter.initialize(root, compilation.getScanner());
        method.traverse(sDeclarationConverter, (ClassScope) null);
        return root;
View Full Code Here

    }

    public Node convertFieldDeclaration(String fieldName, JavaCompilation compilation) {
      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 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

        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

        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

    }

    private SourceRange createSourceRange(ASTNode astNode) {
        if (astNode instanceof TypeDeclaration) {
            TypeDeclaration type = (TypeDeclaration) astNode;
            return new SourceRange(type.declarationSourceStart, type.declarationSourceEnd);
        }
        if (astNode instanceof AbstractMethodDeclaration) {
            AbstractMethodDeclaration method = (AbstractMethodDeclaration) astNode;
            return new SourceRange(method.declarationSourceStart, method.declarationSourceEnd);
        }
        if (astNode instanceof FieldDeclaration) {
            FieldDeclaration field = (FieldDeclaration) astNode;
            return new SourceRange(field.declarationSourceStart, field.declarationSourceEnd);
        }
        return new SourceRange(astNode.sourceStart(), astNode.sourceEnd());
    }
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.classifiers.SourceRange

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.