Skip to content

Commit

Permalink
ASTDiff: Packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
pouryafard75 authored and tsantalis committed May 23, 2024
1 parent 3cd123f commit f096939
Show file tree
Hide file tree
Showing 67 changed files with 182 additions and 166 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gui/RunWithGitHubAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import gui.webdiff.WebDiff;
import org.refactoringminer.api.RefactoringMinerTimedOutException;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;
import org.refactoringminer.astDiff.utils.URLHelper;
import org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gui/RunWithLocallyClonedRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import gui.webdiff.WebDiff;
import org.eclipse.jgit.lib.Repository;
import org.refactoringminer.api.GitService;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;
import org.refactoringminer.astDiff.utils.URLHelper;
import org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl;
import org.refactoringminer.util.GitServiceImpl;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gui/RunWithPullRequest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gui;

import gui.webdiff.WebDiff;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;
import org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl;

public class RunWithPullRequest {
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/gui/RunWithTwoDirectories.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package gui;

import gui.webdiff.WebDiff;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.utils.MappingExportModel;
import org.refactoringminer.astDiff.models.ProjectASTDiff;
import org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gui/webdiff/DirComparator.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package gui.webdiff;

import com.github.gumtreediff.utils.Pair;
import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.models.ASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;

import javax.swing.tree.DefaultMutableTreeNode;
import java.util.*;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gui/webdiff/DirectoryDiffView.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gui.webdiff;

import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.models.ASTDiff;
import org.rendersnake.DocType;
import org.rendersnake.HtmlCanvas;
import org.rendersnake.Renderable;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gui/webdiff/MonacoDiffView.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.github.gumtreediff.actions.Diff;
import com.github.gumtreediff.actions.TreeClassifier;
import com.github.gumtreediff.tree.Tree;
import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.actions.ExtendedTreeClassifier;
import org.refactoringminer.astDiff.models.ASTDiff;
import org.refactoringminer.astDiff.actions.classifier.ExtendedTreeClassifier;
import org.refactoringminer.astDiff.actions.model.MultiMove;
import org.rendersnake.DocType;
import org.rendersnake.HtmlCanvas;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gui/webdiff/TreeViewGenerator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gui.webdiff;

import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.models.ASTDiff;

import com.github.gumtreediff.utils.Pair;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gui/webdiff/VanillaDiffHtmlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.github.gumtreediff.utils.SequenceAlgorithms;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.actions.ExtendedTreeClassifier;
import org.refactoringminer.astDiff.models.ASTDiff;
import org.refactoringminer.astDiff.actions.classifier.ExtendedTreeClassifier;
import org.refactoringminer.astDiff.actions.model.MultiMove;

import java.io.*;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gui/webdiff/WebDiff.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package gui.webdiff;

import com.github.gumtreediff.utils.Pair;
import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.models.ASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;
import org.rendersnake.HtmlCanvas;
import org.rendersnake.Renderable;
import spark.Spark;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gui/webdiff/WebDiffRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.models.ASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;
import org.refactoringminer.astDiff.utils.MappingExportModel;
import org.refactoringminer.astDiff.utils.URLHelper;
import org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;

import org.eclipse.jgit.lib.Repository;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;

/**
* Detect refactorings in the git history.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.classifier;

import java.util.HashMap;
import java.util.HashSet;
Expand All @@ -8,6 +8,7 @@
import com.github.gumtreediff.actions.Diff;
import com.github.gumtreediff.actions.model.Action;
import com.github.gumtreediff.tree.Tree;
import org.refactoringminer.astDiff.models.ASTDiff;

/**
* @author Pourya Alikhani Fard pouryafard75@gmail.com
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.classifier;

import com.github.gumtreediff.actions.model.*;
import com.github.gumtreediff.tree.Tree;
import org.refactoringminer.astDiff.actions.classifier.ExtendedAbstractITreeClassifier;
import org.refactoringminer.astDiff.actions.model.MoveIn;
import org.refactoringminer.astDiff.actions.model.MoveOut;
import org.refactoringminer.astDiff.actions.model.MultiMove;
import org.refactoringminer.astDiff.models.ASTDiff;

import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.classifier;

import com.github.gumtreediff.actions.TreeClassifier;
import com.github.gumtreediff.actions.model.Action;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.editscript;

import com.github.gumtreediff.actions.EditScript;
import com.github.gumtreediff.actions.model.*;
Expand All @@ -11,7 +11,7 @@
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;
import org.refactoringminer.astDiff.actions.model.MoveIn;
import org.refactoringminer.astDiff.actions.model.MoveOut;
import org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;

import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.editscript;

import com.github.gumtreediff.actions.EditScript;
import com.github.gumtreediff.tree.TreeContext;
import org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.editscript;

import com.github.gumtreediff.actions.EditScript;
import com.github.gumtreediff.actions.EditScriptGenerator;
import com.github.gumtreediff.actions.model.Action;
import com.github.gumtreediff.tree.Tree;
import com.github.gumtreediff.tree.TreeContext;
import org.refactoringminer.astDiff.actions.model.MultiMove;
import org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;

import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.editscript;

import com.github.gumtreediff.actions.EditScript;
import com.github.gumtreediff.actions.model.*;
import com.github.gumtreediff.tree.Tree;
import com.github.gumtreediff.tree.TreeContext;
import org.refactoringminer.astDiff.actions.model.MoveIn;
import org.refactoringminer.astDiff.actions.model.MoveOut;
import org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.refactoringminer.astDiff.actions;
package org.refactoringminer.astDiff.actions.editscript;

import com.github.gumtreediff.actions.EditScript;
import com.github.gumtreediff.actions.model.Action;
import com.github.gumtreediff.tree.Tree;
import com.github.gumtreediff.tree.TreeContext;
import org.refactoringminer.astDiff.actions.model.MultiMove;
import org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
import org.refactoringminer.api.Refactoring;
import org.refactoringminer.api.RefactoringMinerTimedOutException;
import org.refactoringminer.api.RefactoringType;
import org.refactoringminer.astDiff.AllSubTreesMovedASTDiffGenerator;
import org.refactoringminer.astDiff.MovedASTDiffGenerator;
import org.refactoringminer.astDiff.actions.ASTDiff;
import org.refactoringminer.astDiff.actions.ProjectASTDiff;
import org.refactoringminer.astDiff.matchers.atomic.*;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.models.OptimizationData;
import org.refactoringminer.astDiff.moved.AllSubTreesMovedASTDiffGenerator;
import org.refactoringminer.astDiff.moved.MovedASTDiffGenerator;
import org.refactoringminer.astDiff.models.ASTDiff;
import org.refactoringminer.astDiff.models.ProjectASTDiff;
import org.refactoringminer.astDiff.matchers.wrappers.*;
import org.refactoringminer.astDiff.matchers.statement.LeafMatcher;
import org.refactoringminer.astDiff.matchers.vanilla.MissingIdenticalSubtree;
import org.refactoringminer.astDiff.utils.Constants;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package org.refactoringminer.astDiff.matchers;

import com.github.gumtreediff.tree.Tree;
import gr.uom.java.xmi.decomposition.AbstractCodeFragment;
import gr.uom.java.xmi.decomposition.AbstractCodeMapping;
import gr.uom.java.xmi.decomposition.AbstractStatement;
import gr.uom.java.xmi.decomposition.LeafMapping;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;

/**
* @author Pourya Alikhani Fard pouryafard75@gmail.com
*/
public interface TreeMatcher {
void match(Tree src, Tree dst, ExtendedMultiMappingStore mappingStore);
default ExtendedMultiMappingStore matchAndMake(Tree srcTree, Tree dstTree) {
ExtendedMultiMappingStore mappingStore = new ExtendedMultiMappingStore(srcTree, dstTree);
match(srcTree, dstTree, mappingStore);
return mappingStore;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package org.refactoringminer.astDiff.matchers;
package org.refactoringminer.astDiff.matchers.statement;

import com.github.gumtreediff.matchers.Mapping;
import com.github.gumtreediff.matchers.MappingStore;
import com.github.gumtreediff.tree.Tree;
import com.github.gumtreediff.utils.Pair;
import org.refactoringminer.astDiff.matchers.*;
import org.refactoringminer.astDiff.matchers.vanilla.CustomBottomUpMatcher;
import org.refactoringminer.astDiff.matchers.vanilla.CustomTopDownMatcher;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.utils.Constants;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package org.refactoringminer.astDiff.matchers;
package org.refactoringminer.astDiff.matchers.statement;

import com.github.gumtreediff.matchers.Mapping;
import com.github.gumtreediff.tree.Tree;
import com.github.gumtreediff.tree.TreeMetrics;
import gr.uom.java.xmi.decomposition.*;
import org.eclipse.jdt.core.IRegion;
import org.refactoringminer.astDiff.utils.Constants;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.matchers.TreeMatcher;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.eclipse.jgit.lib.ObjectChecker.parent;

/** Use this matcher when both code fragments are {@link gr.uom.java.xmi.decomposition.CompositeStatementObject}. <br>
* @author Pourya Alikhani Fard pouryafard75@gmail.com
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package org.refactoringminer.astDiff.matchers;
package org.refactoringminer.astDiff.matchers.statement;

import com.github.gumtreediff.tree.Tree;
import gr.uom.java.xmi.decomposition.AbstractCodeFragment;
import gr.uom.java.xmi.decomposition.AbstractExpression;
import gr.uom.java.xmi.decomposition.CompositeStatementObject;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.matchers.TreeMatcher;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;

/** 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>
* If you know that both fragments are composite, use {@link CompositeMatcher} instead. <br>
* @author Pourya Alikhani Fard pouryafard75@gmail.com
*/
public class GeneralMatcher extends BasicTreeMatcher implements TreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.refactoringminer.astDiff.matchers;
package org.refactoringminer.astDiff.matchers.statement;

import com.github.gumtreediff.matchers.CompositeMatchers;
import com.github.gumtreediff.matchers.MappingStore;
import com.github.gumtreediff.matchers.optimizations.*;
import com.github.gumtreediff.tree.Tree;
import com.github.gumtreediff.utils.Pair;
import gr.uom.java.xmi.decomposition.AbstractCodeMapping;
import org.refactoringminer.astDiff.utils.Constants;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.matchers.TreeMatcher;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;

import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.refactoringminer.astDiff.matchers;
package org.refactoringminer.astDiff.matchers.vanilla;

import com.github.gumtreediff.matchers.MappingStore;
import com.github.gumtreediff.matchers.Matcher;
Expand All @@ -7,6 +7,7 @@
import com.github.gumtreediff.tree.TreeUtils;
import com.github.gumtreediff.tree.Type;
import com.github.gumtreediff.utils.SequenceAlgorithms;
import org.refactoringminer.astDiff.utils.Constants;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;

import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package org.refactoringminer.astDiff.matchers;
package org.refactoringminer.astDiff.matchers.vanilla;

import com.github.gumtreediff.matchers.*;
import com.github.gumtreediff.matchers.heuristic.gt.*;
import com.github.gumtreediff.tree.Tree;
import org.refactoringminer.astDiff.utils.Constants;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;

import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.refactoringminer.astDiff.matchers;
package org.refactoringminer.astDiff.matchers.vanilla;

import com.github.gumtreediff.matchers.*;
import com.github.gumtreediff.matchers.heuristic.gt.DefaultPriorityTreeQueue;
import com.github.gumtreediff.matchers.heuristic.gt.GreedySubtreeMatcher;
import com.github.gumtreediff.matchers.heuristic.gt.MappingComparators;
import com.github.gumtreediff.matchers.heuristic.gt.PriorityTreeQueue;
import com.github.gumtreediff.tree.Tree;
import org.refactoringminer.astDiff.utils.Constants;
import org.refactoringminer.astDiff.models.ExtendedMultiMappingStore;
import org.refactoringminer.astDiff.matchers.TreeMatcher;
import org.refactoringminer.astDiff.utils.TreeUtilFunctions;

import java.util.*;
Expand Down
Loading

0 comments on commit f096939

Please sign in to comment.