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

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


     * @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


      assertThat(changes.size(), is(1));
     
      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

        return fChanges;
    }

    private void processChanges(StructureDiffNode diffNode) {
        if (diffNode.isAddition()) {
            Insert insert =
                    new Insert(fRootEntity, fRightASTHelper.createSourceCodeEntity(diffNode.getRight()), fParentEntity);
            fRefactoringContainer.addCandidate(new RefactoringCandidate(insert, diffNode));
        } else if (diffNode.isDeletion()) {
            Delete delete =
                    new Delete(fRootEntity, fLeftASTHelper.createSourceCodeEntity(diffNode.getLeft()), fParentEntity);
            fRefactoringContainer.addCandidate(new RefactoringCandidate(delete, diffNode));
View Full Code Here

        splitOperations(sourceCodeChanges);
       
        fInsertsToDelete = new LinkedList<Insert>();
        SourceCodeChange scc = null;
        for (Iterator<Insert> it = fInserts.iterator(); it.hasNext();) {
            Insert ins = it.next();
            if (!fInsertsToDelete.contains(ins)) {
                scc = classify(ins);
                if ((scc != null) && !classifiedChanges.contains(scc)) {
                    classifiedChanges.add(scc);
                    it.remove();
View Full Code Here

                    result = insert;
                } else {

                    // WTF how to remove the insert?

                    Insert i =
                            findInsertOperation(insert.getRootEntity().getType(), insert.getRootEntity()
                                    .getUniqueName(), insert.getChangedEntity().getType(), insert.getChangedEntity()
                                    .getUniqueName(), null, null);
                    if (i == null) {
                        insert.setChangeType(ChangeType.PARAMETER_INSERT);
                        result = insert;
                    } else {
                        result =
                                new Update(
                                        insert.getRootEntity(),
                                        dell.getChangedEntity(),
                                        i.getChangedEntity(),
                                        insert.getChangedEntity());
                        result.setChangeType(ChangeType.PARAMETER_TYPE_CHANGE);
                        fDeletes.remove(del);
                        fDeletes.remove(dell);
                        fInsertsToDelete.add(i);
View Full Code Here

        } else if (delete.getChangedEntity().getUniqueName().equals(PRIVATE)) {
            result = extractIncreasingAccessibilityChange(delete);
        } else if (delete.getChangedEntity().getUniqueName().equals(PUBLIC)) {
            result = extractDecreasingAccessibilityChange(delete);
        } else if (delete.getChangedEntity().getUniqueName().equals(PROTECTED)) {
            Insert insPublic =
                    findInsertOperation(
                            delete.getRootEntity().getType(),
                            delete.getRootEntity().getUniqueName(),
                            JavaEntityType.MODIFIERS,
                            "",
                            JavaEntityType.MODIFIER,
                            PUBLIC);
            Insert insPrivate =
                    findInsertOperation(
                            delete.getRootEntity().getType(),
                            delete.getRootEntity().getUniqueName(),
                            JavaEntityType.MODIFIERS,
                            "",
View Full Code Here

    private SourceCodeChange extractDecreasingAccessibilityChange(Delete delete) {
        delete.setChangeType(ChangeType.DECREASING_ACCESSIBILITY_CHANGE);
        SourceCodeChange result;

        Insert insProtected =
                findInsertOperation(
                        delete.getRootEntity().getType(),
                        delete.getRootEntity().getUniqueName(),
                        JavaEntityType.MODIFIERS,
                        "",
                        JavaEntityType.MODIFIER,
                        PROTECTED);
        Insert insPrivate =
                findInsertOperation(
                        delete.getRootEntity().getType(),
                        delete.getRootEntity().getUniqueName(),
                        JavaEntityType.MODIFIERS,
                        "",
                        JavaEntityType.MODIFIER,
                        PRIVATE);
        if (insProtected != null) {
            result =
                    new Update(
                            delete.getRootEntity(),
                            delete.getChangedEntity(),
                            insProtected.getChangedEntity(),
                            insProtected.getParentEntity());
            fInserts.remove(insProtected);
        } else if (insPrivate != null) {
            result =
                    new Update(
                            delete.getRootEntity(),
                            delete.getChangedEntity(),
                            insPrivate.getChangedEntity(),
                            insPrivate.getParentEntity());
            fInserts.remove(insPrivate);
        } else {
            result = delete;
        }
        result.setChangeType(ChangeType.DECREASING_ACCESSIBILITY_CHANGE);
View Full Code Here

    private SourceCodeChange extractIncreasingAccessibilityChange(Delete delete) {
        delete.setChangeType(ChangeType.INCREASING_ACCESSIBILITY_CHANGE);
        SourceCodeChange result;

        Insert insProtected =
                findInsertOperation(
                        delete.getRootEntity().getType(),
                        delete.getRootEntity().getUniqueName(),
                        JavaEntityType.MODIFIERS,
                        "",
                        JavaEntityType.MODIFIER,
                        PROTECTED);
        findInsertOperation(
                delete.getRootEntity().getType(),
                delete.getRootEntity().getUniqueName(),
                JavaEntityType.MODIFIERS,
                "",
                JavaEntityType.MODIFIER,
                PUBLIC);
        if (insProtected != null) {
            result =
                    new Update(
                            delete.getRootEntity(),
                            delete.getChangedEntity(),
                            insProtected.getChangedEntity(),
                            insProtected.getParentEntity());
            result.setChangeType(ChangeType.INCREASING_ACCESSIBILITY_CHANGE);
            fInserts.remove(insProtected);
        } else {
            result = delete;
        }
View Full Code Here

            } else {
                if (upd.getNewEntity().getUniqueName().endsWith(VOID_RETURN)) {
                    result = new Delete(upd.getRootEntity(), upd.getChangedEntity(), upd.getParentEntity());
                    result.setChangeType(ChangeType.RETURN_TYPE_DELETE);
                } else if (upd.getChangedEntity().getUniqueName().endsWith(VOID_RETURN)) {
                    result = new Insert(upd.getRootEntity(), upd.getNewEntity(), upd.getParentEntity());
                    result.setChangeType(ChangeType.RETURN_TYPE_INSERT);
                } else {
                    upd.setChangeType(ChangeType.RETURN_TYPE_CHANGE);
                    result = upd;
                }
View Full Code Here

TOP

Related Classes of ch.uzh.ifi.seal.changedistiller.model.entities.Insert

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.