forked from tsantalis/RefactoringMiner
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify the matchers to enable the matching of composite and non-composite with GeneralMatcher Better naming for the method
- Loading branch information
1 parent
b4fe6ce
commit c834dc4
Showing
5 changed files
with
25 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
/** Use this matcher when both code fragments are {@link gr.uom.java.xmi.decomposition.CompositeStatementObject}. <br> | ||
* @author Pourya Alikhani Fard [email protected] | ||
*/ | ||
public class CompositeMatcher extends BasicTreeMatcher implements TreeMatcher { | ||
|
@@ -48,10 +48,6 @@ private void process(Tree src, Tree dst, ExtendedMultiMappingStore mappingStore) | |
} | ||
} | ||
|
||
private void compositeMatcher(Tree src, Tree dst, ExtendedMultiMappingStore mappingStore) { | ||
process(src, dst, mappingStore); | ||
} | ||
|
||
private static Tree makeFakeTree(Tree tree, CompositeStatementObject fragment, Map<Tree, Tree> cpyMap) { | ||
Tree cpy = TreeUtilFunctions.makeDefaultTree(tree); | ||
cpyMap.put(cpy,tree); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,15 @@ | |
import gr.uom.java.xmi.decomposition.CompositeStatementObject; | ||
import org.refactoringminer.astDiff.utils.TreeUtilFunctions; | ||
|
||
/* Created by pourya on 2023-04-25 1:08 p.m. */ | ||
public class GeneralTreeMatcher extends BasicTreeMatcher implements TreeMatcher { | ||
/** Use this matcher when two code fragments must be matched. <br> | ||
* If you know that both fragments are composite, use {@link org.refactoringminer.astDiff.matchers.CompositeMatcher} instead. <br> | ||
* @author Pourya Alikhani Fard [email protected] | ||
*/ | ||
public class GeneralMatcher extends BasicTreeMatcher implements TreeMatcher { | ||
AbstractCodeFragment st1; | ||
AbstractCodeFragment st2; | ||
|
||
public GeneralTreeMatcher(AbstractCodeFragment st1, AbstractCodeFragment st2) { | ||
public GeneralMatcher(AbstractCodeFragment st1, AbstractCodeFragment st2) { | ||
this.st1 = st1; | ||
this.st2 = st2; | ||
} | ||
|
@@ -38,6 +41,9 @@ public void match(Tree src, Tree dst, ExtendedMultiMappingStore mappingStore) { | |
new LeafMatcher(false).match(srcExpTree,dst,mappingStore); | ||
} | ||
} | ||
else { | ||
new LeafMatcher(false).match(src,dst,mappingStore); | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters