Skip to content

Commit

Permalink
Generalize PurityChecker APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 15, 2024
1 parent af0be77 commit a4d21b3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/org/refactoringminer/api/PurityChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -2532,8 +2532,8 @@ private static PurityCheckResult detectMoveMethodPurity(MoveOperationRefactoring
}

private static void checkForParameterizeVariableOnTop(Refactoring refactoring, List<Refactoring> refactorings, List<AbstractCodeFragment> nonMappedLeavesT1) {
UMLOperation originalOperation = null;
UMLOperation movedOperation = null;
VariableDeclarationContainer originalOperation = null;
VariableDeclarationContainer movedOperation = null;

if (refactoring.getRefactoringType().equals(RefactoringType.MOVE_OPERATION) || refactoring.getRefactoringType().equals(RefactoringType.MOVE_AND_RENAME_OPERATION)) {
originalOperation = ((MoveOperationRefactoring) (refactoring)).getOriginalOperation();
Expand Down Expand Up @@ -2567,8 +2567,8 @@ private static void checkForParameterizeVariableOnTop(Refactoring refactoring, L
}

private static void checkForLocalizeParameterOnTop(Refactoring refactoring, List<Refactoring> refactorings, List<AbstractCodeFragment> nonMappedLeavesT2) {
UMLOperation originalOperation = null;
UMLOperation movedOperation = null;
VariableDeclarationContainer originalOperation = null;
VariableDeclarationContainer movedOperation = null;

if (refactoring.getRefactoringType().equals(RefactoringType.MOVE_OPERATION) || refactoring.getRefactoringType().equals(RefactoringType.MOVE_AND_RENAME_OPERATION)) {
originalOperation = ((MoveOperationRefactoring) (refactoring)).getOriginalOperation();
Expand Down Expand Up @@ -2696,8 +2696,8 @@ private static void omitMoveMethodRelatedReplacements(Refactoring refactoring, L
int foundInBefore = before.indexOf(after);
List<String> classBefore = new ArrayList<>();
List<String> classAfter = new ArrayList<>();
UMLOperation originalOperation = null;
UMLOperation refactoredOperation = null;
VariableDeclarationContainer originalOperation = null;
VariableDeclarationContainer refactoredOperation = null;

if (refactoring.getRefactoringType().equals(RefactoringType.MOVE_OPERATION) || refactoring.getRefactoringType().equals(RefactoringType.MOVE_AND_RENAME_OPERATION)) {
String classBeforeString = ((MoveOperationRefactoring) (refactoring)).getOriginalOperation().getNonQualifiedClassName();
Expand Down Expand Up @@ -2810,7 +2810,7 @@ private static void omitMoveMethodRelatedReplacements(Refactoring refactoring, L
replacementsToCheck.removeAll(replacementsToRemove);
}

private static boolean relaxSearch(UMLOperation movedOperation, List<Refactoring> refactorings, String instanceOrVariable, String method, UMLModelDiff modelDiff) {
private static boolean relaxSearch(VariableDeclarationContainer movedOperation, List<Refactoring> refactorings, String instanceOrVariable, String method, UMLModelDiff modelDiff) {
for (Refactoring refactoring : refactorings) {
if (isMethodRelatedRefactoring(refactoring)) {
if (refactoring instanceof AddMethodAnnotationRefactoring) {
Expand Down Expand Up @@ -2842,7 +2842,7 @@ private static boolean isMethodRelatedRefactoring(Refactoring refactoring) {
return false;
}

private static boolean searchInVariableDeclarations(UMLOperation operation, String instanceOrVariable, List<String> className, UMLModelDiff umlModelDiff) {
private static boolean searchInVariableDeclarations(VariableDeclarationContainer operation, String instanceOrVariable, List<String> className, UMLModelDiff umlModelDiff) {
// This iteration also covers the parameters list
for (VariableDeclaration variableDeclaration : operation.getAllVariableDeclarations()) {
if (variableDeclaration.getVariableName().equals(instanceOrVariable)) {
Expand Down Expand Up @@ -2913,7 +2913,7 @@ private static boolean specificCheckForPullUpMethodOnTopFoundInBefore(Refactorin
return true;
}

UMLOperation originalOperation = null;
VariableDeclarationContainer originalOperation = null;

if (refactoring instanceof MoveOperationRefactoring) {
originalOperation = ((MoveOperationRefactoring) refactoring).getOriginalOperation();
Expand Down

0 comments on commit a4d21b3

Please sign in to comment.