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

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


        }
        return result;
    }

    private SourceCodeChange classify(Delete delete) {
        SourceCodeChange result = null;

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


        }
        return delete;
    }

    private SourceCodeChange extractModifiersChange(Delete delete) {
        SourceCodeChange result = delete;

        if (delete.getChangedEntity().getUniqueName().equals(FINAL)) {
            return handleFinalChange(delete);
        } else if (delete.getChangedEntity().getUniqueName().equals(PRIVATE)) {
            result = extractIncreasingAccessibilityChange(delete);
View Full Code Here

        return result;
    }

    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);
        return result;
    }
View Full Code Here

        return result;
    }

    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;
        }
        return result;
View Full Code Here

        }
        return delete;
    }

    private SourceCodeChange handleNormalDelete(Delete delete) {
        SourceCodeChange result = null;
        if (delete.getChangedEntity().getType() == JavaEntityType.ELSE_STATEMENT) {
            delete.setChangeType(ChangeType.ALTERNATIVE_PART_DELETE);
            result = delete;
        } else if ((delete.getChangedEntity().getType() == JavaEntityType.BLOCK_COMMENT)
                || (delete.getChangedEntity().getType() == JavaEntityType.LINE_COMMENT)) {
View Full Code Here

        }
        return result;
    }

    private SourceCodeChange classify(Move move) {
        SourceCodeChange result = null;

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

        }
        return move;
    }

    private SourceCodeChange handleNormalMove(Move move) {
        SourceCodeChange result = null;
        if (move.getChangedEntity().getType().isStatement()) {
            if (move.getParentEntity().getUniqueName().equals(move.getNewParentEntity().getUniqueName())
                    && (move.getParentEntity().getType() == move.getNewParentEntity().getType())) {
                move.setChangeType(ChangeType.STATEMENT_ORDERING_CHANGE);
                result = move;
View Full Code Here

        }
        return result;
    }

    private SourceCodeChange classify(Update update) {
        SourceCodeChange result = null;

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

        }
        return update;
    }

    private SourceCodeChange handleMethodSignatureChange(Update upd) {
        SourceCodeChange result = null;
        if (upd.getNewEntity().getType().isType()) {
            if (upd.getParentEntity().getType() == JavaEntityType.PARAMETER) {
                String[] oldSplit = upd.getChangedEntity().getUniqueName().split(COLON);
                String[] newSplit = upd.getNewEntity().getUniqueName().split(COLON);
                if ((oldSplit.length > 1) && (newSplit.length > 1) && !oldSplit[1].equals(newSplit[1])) {
                    // MW: BUG FIX for IndexOutOfBoundsException
                    // BF: use 1 as index!!
                    upd.setChangeType(ChangeType.PARAMETER_TYPE_CHANGE);
                    result = upd;
                }
            } 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

        }
        return update;
    }

    private SourceCodeChange handleNormalUpdate(Update update) {
        SourceCodeChange result = null;
        switch ((JavaEntityType) update.getNewEntity().getType()) {
            case IF_STATEMENT:
            case FOR_STATEMENT:
            case WHILE_STATEMENT:
            case DO_STATEMENT:
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.