Skip to content

Commit

Permalink
Store mappings into refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Nov 6, 2024
1 parent 73d2556 commit ac4da19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4733,7 +4733,7 @@ else if(anonymousClassDeclarations1.size() == 1 && anonymousClassDeclarations2.s
operationBodyMapper.getNonMappedLeavesT1().addAll(mapper.getNonMappedLeavesT1());
operationBodyMapper.getNonMappedLeavesT2().addAll(mapper.getNonMappedLeavesT2());
if(operationBodyMapper.getContainer1() != null && operationBodyMapper.getContainer2() != null) {
ReplaceAnonymousWithLambdaRefactoring ref = new ReplaceAnonymousWithLambdaRefactoring(anonymousClass1, lambda2, container1, container2);
ReplaceAnonymousWithLambdaRefactoring ref = new ReplaceAnonymousWithLambdaRefactoring(anonymousClass1, lambda2, container1, container2, mapper.getMappings());
operationBodyMapper.getRefactoringsAfterPostProcessing().add(ref);
operationBodyMapper.getRefactoringsAfterPostProcessing().addAll(mapper.getRefactorings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@

import gr.uom.java.xmi.UMLAnonymousClass;
import gr.uom.java.xmi.VariableDeclarationContainer;
import gr.uom.java.xmi.decomposition.AbstractCodeMapping;
import gr.uom.java.xmi.decomposition.LambdaExpressionObject;

public class ReplaceAnonymousWithLambdaRefactoring implements Refactoring {
private UMLAnonymousClass anonymousClass;
private LambdaExpressionObject lambda;
private VariableDeclarationContainer operationBefore;
private VariableDeclarationContainer operationAfter;
private Set<AbstractCodeMapping> mappings;

public ReplaceAnonymousWithLambdaRefactoring(UMLAnonymousClass anonymousClass, LambdaExpressionObject lambda,
VariableDeclarationContainer operationBefore, VariableDeclarationContainer operationAfter) {
VariableDeclarationContainer operationBefore, VariableDeclarationContainer operationAfter, Set<AbstractCodeMapping> mappings) {
this.anonymousClass = anonymousClass;
this.lambda = lambda;
this.operationBefore = operationBefore;
this.operationAfter = operationAfter;
this.mappings = mappings;
}

public UMLAnonymousClass getAnonymousClass() {
Expand All @@ -43,6 +46,10 @@ public VariableDeclarationContainer getOperationAfter() {
return operationAfter;
}

public Set<AbstractCodeMapping> getMappings() {
return mappings;
}

@Override
public List<CodeRange> leftSide() {
List<CodeRange> ranges = new ArrayList<CodeRange>();
Expand Down

0 comments on commit ac4da19

Please sign in to comment.