gr.uom.java.xmi.diff.InlineOperationRefactoring Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of refactoring-miner Show documentation
Show all versions of refactoring-miner Show documentation
RefactoringMiner is a library/API written in Java that can detect refactorings applied in the history of a Java project.
package gr.uom.java.xmi.diff;
import static gr.uom.java.xmi.Constants.JAVA;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.refactoringminer.api.Refactoring;
import org.refactoringminer.api.RefactoringType;
import gr.uom.java.xmi.UMLOperation;
import gr.uom.java.xmi.VariableDeclarationContainer;
import gr.uom.java.xmi.decomposition.AbstractCall;
import gr.uom.java.xmi.decomposition.AbstractCodeFragment;
import gr.uom.java.xmi.decomposition.AbstractCodeMapping;
import gr.uom.java.xmi.decomposition.CompositeStatementObject;
import gr.uom.java.xmi.decomposition.LeafExpression;
import gr.uom.java.xmi.decomposition.LeafMapping;
import gr.uom.java.xmi.decomposition.ObjectCreation;
import gr.uom.java.xmi.decomposition.UMLOperationBodyMapper;
import gr.uom.java.xmi.decomposition.VariableDeclaration;
import gr.uom.java.xmi.decomposition.replacement.Replacement;
public class InlineOperationRefactoring implements Refactoring {
private UMLOperation inlinedOperation;
private VariableDeclarationContainer targetOperationAfterInline;
private VariableDeclarationContainer targetOperationBeforeInline;
private List inlinedOperationInvocations;
private Set replacements;
private Set inlinedCodeFragmentsFromInlinedOperation;
private Set inlinedCodeFragmentsInTargetOperation;
private UMLOperationBodyMapper bodyMapper;
private Map parameterToArgumentMap;
private List argumentMappings;
public InlineOperationRefactoring(UMLOperationBodyMapper bodyMapper, VariableDeclarationContainer targetOperationBeforeInline,
List operationInvocations) {
this.bodyMapper = bodyMapper;
this.inlinedOperation = bodyMapper.getOperation1();
this.targetOperationAfterInline = bodyMapper.getContainer2();
this.targetOperationBeforeInline = targetOperationBeforeInline;
this.inlinedOperationInvocations = operationInvocations;
this.replacements = bodyMapper.getReplacements();
this.inlinedCodeFragmentsFromInlinedOperation = new LinkedHashSet();
this.inlinedCodeFragmentsInTargetOperation = new LinkedHashSet();
this.argumentMappings = new ArrayList();
Optional