Skip to content

Commit

Permalink
Introduce DocumentationDiffProvider abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Jul 31, 2024
1 parent c00596f commit 4d37c55
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import gr.uom.java.xmi.diff.UMLAbstractClassDiff;
import gr.uom.java.xmi.diff.UMLClassMoveDiff;
import gr.uom.java.xmi.diff.UMLCommentListDiff;
import gr.uom.java.xmi.diff.UMLDocumentationDiffProvider;
import gr.uom.java.xmi.diff.UMLJavadocDiff;
import gr.uom.java.xmi.diff.UMLModelDiff;
import gr.uom.java.xmi.diff.UMLOperationDiff;
Expand Down Expand Up @@ -83,7 +84,7 @@
import org.refactoringminer.api.RefactoringType;
import org.refactoringminer.util.PrefixSuffixUtils;

public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper> {
public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper>, UMLDocumentationDiffProvider {
private VariableDeclarationContainer container1;
private VariableDeclarationContainer container2;
private Set<AbstractCodeMapping> mappings;
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/gr/uom/java/xmi/diff/UMLAttributeDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@
import gr.uom.java.xmi.UMLAttribute;
import gr.uom.java.xmi.UMLOperation;
import gr.uom.java.xmi.UMLParameter;
import gr.uom.java.xmi.decomposition.AbstractCall;
import gr.uom.java.xmi.VariableDeclarationContainer;
import gr.uom.java.xmi.decomposition.AbstractCodeFragment;
import gr.uom.java.xmi.decomposition.AbstractCodeMapping;
import gr.uom.java.xmi.decomposition.AbstractExpression;
import gr.uom.java.xmi.decomposition.LeafExpression;
import gr.uom.java.xmi.decomposition.UMLOperationBodyMapper;
import gr.uom.java.xmi.decomposition.VariableDeclaration;
import gr.uom.java.xmi.decomposition.VariableReferenceExtractor;
import gr.uom.java.xmi.decomposition.replacement.Replacement;
import gr.uom.java.xmi.decomposition.replacement.Replacement.ReplacementType;

public class UMLAttributeDiff {
public class UMLAttributeDiff implements UMLDocumentationDiffProvider {
private UMLAttribute removedAttribute;
private UMLAttribute addedAttribute;
private boolean visibilityChanged;
Expand Down Expand Up @@ -210,6 +208,14 @@ public UMLCommentListDiff getCommentListDiff() {
return commentListDiff;
}

public VariableDeclarationContainer getContainer1() {
return removedAttribute;
}

public VariableDeclarationContainer getContainer2() {
return addedAttribute;
}

public Optional<UMLOperationBodyMapper> getInitializerMapper() {
return Optional.ofNullable(mapper);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package gr.uom.java.xmi.diff;

import java.util.Optional;

import gr.uom.java.xmi.VariableDeclarationContainer;

public interface UMLDocumentationDiffProvider {
public Optional<UMLJavadocDiff> getJavadocDiff();
public UMLCommentListDiff getCommentListDiff();
public VariableDeclarationContainer getContainer1();
public VariableDeclarationContainer getContainer2();
}
11 changes: 10 additions & 1 deletion src/main/java/gr/uom/java/xmi/diff/UMLEnumConstantDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import gr.uom.java.xmi.UMLAnnotation;
import gr.uom.java.xmi.UMLAnonymousClass;
import gr.uom.java.xmi.UMLEnumConstant;
import gr.uom.java.xmi.VariableDeclarationContainer;
import gr.uom.java.xmi.decomposition.UMLOperationBodyMapper;

public class UMLEnumConstantDiff {
public class UMLEnumConstantDiff implements UMLDocumentationDiffProvider {
private UMLEnumConstant removedEnumConstant;
private UMLEnumConstant addedEnumConstant;
private boolean renamed;
Expand Down Expand Up @@ -79,6 +80,14 @@ public UMLCommentListDiff getCommentListDiff() {
return commentListDiff;
}

public VariableDeclarationContainer getContainer1() {
return removedEnumConstant;
}

public VariableDeclarationContainer getContainer2() {
return addedEnumConstant;
}

public Optional<UMLAnonymousClassDiff> getAnonymousClassDiff() {
return Optional.ofNullable(anonymousClassDiff);
}
Expand Down

0 comments on commit 4d37c55

Please sign in to comment.