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

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


     *
     * @param operation
     *            to convert
     */
    public void addTreeEditOperationAsSourceCodeChange(TreeEditOperation operation) {
        SourceCodeChange scc = null;
        switch (operation.getOperationType()) {
            case INSERT:
                scc = fSourceCodeChangeFactory.createInsertOperation(fStructureEntity, (InsertOperation) operation);
                break;
            case DELETE:
View Full Code Here


      assertThat(distiller.getSourceCodeChanges(), is(not(nullValue())));
     
      List<SourceCodeChange> changes = distiller.getSourceCodeChanges();
      assertThat(changes.size(), is(1));
     
      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

      assertThat(distiller.getSourceCodeChanges(), is(not(nullValue())));
     
      List<SourceCodeChange> changes = distiller.getSourceCodeChanges();
      assertThat(changes.size(), is(1));
     
      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

      assertThat(distiller.getSourceCodeChanges(), is(not(nullValue())));
     
      List<SourceCodeChange> changes = distiller.getSourceCodeChanges();
      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

      distiller.extractClassifiedSourceCodeChanges(rootLeft, rootRight);
     
      List<SourceCodeChange> changes = structureEntity.getSourceCodeChanges();
      assertThat(changes.size(), is(1));
     
      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

      List<SourceCodeChange> classifiedChanges = new LinkedList<SourceCodeChange>();
     
        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)) {
View Full Code Here

        return classifiedChanges;
    }

    private SourceCodeChange classify(Insert insert) {
        SourceCodeChange result = null;

        if (insert.getChangeType() != ChangeType.UNCLASSIFIED_CHANGE) {
            return insert;
        }
View Full Code Here

        }
        return result;
    }

    private SourceCodeChange handleInheritanceChange(Insert insert) {
        SourceCodeChange result = null;
        if (insert.getChangedEntity().getType().isType()) {
            if (insert.getParentEntity().getType() == JavaEntityType.SUPER_INTERFACE_TYPES) {
                insert.setChangeType(ChangeType.PARENT_INTERFACE_INSERT);
                result = insert;
            } else {
                boolean check = true;
                Delete del = null;
                for (Iterator<Delete> it = fDeletes.iterator(); it.hasNext() && check;) {
                    del = it.next();
                    if ((del.getRootEntity().getType() == JavaEntityType.CLASS)
                            && (del.getParentEntity().getType() != JavaEntityType.SUPER_INTERFACE_TYPES)
                            && del.getChangedEntity().getType().isType()) {
                        check = false;
                    }
                }
                if (check) {
                    insert.setChangeType(ChangeType.PARENT_CLASS_INSERT);
                    result = insert;
                } else {
                    result =
                            new Update(
                                    insert.getRootEntity(),
                                    del.getChangedEntity(),
                                    insert.getChangedEntity(),
                                    insert.getParentEntity());
                    result.setChangeType(ChangeType.PARENT_CLASS_CHANGE);
                    fDeletes.remove(del);
                }
            }
        }
        return result;
View Full Code Here

        }
        return result;
    }

    private SourceCodeChange handleFieldDeclarationChange(Insert insert) {
        SourceCodeChange result = null;
        // may lead to incorrect result (never happened so far); better: check for each
        // possible kind of type
        if (insert.getChangedEntity().getType().isType()) {
            Delete del =
                    findSpDeleteOperation(
                            insert.getRootEntity().getType(),
                            insert.getRootEntity().getUniqueName(),
                            insert.getParentEntity().getType(),
                            insert.getParentEntity().getUniqueName());
            if (del != null) {
                result =
                        new Update(
                                insert.getRootEntity(),
                                del.getChangedEntity(),
                                insert.getChangedEntity(),
                                insert.getParentEntity());
                fDeletes.remove(del);
                result.setChangeType(ChangeType.ATTRIBUTE_TYPE_CHANGE);
            }
        } else if (insert.getChangedEntity().getType() == JavaEntityType.JAVADOC) {
            Delete del =
                    findDeleteOperation(
                            insert.getRootEntity().getType(),
                            insert.getRootEntity().getUniqueName(),
                            insert.getParentEntity().getType(),
                            insert.getParentEntity().getUniqueName(),
                            insert.getChangedEntity().getType(),
                            null);
            if (del != null) {
                result =
                        new Update(
                                insert.getRootEntity(),
                                del.getChangedEntity(),
                                insert.getChangedEntity(),
                                insert.getParentEntity());
                result.setChangeType(ChangeType.DOC_UPDATE);
                fDeletes.remove(del);
            } else {
                insert.setChangeType(ChangeType.DOC_INSERT);
                result = insert;
            }
View Full Code Here

        }
        return result;
    }

    private SourceCodeChange handleFieldDeclarationChange(Delete delete) {
        SourceCodeChange result = null;
        if (delete.getChangedEntity().getType() == JavaEntityType.JAVADOC) {
            delete.setChangeType(ChangeType.DOC_DELETE);
            result = delete;
        }
        return result;
View Full Code Here

TOP

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

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.