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

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


    }

    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

     *            operation to create the source code change
     * @return the insert source code changes from the insert operation
     */
    public Insert createInsertOperation(StructureEntityVersion structureEntity, InsertOperation insert) {
        if (isUsableForChangeExtraction(insert.getNodeToInsert())) {
            SourceCodeEntity parent = insert.getParentNode().getEntity();
            return new Insert(structureEntity, insert.getNodeToInsert().getEntity(), parent);
        }
        return null;
    }
View Full Code Here

     *            operation to create the source code change
     * @return the delete source code changes from the delete operation
     */
    public Delete createDeleteOperation(StructureEntityVersion structureEntity, DeleteOperation delete) {
        if (isUsableForChangeExtraction(delete.getNodeToDelete())) {
            SourceCodeEntity parent = delete.getParentNode().getEntity();
            return new Delete(structureEntity, delete.getNodeToDelete().getEntity(), parent);
        }
        return null;
    }
View Full Code Here

     *            operation to create the source code
     * @return the insert source code changes from the update operation
     */
    public Update createUpdateOperation(StructureEntityVersion structureEntity, UpdateOperation update) {
        if (isUsableForChangeExtraction(update.getNodeToUpdate())) {
            SourceCodeEntity entity =
                    new SourceCodeEntity(update.getOldValue(), update.getNodeToUpdate().getEntity().getType(), update
                            .getNodeToUpdate().getEntity().getModifiers(), update.getNodeToUpdate().getEntity()
                            .getSourceRange());
            return new Update(structureEntity, entity, update.getNewNode().getEntity(), ((Node) update
                    .getNodeToUpdate().getParent()).getEntity());
        }
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.SINGLE_TYPE));
      } else {
        fail("Should be Update but was " + singleChange.getClass());
      }
    }
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.POSTFIX_EXPRESSION));
      } else {
        fail("Should be Update but was " + singleChange.getClass());
      }
    }
View Full Code Here

     
      SourceCodeChange singleChange = changes.get(0);
     
      if(singleChange instanceof Insert) {
        Insert insert = (Insert) singleChange;
        SourceCodeEntity entity = insert.getChangedEntity();
        assertThat((JavaEntityType) entity.getType(), is(JavaEntityType.POSTFIX_EXPRESSION));
      } else {
        fail("Should be Insert but was " + singleChange.getClass());
      }
    }
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

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.