This commit is contained in:
ANIL KOYUNCU
2020-06-09 16:02:21 +02:00
19 changed files with 418 additions and 1201 deletions
-683
View File
@@ -1,683 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="75ef5724-93bc-4ed4-82b2-ff12411188dc" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gumtree/gen.srcml/src/main/java/com/github/gumtreediff/gen/srcml/AbstractSrcmlTreeGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/gumtree/gen.srcml/src/main/java/com/github/gumtreediff/gen/srcml/AbstractSrcmlTreeGenerator.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gumtree/gen.srcml/src/main/java/com/github/gumtreediff/gen/srcml/NodeMap_new.java" beforeDir="false" afterPath="$PROJECT_DIR$/gumtree/gen.srcml/src/main/java/com/github/gumtreediff/gen/srcml/NodeMap_new.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/python/abstractPatch.py" beforeDir="false" afterPath="$PROJECT_DIR$/python/abstractPatch.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/python/data/datasets.csv" beforeDir="false" afterPath="$PROJECT_DIR$/python/data/datasets.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/python/fixminer.sh" beforeDir="false" afterPath="$PROJECT_DIR$/python/fixminer.sh" afterDir="false" />
<change beforePath="$PROJECT_DIR$/python/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/python/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/python/otherDatasets.py" beforeDir="false" afterPath="$PROJECT_DIR$/python/otherDatasets.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/EDiffParser.java" beforeDir="false" afterPath="$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/EDiffParser.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java" beforeDir="false" afterPath="$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/jobs/EnhancedASTDiff.java" beforeDir="false" afterPath="$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/jobs/EnhancedASTDiff.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java" beforeDir="false" afterPath="$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestPredefinedCases.java" beforeDir="false" afterPath="$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestPredefinedCases.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java" beforeDir="false" afterPath="$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/config.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/config.yml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DefaultGradleProjectSettings">
<option name="isMigrated" value="true" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="alwaysUpdateSnapshots" value="true" />
</MavenGeneralSettings>
</option>
<option name="importingSettings">
<MavenImportingSettings>
<option name="importAutomatically" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="ProjectFrameBounds" fullScreen="true">
<option name="width" value="1680" />
<option name="height" value="1050" />
</component>
<component name="ProjectId" id="1c4cAEfPBg6zdrSIpdHazfnmZVV" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_directory_selection" value="$PROJECT_DIR$/src/main/java/edu/lu/uni/serval" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/richedit/src/main/resource" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.38275862" />
<property name="settings.editor.selected.configurable" value="preferences.fileTypes" />
</component>
<component name="RecentsManager">
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
<recent name="" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="edu.lu.uni.serval" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/richedit/src/main/resource" />
<recent name="$PROJECT_DIR$/python/data" />
<recent name="$PROJECT_DIR$/src/main/resources" />
</key>
</component>
<component name="RunManager" selected="JUnit.TestRealCases.test_328_B_4080800_4080805">
<configuration default="true" type="Applet">
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestRealCases" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="RichEdit" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="edu.lu.uni.serval.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="edu.lu.uni.serval" />
<option name="MAIN_CLASS_NAME" value="edu.lu.uni.serval.TestRealCases" />
<option name="TEST_OBJECT" value="class" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestRealCases.test_10_D_1434543_1434549" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="RichEdit" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="edu.lu.uni.serval.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="edu.lu.uni.serval" />
<option name="MAIN_CLASS_NAME" value="edu.lu.uni.serval.TestRealCases" />
<option name="METHOD_NAME" value="test_10_D_1434543_1434549" />
<option name="TEST_OBJECT" value="method" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestRealCases.test_31_B_136044_136045" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="RichEdit" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="edu.lu.uni.serval.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="edu.lu.uni.serval" />
<option name="MAIN_CLASS_NAME" value="edu.lu.uni.serval.TestRealCases" />
<option name="METHOD_NAME" value="test_31_B_136044_136045" />
<option name="TEST_OBJECT" value="method" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestRealCases.test_328_B_4080800_4080805" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="RichEdit" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="edu.lu.uni.serval.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="edu.lu.uni.serval" />
<option name="MAIN_CLASS_NAME" value="edu.lu.uni.serval.TestRealCases" />
<option name="METHOD_NAME" value="test_328_B_4080800_4080805" />
<option name="TEST_OBJECT" value="method" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestRealCases.test_60_A_510615_510619" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="RichEdit" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="edu.lu.uni.serval.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="edu.lu.uni.serval" />
<option name="MAIN_CLASS_NAME" value="edu.lu.uni.serval.TestRealCases" />
<option name="METHOD_NAME" value="test_60_A_510615_510619" />
<option name="TEST_OBJECT" value="method" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<option name="TEST_OBJECT" value="class" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="FixPatternMiner [assembly:assembly]" type="MavenRunConfiguration" factoryName="Maven">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="assembly:assembly" />
<option value="-DskipTests" />
</list>
</option>
<option name="pomFileName" value="pom.xml" />
<option name="profilesMap">
<map />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method v="2" />
</configuration>
<configuration name="FixPatternMiner [package]" type="MavenRunConfiguration" factoryName="Maven">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="package" />
<option value="-DskipTests" />
</list>
</option>
<option name="pomFileName" value="pom.xml" />
<option name="profilesMap">
<map />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method v="2" />
</configuration>
<configuration default="true" type="TestNG">
<option name="TEST_OBJECT" value="CLASS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<properties />
<listeners />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file enabled="true" id="idea.log" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="JUnit.TestRealCases" />
<item itemvalue="JUnit.TestRealCases.test_31_B_136044_136045" />
<item itemvalue="JUnit.TestRealCases.test_10_D_1434543_1434549" />
<item itemvalue="JUnit.TestRealCases.test_60_A_510615_510619" />
<item itemvalue="JUnit.TestRealCases.test_328_B_4080800_4080805" />
<item itemvalue="Maven.FixPatternMiner [assembly:assembly]" />
<item itemvalue="Maven.FixPatternMiner [package]" />
</list>
<recent_temporary>
<list>
<item itemvalue="JUnit.TestRealCases.test_328_B_4080800_4080805" />
<item itemvalue="JUnit.TestRealCases" />
<item itemvalue="JUnit.TestRealCases.test_60_A_510615_510619" />
<item itemvalue="JUnit.TestRealCases.test_10_D_1434543_1434549" />
<item itemvalue="JUnit.TestRealCases.test_31_B_136044_136045" />
</list>
</recent_temporary>
</component>
<component name="ServiceViewManager">
<option name="viewStates">
<list>
<serviceView>
<treeState>
<expand />
<select />
</treeState>
</serviceView>
</list>
</option>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="75ef5724-93bc-4ed4-82b2-ff12411188dc" name="Default Changelist" comment="" />
<created>1586198160464</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1586198160464</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="496" y="227" key="#Inspections" timestamp="1589791732499">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state x="496" y="227" key="#Inspections/0.0.1792.1120@0.0.1792.1120" timestamp="1589791732499" />
<state x="100" y="100" width="1592" height="920" key="#com.intellij.execution.junit2.states.ComparisonFailureState$DiffDialog" timestamp="1587388564664">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state x="100" y="100" width="1592" height="920" key="#com.intellij.execution.junit2.states.ComparisonFailureState$DiffDialog/0.0.1792.1120@0.0.1792.1120" timestamp="1587388564664" />
<state x="100" y="100" width="1592" height="920" key="#com.intellij.execution.junit2.states.ComparisonFailureState$DiffDialog/49.23.1743.1097@49.23.1743.1097" timestamp="1587377337479" />
<state x="764" y="469" key="#xdebugger.evaluate" timestamp="1587388084982">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state x="764" y="469" key="#xdebugger.evaluate/0.0.1792.1120@0.0.1792.1120" timestamp="1587388084982" />
<state width="465" height="466" key="DebuggerActiveHint" timestamp="1587385891920">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="465" height="466" key="DebuggerActiveHint/0.0.1792.1120@0.0.1792.1120" timestamp="1587385891920" />
<state width="1750" height="391" key="GridCell.Tab.0.bottom" timestamp="1589791154747">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.0.bottom/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154747" />
<state width="1750" height="391" key="GridCell.Tab.0.center" timestamp="1589791154747">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.0.center/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154747" />
<state width="1750" height="391" key="GridCell.Tab.0.left" timestamp="1589791154746">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.0.left/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154746" />
<state width="1750" height="391" key="GridCell.Tab.0.right" timestamp="1589791154747">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.0.right/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154747" />
<state width="1750" height="391" key="GridCell.Tab.1.bottom" timestamp="1589791154749">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.1.bottom/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154749" />
<state width="1750" height="391" key="GridCell.Tab.1.center" timestamp="1589791154748">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.1.center/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154748" />
<state width="1750" height="391" key="GridCell.Tab.1.left" timestamp="1589791154748">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.1.left/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154748" />
<state width="1750" height="391" key="GridCell.Tab.1.right" timestamp="1589791154748">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="1750" height="391" key="GridCell.Tab.1.right/0.0.1792.1120@0.0.1792.1120" timestamp="1589791154748" />
<state x="384" y="143" key="SettingsEditor" timestamp="1587373564765">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state x="384" y="143" key="SettingsEditor/0.0.1792.1120@0.0.1792.1120" timestamp="1587373564765" />
<state width="500" height="445" key="SwitcherDM" timestamp="1587375576710">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="500" height="445" key="SwitcherDM/0.0.1792.1120@0.0.1792.1120" timestamp="1587375576710" />
<state width="896" height="560" key="XDebugger.FullValuePopup" timestamp="1587388354889">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state width="896" height="560" key="XDebugger.FullValuePopup/0.0.1792.1120@0.0.1792.1120" timestamp="1587388354889" />
<state x="550" y="394" key="com.intellij.ide.util.TipDialog" timestamp="1589791165729">
<screen x="0" y="0" width="1792" height="1120" />
</state>
<state x="550" y="394" key="com.intellij.ide.util.TipDialog/0.0.1792.1120@0.0.1792.1120" timestamp="1589791165729" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/jobs/EnhancedASTDiff.java</url>
<line>49</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/Launcher.java</url>
<line>72</line>
<option name="timeStamp" value="25" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/gumtree/core/src/main/java/com/github/gumtreediff/io/TreeIoUtils.java</url>
<line>652</line>
<option name="timeStamp" value="31" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/gumtree/core/src/test/java/com/github/gumtreediff/test/TestActionGenerator.java</url>
<line>60</line>
<option name="timeStamp" value="32" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/gumtree/gen.srcml/src/main/java/com/github/gumtreediff/gen/srcml/AbstractSrcmlTreeGenerator.java</url>
<line>165</line>
<option name="timeStamp" value="36" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/EDiffParser.java</url>
<line>71</line>
<option name="timeStamp" value="37" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>88</line>
<option name="timeStamp" value="38" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>21</line>
<option name="timeStamp" value="39" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/gumtree/gen.srcml/src/main/java/com/github/gumtreediff/gen/srcml/AbstractSrcmlTreeGenerator.java</url>
<line>109</line>
<option name="timeStamp" value="46" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>19</line>
<option name="timeStamp" value="49" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/BaseTest.java</url>
<line>69</line>
<option name="timeStamp" value="50" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/BaseTest.java</url>
<line>72</line>
<option name="timeStamp" value="51" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/BaseTest.java</url>
<line>89</line>
<option name="timeStamp" value="52" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/EDiffParser.java</url>
<line>81</line>
<option name="timeStamp" value="56" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>29</line>
<option name="timeStamp" value="60" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>44</line>
<option name="timeStamp" value="61" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouper.java</url>
<line>50</line>
<option name="timeStamp" value="70" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouper.java</url>
<line>108</line>
<option name="timeStamp" value="80" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>109</line>
<option name="timeStamp" value="81" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouper.java</url>
<line>318</line>
<option name="timeStamp" value="84" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouper.java</url>
<line>90</line>
<option name="timeStamp" value="86" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouper.java</url>
<line>88</line>
<option name="timeStamp" value="87" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>301</line>
<option name="timeStamp" value="91" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/gumtree/gen.jdt/src/main/java/com/github/gumtreediff/gen/jdt/AbstractJdtTreeGenerator.java</url>
<line>67</line>
<option name="timeStamp" value="92" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/gumtree/gen.jdt/src/main/java/edu/lu/uni/serval/gen/jdt/exp/ExpJdtVisitor.java</url>
<line>1134</line>
<option name="timeStamp" value="95" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/gumtree/gen.jdt/src/main/java/edu/lu/uni/serval/gen/jdt/exp/ExpJdtVisitor.java</url>
<line>1243</line>
<option name="timeStamp" value="96" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>337</line>
<option name="timeStamp" value="97" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>389</line>
<option name="timeStamp" value="99" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouper.java</url>
<line>97</line>
<option name="timeStamp" value="100" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>450</line>
<option name="timeStamp" value="102" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>461</line>
<option name="timeStamp" value="103" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouper.java</url>
<line>75</line>
<option name="timeStamp" value="104" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>594</line>
<option name="timeStamp" value="105" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>619</line>
<option name="timeStamp" value="106" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>654</line>
<option name="timeStamp" value="109" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>746</line>
<option name="timeStamp" value="112" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestJavaMiner.java</url>
<line>776</line>
<option name="timeStamp" value="113" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>142</line>
<option name="timeStamp" value="114" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>370</line>
<option name="timeStamp" value="115" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>137</line>
<option name="timeStamp" value="116" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>552</line>
<option name="timeStamp" value="117" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>581</line>
<option name="timeStamp" value="120" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>541</line>
<option name="timeStamp" value="121" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>521</line>
<option name="timeStamp" value="122" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>122</line>
<option name="timeStamp" value="124" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java</url>
<line>1074</line>
<option name="timeStamp" value="125" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>69</line>
<option name="timeStamp" value="127" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java</url>
<line>307</line>
<option name="timeStamp" value="128" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>90</line>
<option name="timeStamp" value="130" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>132</line>
<option name="timeStamp" value="131" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>103</line>
<properties>
<option name="lambda-ordinal" value="-1" />
</properties>
<option name="timeStamp" value="132" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java</url>
<line>64</line>
<option name="timeStamp" value="133" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java</url>
<line>142</line>
<option name="timeStamp" value="134" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java</url>
<line>818</line>
<option name="timeStamp" value="135" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java</url>
<line>899</line>
<option name="timeStamp" value="136" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestInputCases.java</url>
<line>356</line>
<option name="timeStamp" value="137" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/test/java/edu/lu/uni/serval/TestRealCases.java</url>
<line>686</line>
<option name="timeStamp" value="138" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>209</line>
<option name="timeStamp" value="139" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>195</line>
<option name="timeStamp" value="140" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/richedit/src/main/java/edu/lu/uni/serval/richedit/ediff/HierarchicalRegrouperForC.java</url>
<line>205</line>
<option name="timeStamp" value="141" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="mavenExecuteGoalHistory">
<option value="" />
</component>
</project>
+111 -12
View File
File diff suppressed because one or more lines are too long
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
source activate fixminerEnv
PYTHONPATH=$(pwd) python -u python/main.py -root $(pwd)/python -job $2 -prop $1
+26 -21
View File
@@ -6,6 +6,8 @@ from common.commons import *
DATA_PATH = os.environ["DATA_PATH"]
DATASET = os.environ["dataset"]
jdk8 = os.environ["JDK8"]
REDIS_PORT = os.environ["REDIS_PORT"]
# def localPairCore(aTuple):
# redis_db = redis.StrictRedis(host="localhost", port=6380, db=1)
# idx, key = aTuple
@@ -54,12 +56,15 @@ def loadPairMulti(root,clusterPath,level):
# root = 'BreakStatement'
logging.info(root)
port = 6399
port = REDIS_PORT
# if isfile(clusterPath +"/"+root+".pickle"):
# return load_zipped_pickle(clusterPath +"/"+root+".pickle")
# else:
# redis_db = redis.StrictRedis(host="localhost", port=port, db=1) #L1
redis_db = redis.StrictRedis(host="localhost", port=port, db=2)
if level == 'tokens':
redis_db = redis.StrictRedis(host="localhost", port=port, db=3)
else:
redis_db = redis.StrictRedis(host="localhost", port=port, db=2)
keys = redis_db.scan(0, match=root+'-*', count='100000000')
# keys = redis_db.hkeys("dump")
@@ -81,11 +86,11 @@ def loadPairMulti(root,clusterPath,level):
matches['path2']=matches['pairs'].apply(lambda x:x[1])
# matches['sizes']=matches['pairs_key'].apply(lambda x:x.split('_')[0].split('-')[1])
matches['sizes']=matches['pairs_key'].apply(lambda x:x.split(root)[1].split('/')[0].split('-')[1])
if level == 'actions':
matches['actions']=matches['pairs_key'].apply(lambda x:x.split('/')[0].split('-')[2])
if level == 'tokens':
matches['actions'] = matches['pairs_key'].apply(lambda x: x.split('/')[0].split('-')[2])
matches['tokens']=matches['pairs_key'].apply(lambda x:x.split('/')[0].split('-')[3])
matches['tokens']=matches['pairs_key'].apply(lambda x:x.split('/')[0].split('-')[2])
# if level == 'tokens':
# matches['actions'] = matches['pairs_key'].apply(lambda x: x.split('/')[0].split('-')[2])
# matches['tokens']=matches['pairs_key'].apply(lambda x:x.split('/')[0].split('-')[3])
# save_zipped_pickle(matches,clusterPath +"/"+root+".pickle")
@@ -119,19 +124,19 @@ def cluster(clusterPath,pairsPath, level):
for s in sizes:
match = matches[matches['sizes'] == s]
if level == 'actions':
actions = match['actions'].unique().tolist()
if level == 'tokens':
actions = match['tokens'].unique().tolist()
for action in actions:
match = match[match['actions'] == action]
match = match[match['tokens'] == action]
clusterCore(clusterPath, level, match, pairsPath, root, s,action)
elif level == 'tokens':
actions = match['actions'].unique().tolist()
for action in actions:
match = match[match['actions'] == action]
tokens = match['tokens'].unique().tolist()
for token in tokens:
match = match[match['tokens']==token]
clusterCore(clusterPath, level, match, pairsPath, root, s, action,token)
# elif level == 'tokens':
# actions = match['actions'].unique().tolist()
# for action in actions:
# match = match[match['actions'] == action]
# tokens = match['tokens'].unique().tolist()
# for token in tokens:
# match = match[match['tokens']==token]
# clusterCore(clusterPath, level, match, pairsPath, root, s, action,token)
else:
clusterCore(clusterPath, level, match, pairsPath, root, s,'')
@@ -158,12 +163,12 @@ def clusterCore(clusterPath, level, match, pairsPath, root, s,action ,token=''):
cluster.append(subgraph.nodes())
cluster
pathMapping = dict()
if level == 'actions':
if level == 'tokens':
indexFile = join(pairsPath, root, s,action+'.index')
elif level == 'shapes':
elif level == 'actions':
indexFile = join(pairsPath, root, s + '.index')
else:
indexFile =join(pairsPath, root, s,action,token+'.index')
# else:
# indexFile =join(pairsPath, root, s,action,token+'.index')
df = pd.read_csv(indexFile, header=None, usecols=[0, 1], index_col=[0])
pathMapping = df.to_dict()
Binary file not shown.
+2
View File
@@ -17,6 +17,8 @@ def createDS():
pjList = PROJECT_LIST.split(',')
if not os.path.exists(DATASET_PATH):
os.mkdir(DATASET_PATH)
if not os.path.exists(COMMIT_DFS):
os.mkdir(COMMIT_DFS)
subjects = pd.read_csv(join(ROOT,'data', 'dataset.csv'))
+15 -67
View File
@@ -40,9 +40,7 @@ if __name__ == '__main__':
if job == 'dataset4j':
from javaDS import createDS
createDS()
# elif job == 'linuxDS':
# from linuxDataset import collectBugFixPatches
# collectBugFixPatches()
elif job =='dataset4c':
from otherDatasets import core
core()
@@ -53,20 +51,16 @@ if __name__ == '__main__':
output = shellCallTemplate(cmd)
logging.info(output)
# elif job =='loadRES':
# cmd = "JAVA_HOME='" + jdk8 + "' java -jar " + join(DATA_PATH, 'FixPatternMiner-1.0.1.jar') + " " + join(DATA_PATH, 'app.properties') + " LOAD " + rootType
# output = shellCallTemplate(cmd)
# logging.info(output)
elif job =='shapeSI':
from pairs import shapePairs
matches = shapePairs()
elif job =='actionSI':
from pairs import actionPairs
matches = actionPairs()
from pairs import createPairs
createPairs(matches)
from pairs import importShape
importShape()
from pairs import importAction
importAction()
elif job =='compare':
# cmd = "mvn exec:java -f '/data/fixminer_source/' -Dexec.mainClass='edu.lu.uni.serval.richedit.akka.compare.CompareTrees' -Dexec.args='"+ " shape " + join(DATA_PATH,"redis") +" ALLdumps-gumInput.rdb " + "clusterl0-gumInputALL.rdb /data/richedit-core/python/data/richEditScript'"
@@ -74,65 +68,28 @@ if __name__ == '__main__':
output = shellCallTemplate4jar(cmd)
logging.info(output)
# elif job == 'clusterAdditional':
# from addNewData import cluster
# cluster()
elif job == 'cluster':
from abstractPatch import cluster
dbDir = join(DATA_PATH, 'redis')
startDB(dbDir, "6399", PROJECT_TYPE)
cluster(join(DATA_PATH,'shapes'),join(DATA_PATH, 'pairs'),'shapes')
startDB(dbDir, REDIS_PORT, PROJECT_TYPE)
cluster(join(DATA_PATH,'actions'),join(DATA_PATH, 'pairs'),'actions')
# elif job =='actionSI':
# from pairs import actionPairs
# actionPairs(rootType)
#
# # elif job =='importActionPairs':
# from pairs import importAction
# importAction(rootType)
#
# elif job =='compareActions':
# # cmd = "JAVA_HOME='"+jdk8+"' java -Xmx8096m -Djava.util.concurrent.ForkJoinPool.common.parallelism=64 -jar "+ join(DATA_PATH,'CompareTrees.jar') + " action " + join(DATA_PATH,"redis") +" ALLdumps-gumInput.rdb " + "clusterl1-gumInputALL.rdb"
#
# cmd = "JAVA_HOME='" + jdk8 + "' java -jar " + join(DATA_PATH, 'FixPatternMiner-1.0.1.jar') + " " + join(DATA_PATH, 'app.properties') + " COMPARE " + 'L2'
# output = shellCallTemplate(cmd)
# logging.info(output)
#
# elif job == 'clusterActions':
# from abstractPatch import cluster
#
# dbDir = join(DATA_PATH, 'redis')
# startDB(dbDir, "6399", PROJECT_TYPE)
# cluster( join(DATA_PATH, 'actions'),join(DATA_PATH, 'pairsAction'),'actions',rootType)
elif job == 'tokenSI':
elif job =='tokenSI':
from pairs import tokenPairs
tokenPairs()
from pairs import importToken
importToken()
elif job == 'compareTokens':
# cmd = "JAVA_HOME='"+jdk8+"' java -jar "+ join(DATA_PATH,'CompareTrees.jar') + " token " + join(DATA_PATH,"redis") +" ALLdumps-gumInput.rdb " + "clusterl2-gumInputALL.rdb"
cmd = "JAVA_HOME='" + jdk8 + "' java -jar " + join(DATA_PATH, 'FixPatternMiner-1.0.1.jar') + " " + join(DATA_PATH, 'app.properties') + " COMPARE " + 'L3'
output = shellCallTemplate(cmd)
logging.info(output)
from pairs import importTokens
importTokens()
elif job == 'clusterTokens':
from abstractPatch import cluster
dbDir = join(DATA_PATH, 'redis')
startDB(dbDir, "6399", PROJECT_TYPE)
startDB(dbDir, "6380", "clusterl2-gumInputALL.rdb")
cluster(join(DATA_PATH, 'tokens'), join(DATA_PATH, 'pairsToken'),'tokens')
stopDB(dbDir, "6380", "clusterl2-gumInputALL.rdb")
startDB(dbDir, REDIS_PORT, PROJECT_TYPE)
cluster( join(DATA_PATH, 'tokens'),join(DATA_PATH, 'pairsToken'),'tokens')
# elif job == 'additional':
# from addNewData import core
# core()
# # from addNewData import checkWrongMembers
# # checkWrongMembers()
elif job == 'codeflaws':
from otherDatasets import codeflaws
@@ -218,19 +175,10 @@ if __name__ == '__main__':
elif job == 'defects4j':
from stats import defects4jStats
defects4jStats()
elif job == 'exportPatterns':
elif job == 'patterns':
from stats import exportAbstractPatterns
exportAbstractPatterns()
elif job =='export':
patternPath = join(DATA_PATH,'actions','ExpressionStatement','3','0','0')
patterns = listdir(patternPath)
for pattern in patterns:
repo = pattern.split('_')[0]
file = pattern.replace(repo+'_','')
print(file)
filename = file.rsplit('_',1)[0]
print(join(DATA_PATH,'gumInput',repo,'DiffEntries',filename))
break
else:
logging.error('Unknown job %s',job)
+29 -145
View File
@@ -3,50 +3,20 @@ DATA_PATH = os.environ["DATA_PATH"]
ROOT = os.environ["ROOT_DIR"]
INNER_DATA_PATH = join(ROOT,'data')
PROJECT_TYPE = os.environ["PROJECT_TYPE"]
def importToken():
# global dbDir, portInner, redis_db, pairs, cluster, action, e, idx, v, key
dbDir = join(INNER_DATA_PATH, 'redis')
portInner = '6380'
dbDir = join(INNER_DATA_PATH, 'redis')
startDB(dbDir, portInner, "clusterl2-gumInputALL.rdb")
import redis
pairsToken = join(DATA_PATH, 'pairsToken')
redis_db = redis.StrictRedis(host="localhost", port=portInner, db=1)
pairs = get_filepaths(pairsToken, '.txt')
for pair in pairs:
split = pair.split("/")
REDIS_PORT = os.environ["REDIS_PORT"]
shapeName = split[-4]
shapeSize = split[-3]
cluster = split[-2]
action = split[-1].replace('.txt', '')
# cmd ="bash " + join(DATA_PATH,'redisSingleImport.sh') + " " + pair + " 6380 " + shapeName + "-"+sizeCluster+"-"+actionCluster ;#+, portInner,f.getName()+"-"+pair.getName().split("\\.")[0]);
cmd = "bash " + join(INNER_DATA_PATH,
'redisSingleImport.sh') + " " + pair + " 6380 " + shapeName + "-" + shapeSize + "-" + cluster + "-" + action; # +, portInner,f.getName()+"-"+pair.getName().split("\\.")[0]);
o, e = shellGitCheckout(cmd)
o
indexFile = pair.replace('.txt', '.index')
with open(indexFile, 'r') as iFile:
idx = iFile.readlines()
for i in idx:
k, v = i.split(',')
key = shapeName + "-" + shapeSize + "-" + cluster + "-" + action + "-" + k
# redis_db.set(key, v.strip())
redis_db.hset('filenames', key, v.strip())
def importAction(rootType):
def importTokens():
# global dbDir, portInner, redis_db, pairs, pair, split, shapeName, shapeSize, cluster, cmd, o, e, indexFile, iFile, idx, i, k, v, key
dbDir = join(INNER_DATA_PATH, 'redis')
# portInner = '6380'
# startDB(dbDir, portInner, "clusterl1-gumInputALL.rdb")
portInner = '6399'
portInner = REDIS_PORT
startDB(dbDir, portInner, PROJECT_TYPE)
import redis
# import pairs
pairsAction = join(DATA_PATH, 'pairsAction',rootType)
pairsAction = join(DATA_PATH, 'pairsToken')
redis_db = redis.StrictRedis(host="localhost", port=portInner, db=1)
pairs = get_filepaths(pairsAction, '.txt')
for pair in pairs:
@@ -55,7 +25,7 @@ def importAction(rootType):
shapeSize = split[-2]
cluster = split[-1].replace('.txt', '')
cmd = "bash " + join(INNER_DATA_PATH,
'redisSingleImport.sh') + " " + pair + " 6399 " + shapeName + "-" + shapeSize + "-" + cluster; # +, portInner,f.getName()+"-"+pair.getName().split("\\.")[0]);
'redisSingleImport.sh') + " " + pair + " "+REDIS_PORT+" " + shapeName + "-" + shapeSize + "-" + cluster; # +, portInner,f.getName()+"-"+pair.getName().split("\\.")[0]);
o, e = shellGitCheckout(cmd)
print(o)
@@ -67,49 +37,17 @@ def importAction(rootType):
key = shapeName + "-" + shapeSize + "-" + cluster + "-" + k
# redis_db.set(key, v.strip())
redis_db.hset('filenames', key, v.strip())
redis_db.set("level", "l2")
# def importShape():
# # global dbDir, portInner, redis_db, pairs, pair, split, shapeName, cmd, o, e, indexFile, iFile, idx, i, k, v, key
# dbDir = join(DATA_PATH, 'redis')
# portInner = '6380'
# startDB(dbDir, portInner, "clusterl1-gumInputALL.rdb")
# import redis
# pairsShapes = join(DATA_PATH, 'pairs')
# redis_db = redis.StrictRedis(host="localhost", port=portInner, db=1)
# pairs = get_filepaths(pairsShapes, '.index')
# l = []
# for pair in pairs:
# # split = pair.split("/")
# # shapeName = split[-2]
# # sizeCluster = split[-1].replace('.txt', '')
# # cmd = "bash " + join(DATA_PATH, 'redisSingleImport.sh') + " " + pair + " 6380 " + shapeName + "-" + sizeCluster;
# #
# # o, e = shellGitCheckout(cmd)
# # print(o)
# # indexFile = pair.replace('.txt', '.index')
# with open(pair, 'r') as iFile:
# idx = iFile.readlines()
# idx = [i.split(',')[1] for i in idx]
# l.append(idx)
# l = list(itertools.chain.from_iterable(l))
# l = [i for i in l if not (i.startswith('commons-math') or i.startswith('commons-lang') or i.startswith(
# 'closure-compiler') or i.startswith('joda-time') or i.startswith('mockito') or i.startswith('jfreechart'))]
# l
#
# # for i in idx:
# # k, v = i.split(',')
# # key = shapeName + "-" + sizeCluster + "-" + k
# # redis_db.set(key, v.strip())
def importShape():
def importAction():
# global dbDir, portInner, redis_db, pairs, pair, split, shapeName, cmd, o, e, indexFile, iFile, idx, i, k, v, key
dbDir = join(INNER_DATA_PATH, 'redis')
# portInner = '6380'
# startDB(dbDir, portInner, "clusterl0-gumInputALL.rdb")
portInner = '6399'
portInner = REDIS_PORT
startDB(dbDir, portInner, PROJECT_TYPE)
import redis
@@ -120,7 +58,7 @@ def importShape():
split = pair.split("/")
shapeName = split[-2]
sizeCluster = split[-1].replace('.txt', '')
cmd = "bash " + join(INNER_DATA_PATH, 'redisSingleImport.sh') + " " + pair + " 6399 " + shapeName + "-" + sizeCluster;
cmd = "bash " + join(INNER_DATA_PATH, 'redisSingleImport.sh') + " " + pair + " "+REDIS_PORT+" " + shapeName + "-" + sizeCluster;
o, e = shellGitCheckout(cmd)
print(o)
@@ -132,43 +70,45 @@ def importShape():
key = shapeName + "-" + sizeCluster + "-" + k
#redis_db.set(key, v.strip())
redis_db.hset('filenames',key,v.strip())
redis_db.set("level","l1")
def tokenPairs():
global shapes, shape, sizes, clusters, cluster, actions, action, idx, val, pairs
# global shapes, shape, sizes, sf, clusters, cluster, files, indexCompared, out, idx, val, pairs, row, a, b
shapes = listdir(join(DATA_PATH, 'actions'))
shapes = [f for f in shapes if isdir(join(DATA_PATH, 'actions', f))]
if os.path.exists(join(DATA_PATH, 'pairsToken')):
import shutil
shutil.rmtree(join(DATA_PATH, 'pairsToken'))
# shapes = [rootType]
for shape in shapes:
sizes = listdir(join(DATA_PATH, 'actions', shape))
sizes = [f for f in sizes if isdir(join(DATA_PATH, 'actions', shape, f))]
for sf in sizes:
if sf.startswith('.'):
continue
if sf == '1':
continue
clusters = listdir(join(DATA_PATH, 'actions', shape, sf))
for cluster in clusters:
if cluster.startswith('.'):
continue
actions = listdir(join(DATA_PATH, 'actions', shape, sf, cluster))
for action in actions:
files = listdir(join(DATA_PATH, 'actions', shape, sf, cluster, action))
files = listdir(join(DATA_PATH, 'actions', shape, sf, cluster))
if len(files) > 1:
indexCompared = []
if not os.path.exists(join(DATA_PATH, 'pairsToken', shape, sf, cluster)):
os.makedirs(join(DATA_PATH, 'pairsToken', shape, sf, cluster))
if not os.path.exists(join(DATA_PATH, 'pairsToken', shape, sf)):
os.makedirs(join(DATA_PATH, 'pairsToken', shape, sf))
infexFile = join(DATA_PATH, 'pairsToken', shape, sf, cluster, action + '.index')
if isfile(infexFile):
test = pd.read_csv(infexFile, header=None, index_col=0)
indexFile = join(DATA_PATH, 'pairsToken', shape, sf, cluster + '.index')
if isfile(indexFile):
test = pd.read_csv(indexFile, header=None, index_col=0)
test.rename(columns={1: 'filename'}, inplace=True)
newFiles = [i for i in files if i not in test.filename.values.tolist()]
for newFile in newFiles:
test = test.append(pd.DataFrame(columns=['filename'], data=[newFile]), ignore_index=True)
indexCompared = test.index.values.tolist()
test.to_csv(infexFile, header=None)
test.to_csv(indexFile, header=None)
else:
with open(infexFile, 'w') as out:
with open(indexFile, 'w') as out:
# csv_out = csv.writer(out)
for idx, val in enumerate(files):
@@ -176,7 +116,8 @@ def tokenPairs():
indexCompared.append(str(idx))
pairs = list(itertools.combinations(indexCompared, 2))
pairsFile = join(DATA_PATH, 'pairsToken', shape, sf, cluster, action + '.txt')
pairsFile = join(DATA_PATH, 'pairsToken', shape, sf, cluster + '.txt')
if isfile(pairsFile):
test = pd.read_csv(pairsFile, header=None)
test['pairs'] = test.apply(lambda x: tuple([x[0], x[1]]), axis=1)
@@ -193,69 +134,12 @@ def tokenPairs():
a, b = row
out.write(a + ',' + b + '\n')
def actionPairs(rootType):
# global shapes, shape, sizes, sf, clusters, cluster, files, indexCompared, out, idx, val, pairs, row, a, b
# shapes = listdir(join(DATA_PATH, 'shapes'))
# shapes = [f for f in shapes if isdir(join(DATA_PATH, 'shapes', f))]
shapes = [rootType]
for shape in shapes:
sizes = listdir(join(DATA_PATH, 'shapes', shape))
sizes = [f for f in sizes if isdir(join(DATA_PATH, 'shapes', shape, f))]
for sf in sizes:
if sf.startswith('.'):
continue
clusters = listdir(join(DATA_PATH, 'shapes', shape, sf))
for cluster in clusters:
if cluster.startswith('.'):
continue
files = listdir(join(DATA_PATH, 'shapes', shape, sf, cluster))
indexCompared = []
if not os.path.exists(join(DATA_PATH, 'pairsAction', shape, sf)):
os.makedirs(join(DATA_PATH, 'pairsAction', shape, sf))
indexFile = join(DATA_PATH, 'pairsAction', shape, sf, cluster + '.index')
if isfile(indexFile):
test = pd.read_csv(indexFile, header=None, index_col=0)
test.rename(columns={1: 'filename'}, inplace=True)
newFiles = [i for i in files if i not in test.filename.values.tolist()]
for newFile in newFiles:
test = test.append(pd.DataFrame(columns=['filename'], data=[newFile]), ignore_index=True)
indexCompared = test.index.values.tolist()
test.to_csv(indexFile, header=None)
else:
with open(indexFile, 'w') as out:
# csv_out = csv.writer(out)
for idx, val in enumerate(files):
out.write(str(idx) + ',' + val + '\n')
indexCompared.append(str(idx))
pairs = list(itertools.combinations(indexCompared, 2))
pairsFile = join(DATA_PATH, 'pairsAction', shape, sf, cluster + '.txt')
if isfile(pairsFile):
test = pd.read_csv(pairsFile, header=None)
test['pairs'] = test.apply(lambda x: tuple([x[0], x[1]]), axis=1)
newPairs = [i for i in pairs if i not in test['pairs'].values.tolist()]
with open(pairsFile, 'w') as out:
# csv_out = csv.writer(out)
for row in newPairs:
a, b = row
out.write(a + ',' + b + '\n')
else:
with open(pairsFile, 'w') as out:
# csv_out = csv.writer(out)
for row in pairs:
a, b = row
out.write(a + ',' + b + '\n')
def shapePairs():
def actionPairs():
# global dbDir, portInner, redis_db, keys, matches, roots, sizes, sf, files, indexCompared, out, idx, val, pairs, row, a, b
# if not (isfile(join(DATA_PATH, 'studyDataset.pickle'))):
dbDir = join(INNER_DATA_PATH, 'redis')
portInner = '6399'
portInner = REDIS_PORT
startDB(dbDir, portInner, PROJECT_TYPE)
import redis
+14 -31
View File
@@ -1,12 +1,13 @@
from common.commons import *
DATA_PATH = os.environ["DATA_PATH"]
PROJECT_TYPE = os.environ["PROJECT_TYPE"]
REDIS_PORT = os.environ["REDIS_PORT"]
def statsNormal(isFixminer=True):
# tokens = join(DATA_PATH, 'tokens')
# actions = join(DATA_PATH, 'actions')
import redis
redis_db = redis.StrictRedis(host="localhost", port=6399, db=0)
redis_db = redis.StrictRedis(host="localhost", port=REDIS_PORT, db=0)
# keys = redis_db.scan(0, match='*', count='1000000')
keys = redis_db.hkeys("dump") # hkeys "dump"
matches = pd.DataFrame(keys, columns=['pairs_key'])
@@ -95,7 +96,7 @@ def statsNormal(isFixminer=True):
# for type in ['tokens', 'actions', 'shapes']:
for type in ['shapes']:
for type in ['actions']:
statsS,clusterDF = stats(type,isFixminer)
if isFixminer:
clusterDF = clusterDF[clusterDF.members.str.len() > 1]
@@ -136,25 +137,7 @@ def statsNormal(isFixminer=True):
matches
if isFixminer:
matches.to_csv(join(DATA_PATH, "stats" + type + ".csv"), index=False)
if type == 'actions':
clusterDF['ms'] = clusterDF.members.str.len()
clusterDF.sort_values(by='ms', ascending=False, inplace=True)
top50 = clusterDF.head(50)
top50['member'] = top50.members.apply(lambda x: x[0])
top50['cid'] = top50.cid.apply(lambda x: x[0])
top50['path'] = top50.apply(lambda x:x['cid'].replace('-','/')+'/'+x['member'],axis=1)
def readFile(x):
with open(join(DATA_PATH,'actions',x), 'r', encoding='utf-8') as writeFile:
lines = writeFile.read()
return lines
# if lines.startswith('UPD'):
# return lines
# else:
# return ''
# return lines
top50['pattern'] = top50.path.apply(lambda x:readFile(x))
top50[['cid','pattern']].to_csv('actionsPattern2verify.csv',index=False,header=None)
@@ -253,7 +236,7 @@ def stats(type,isFixminer=True):
continue
cs = listdir(join(shapesPath, shape, size, cluster))
if shapesPath.endswith('shapes'):
if shapesPath.endswith('actions'):
cs = listdir(join(shapesPath, shape, size, cluster))
statsCore(cs)
else:
@@ -262,14 +245,14 @@ def stats(type,isFixminer=True):
if action.startswith('.'):
continue
tokens = listdir(join(shapesPath, shape, size, cluster, action))
if shapesPath.endswith('actions'):
if shapesPath.endswith('tokens'):
statsCore(tokens)
else:
for token in tokens:
if token.startswith('.'):
continue
cs = listdir(join(shapesPath, shape, size, cluster, action, token))
statsCore(cs)
# else:
# for token in tokens:
# if token.startswith('.'):
# continue
# cs = listdir(join(shapesPath, shape, size, cluster, action, token))
# statsCore(cs)
return statsS,clustersDF
@@ -282,7 +265,7 @@ def defects4jStats(isFixminer=False):
mapping.rename(columns={0: 'repo', 1: "commit", 2: 'defects4jID'}, inplace=True)
dbDir = join(DATA_PATH, 'redis')
portInner = '6399'
portInner = REDIS_PORT
startDB(dbDir, portInner, PROJECT_TYPE )
import redis
@@ -474,8 +457,8 @@ cAst = ["unit","comment","literal","operator","modifier","name","type","conditio
def exportAbstractPatterns():
clusterStats,df = stats('shapes')
port = 6399
clusterStats,df = stats('actions')
port = REDIS_PORT
import redis
redis_db = redis.StrictRedis(host="localhost", port=port, db=0)
isJava = False
+2 -2
View File
@@ -1,5 +1,5 @@
from common.commons import *
REDIS_PORT = os.environ["REDIS_PORT"]
DATA_PATH = os.environ["DATA_PATH"]
ast = ["AnonymousClassDeclaration", "ArrayAccess", "ArrayCreation", "ArrayInitializer", "ArrayType", "AssertStatement",
"Assignment", "Block", "BooleanLiteral", "BreakStatement", "CastExpression", "CatchClause", "CharacterLiteral",
@@ -31,7 +31,7 @@ redis_db = redis.StrictRedis(host="localhost", port=port, db=0)
redis_db1 = redis.StrictRedis(host="localhost", port=port, db=1)
redis_db2 = redis.StrictRedis(host="localhost", port=port, db=2)
redis_out = redis.StrictRedis(host="localhost", port=6399, db=0)
redis_out = redis.StrictRedis(host="localhost", port=REDIS_PORT, db=0)
def getTokens(prefix, i):
dist2load = redis_db1.get(prefix + "-" + i);
@@ -73,18 +73,18 @@ public class Launcher {
String srcMLPath = (String) fixminer.get("srcMLPath");
// String parameter = args[2];
String parameter = "L1";
// String parameter = "L1";
String jobType = args[1];
// String jobType = "RICHEDITSCRIPT";
// String jobType = "COMPARE";
// jobType = "COMPARE";
mainLaunch( numOfWorkers, jobType, portDumps,projectType,input,redisPath,parameter, srcMLPath,hunkLimit,projectList,patchSize);
mainLaunch( numOfWorkers, jobType, portDumps,projectType,input,redisPath, srcMLPath,hunkLimit,projectList,patchSize);
}
public static void mainLaunch(String numOfWorkers, String jobType, String portDumps, String projectType, String input, String redisPath,String parameter,String srcMLPath,String hunkLimit,String[] projectList,String patchSize){
public static void mainLaunch(String numOfWorkers, String jobType, String portDumps, String projectType, String input, String redisPath,String srcMLPath,String hunkLimit,String[] projectList,String patchSize){
String dbDir;
@@ -100,42 +100,43 @@ public class Launcher {
try {
switch (jobType) {
case "RICHEDITSCRIPT":
EnhancedASTDiff.main(gumInput, portDumps, dbDir, dumpsName, srcMLPath,parameter,hunkLimit,projectList,patchSize,projectType);
EnhancedASTDiff.main(gumInput, portDumps, dbDir, dumpsName, srcMLPath,hunkLimit,projectList,patchSize,projectType);
break;
case "COMPARE":
String job;
String compareDBName;
switch (parameter){
case "L1":
// job = "shape";
job = "single";
compareDBName = "clusterl0-gumInputALL.rdb";
break;
case "L2":
job = "action";
compareDBName = "clusterl1-gumInputALL.rdb";
break;
case "L3":
job = "token";
compareDBName = "clusterl2-gumInputALL.rdb";
break;
default:
throw new Error("unknown level please specify L1,L2,L3");
}
// String job;
// String compareDBName;
// switch (parameter){
// case "L1":
//// job = "shape";
// job = "single";
// compareDBName = "clusterl0-gumInputALL.rdb";
// break;
// case "L2":
// job = "action";
// compareDBName = "clusterl1-gumInputALL.rdb";
// break;
// case "L3":
// job = "token";
// compareDBName = "clusterl2-gumInputALL.rdb";
// break;
// default:
// throw new Error("unknown level please specify L1,L2,L3");
// }
CompareTrees.main(redisPath, portDumps,dumpsName, job,numOfWorkers);
break;
case "PATTERN":
ClusterToPattern.main(portDumps,redisPath, dumpsName, parameter);
CompareTrees.main(redisPath, portDumps,dumpsName, numOfWorkers);
break;
// case "PATTERN":
// ClusterToPattern.main(portDumps,redisPath, dumpsName, parameter);
// break;
default:
throw new Error("unknown Job");
}
} catch (Exception e) {
log.error(e.getMessage());
// log.error(e.getMessage());
e.printStackTrace();
// e.printStackTrace();
}
@@ -1,134 +0,0 @@
package edu.lu.uni.serval.richedit;
import edu.lu.uni.serval.richedit.jobs.CompareTrees;
import edu.lu.uni.serval.richedit.jobs.EnhancedASTDiff;
import edu.lu.uni.serval.utils.ClusterToPattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
/**
* Created by anilkoyuncu on 14/04/2018.
*/
public class Launcher2 {
private static Logger log = LoggerFactory.getLogger(Launcher2.class);
public static void main(String[] args) throws IOException {
Properties appProps = new Properties();
String hostname = "Unknown";
try
{
InetAddress addr;
addr = InetAddress.getLocalHost();
hostname = addr.getHostName();
}
catch (UnknownHostException ex)
{
System.out.println("Hostname can not be resolved");
}
String appConfigPath;
if (hostname.equals("Unknown")){
appConfigPath = "src/main/resource/app.properties";
}
else{
appConfigPath = "src/main/resource/"+hostname+".app.properties";
}
// String appConfigPath = args[0];
appProps.load(new FileInputStream(appConfigPath));
String numOfWorkers = appProps.getProperty("numOfWorkers", "10");
String portDumps = appProps.getProperty("portDumps","6399");
String projectType = appProps.getProperty("projectType","java");
String hunkLimit = appProps.getProperty("hunkLimit","10");
String patchSize = appProps.getProperty("patchSize","50");
String projectL = appProps.getProperty("projectList","");
String[] projectList = projectL.split(",");
String input = appProps.getProperty("inputPath","FORKJOIN");
String redisPath = appProps.getProperty("redisPath","FORKJOIN");
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
// String parameter = args[2];
String parameter = "L1";
// String jobType = args[1];
// String jobType = "RICHEDITSCRIPT";
String jobType = "COMPARE";
mainLaunch( numOfWorkers, jobType, portDumps,projectType,input,redisPath,parameter, srcMLPath,hunkLimit,projectList,patchSize);
}
public static void mainLaunch(String numOfWorkers, String jobType, String portDumps, String projectType, String input, String redisPath,String parameter,String srcMLPath,String hunkLimit,String[] projectList,String patchSize){
String dbDir;
String dumpsName;
String gumInput;
dumpsName = "dumps-"+projectType+".rdb";
gumInput = input;
dbDir = redisPath;
try {
switch (jobType) {
case "RICHEDITSCRIPT":
EnhancedASTDiff.main(gumInput, portDumps, dbDir, dumpsName, srcMLPath,parameter,hunkLimit,projectList,patchSize,projectType);
break;
case "COMPARE":
String job;
String compareDBName;
switch (parameter){
case "L1":
// job = "shape";
job = "single";
compareDBName = "clusterl0-gumInputALL.rdb";
break;
case "L2":
job = "action";
compareDBName = "clusterl1-gumInputALL.rdb";
break;
case "L3":
job = "token";
compareDBName = "clusterl2-gumInputALL.rdb";
break;
default:
throw new Error("unknown level please specify L1,L2,L3");
}
CompareTrees.main(redisPath, portDumps,dumpsName, job,numOfWorkers);
break;
case "PATTERN":
ClusterToPattern.main(portDumps,redisPath, dumpsName, parameter);
break;
default:
throw new Error("unknown Job");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -23,52 +23,56 @@ public class EDiffHunkParser extends EDiffParser {
private static Logger logger = LoggerFactory.getLogger(EDiffHunkParser.class);
@Override
public void parseFixPatterns(File prevFile, File revFile, File diffentryFile, String project, JedisPool innerPool,String srcMLPath,String hunkLimit,boolean isJava) {
String datasetName = project;
String[] split1 = diffentryFile.getParent().split(datasetName);
String root = split1[0];
String pj = split1[1].split("/")[1];
try {
String datasetName = project;
String[] split1 = diffentryFile.getParent().split(datasetName);
String root = split1[0];
String pj = split1[1].split("/")[1];
List<HierarchicalActionSet> actionSets = parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath,isJava);
List<HierarchicalActionSet> actionSets = parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath, isJava);
if (actionSets != null && actionSets.size() != 0) {
if (actionSets != null && actionSets.size() != 0) {
boolean processActionSet = true;
boolean processActionSet = true;
if (actionSets.size() > Integer.valueOf(hunkLimit)) {
processActionSet = false;
logger.debug("Skipping {} set size {}", diffentryFile.getName(), hunkLimit);
}
if (actionSets.size() > Integer.valueOf(hunkLimit)) {
processActionSet = false;
logger.debug("Skipping {} set size {}", diffentryFile.getName(), hunkLimit);
}
int hunkSet = 0;
if (processActionSet) {
int hunkSet = 0;
if (processActionSet) {
for (HierarchicalActionSet actionSet : actionSets) {
for (HierarchicalActionSet actionSet : actionSets) {
// FileOutputStream f = null;
try {
// try {
String astNodeType = actionSet.getAstNodeType();
String astNodeType = actionSet.getAstNodeType();
// if (astNodeType.equals(rootType)){
//
// }
actionSet.toString();
int size = actionSet.getActionSize();
actionSet.toString();
int size = actionSet.getActionSize();
String key = astNodeType + "/" + String.valueOf(size) + "/" + pj + "_" + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
String key = astNodeType + "/" + String.valueOf(size) + "/" + pj + "_" + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
ITree targetTree = EDiffHelper.getTargets(actionSet,isJava);
ITree actionTree = EDiffHelper.getActionTrees(actionSet);
ITree shapeTree = EDiffHelper.getShapeTree(actionSet,isJava);
try (Jedis inner = innerPool.getResource()) {
ITree targetTree = EDiffHelper.getTargets(actionSet, isJava);
ITree actionTree = EDiffHelper.getActionTrees(actionSet);
ITree shapeTree = EDiffHelper.getShapeTree(actionSet, isJava);
ITree tokenTree = EDiffHelper.getTokenTree(actionSet,isJava);
String tokens = EDiffHelper.getNames2(tokenTree);
// EDiffHelper.getTokenTree(actionSet, parent, children, tc);
try (Jedis inner = innerPool.getResource()) {
inner.hset("dump", key, actionSet.toString());
inner.hset(key, "actionTree", actionTree.toStaticHashString());
inner.hset(key, "targetTree", targetTree.toStaticHashString());
inner.hset(key, "shapeTree", shapeTree.toStaticHashString());
}
inner.hset("dump", key, actionSet.toString());
inner.hset(key, "actionTree", actionTree.toStaticHashString());
inner.hset(key, "targetTree", targetTree.toStaticHashString());
inner.hset(key, "shapeTree", shapeTree.toStaticHashString());
inner.hset(key, "tokens", tokens);
}
// File f = new File(root+"dumps/"+astNodeType+"/"+String.valueOf(size)+"/");
// f.mkdirs();
// f = new File(root+"dumps/"+key);
@@ -82,18 +86,22 @@ public class EDiffHunkParser extends EDiffParser {
// oos.flush();
// oos.close();
} catch (Exception e) {
logger.error("error", e);
// e.printStackTrace();
// } catch (Exception e) {
// logger.error("error", e);
//// e.printStackTrace();
// }
hunkSet++;
}
try (Jedis inner = innerPool.getResource()) {
inner.hset("diffEntry", pj + "_" + diffentryFile.getName(), "1");
}
hunkSet++;
}
try (Jedis inner = innerPool.getResource()) {
inner.hset("diffEntry", pj + "_" + diffentryFile.getName(), "1");
}
}
}
}
} catch (Exception e) {
logger.error("error", e);
// e.printStackTrace();
}
}
@@ -59,7 +59,7 @@ public class EDiffParser extends Parser {
}
if (gumTreeResults == null) {
this.resultType = 1;
return null;
return actionSets;
} else if (gumTreeResults.size() == 0){
this.resultType = 2;
return actionSets;
@@ -31,6 +31,11 @@ public class HierarchicalRegrouper {
*/
List<HierarchicalActionSet> actionSets = new ArrayList<>();
HierarchicalActionSet actionSet = null;
if(actions == null){
return actionSets;
}
for(Action act : actions){
Action parentAct = findParentAction(act, actions);
if (parentAct == null) {
@@ -4,6 +4,7 @@ import edu.lu.uni.serval.utils.CallShell;
import edu.lu.uni.serval.utils.EDiffHelper;
import edu.lu.uni.serval.utils.PoolBuilder;
import me.tongfei.progressbar.ProgressBar;
import org.apache.commons.text.similarity.JaroWinklerDistance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
@@ -28,7 +29,7 @@ public class CompareTrees {
private static Logger log = LoggerFactory.getLogger(CompareTrees.class);
public static void main(String redisPath, String portDumps, String dumpsName, String job,String numOfWorkers) throws Exception {
public static void main(String redisPath, String portDumps, String dumpsName, String numOfWorkers) throws Exception {
// shape /Users/anil.koyuncu/projects/test/richedit-core/python/data/redis ALLdumps-gumInput.rdb clusterl0-gumInputALL.rdb /Users/anil.koyuncu/projects/test/richedit-core/python/data/richEditScript
@@ -55,6 +56,7 @@ public class CompareTrees {
// List<String> listOfPairs = AkkaTreeParser.getMessages(innerPool,Integer.valueOf(numOfWorkers));
HashMap<String, String> filenames = getFilenames(outerPool);
String job= getLevel(outerPool);
// List<String> listOfPairs = AkkaTreeParser.files2compare(outerPool);
@@ -69,12 +71,13 @@ public class CompareTrees {
}
IntStream stream = IntStream.range(0, compare.intValue());
String finalJob = job;
ProgressBar.wrap(stream.
parallel(),"Task").
forEach(m ->
{
newCoreCompare(job, errorPairs, filenames, outerPool);
newCoreCompare(finalJob, errorPairs, filenames, outerPool);
}
);
@@ -164,14 +167,16 @@ public class CompareTrees {
String keyName = split[0];
matchKey = keyName + "/" + (String.valueOf(i)) + "/" + String.valueOf(j);
if (matchKey == null){
return false;
}
Map<String, String> oldTreeString = EDiffHelper.getTreeString(keyName, i, outerPool, filenames);
Map<String, String> newTreeString = EDiffHelper.getTreeString(keyName, j, outerPool, filenames);
switch (treeType) {
case "single":
if (matchKey == null){
return false;
}
Map<String, String> oldTreeString = EDiffHelper.getTreeString(keyName, i, outerPool, filenames);
Map<String, String> newTreeString = EDiffHelper.getTreeString(keyName, j, outerPool, filenames);
String oldShapeTree =oldTreeString.get("shapeTree");
String newShapeTree =newTreeString.get("shapeTree");
@@ -196,6 +201,35 @@ public class CompareTrees {
}
}
return true;
case "token":
String oldTokens = oldTreeString.get("tokens");
String newTokens = newTreeString.get("tokens");
// EDiffHelper.getTokens(keyName, i, outerPool, filenames);
// newTree = EDiffHelper.getTokens(keyName, j, outerPool, innerPool);
// String oldTokens = EDiffHelper.getNames2(oldTree);
// String newTokens = EDiffHelper.getNames2(newTree);
//
JaroWinklerDistance jwd = new JaroWinklerDistance();
//
//
Double overallSimi = Double.valueOf(0);
//
if (!(oldTokens.trim().isEmpty() || newTokens.trim().isEmpty())) {
overallSimi = jwd.apply(oldTokens, newTokens);
}
int retval = Double.compare(overallSimi, Double.valueOf(1));
if (retval >= 0) {
try (Jedis jedis = outerPool.getResource()) {
jedis.select(3);
jedis.set(matchKey, "1");
}
}
return true;
default:
return true;
// break;
@@ -212,6 +246,35 @@ public class CompareTrees {
}
public static String getLevel(JedisPool innerPool){
HashMap<String, String> fileMap =new HashMap<String, String>();
try (Jedis inner = innerPool.getResource()) {
while (!inner.ping().equals("PONG")){
log.info("wait");
}
inner.select(1);
String level = inner.get("level");
switch (level){
case "l1":
return "single";
case "l2":
return "token";
default:
return "";
}
}
}
public static HashMap<String, String> getFilenames(JedisPool innerPool){
@@ -244,4 +307,7 @@ public class CompareTrees {
}
@@ -26,28 +26,28 @@ public class EnhancedASTDiff {
private static Logger log = LoggerFactory.getLogger(EnhancedASTDiff.class);
public static void main(String inputPath, String portInner, String dbDir, String chunkName,String srcMLPath,String parameter,String hunkLimit,String[] projectList,String patchSize,String projectType) throws Exception {
public static void main(String inputPath, String portInner, String dbDir, String chunkName,String srcMLPath,String hunkLimit,String[] projectList,String patchSize,String projectType) throws Exception {
String parameters = String.format("\nInput path %s",inputPath);
String parameters = String.format("\nInput path %s", inputPath);
log.info(parameters);
CallShell cs = new CallShell();
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
String cmd = "bash " + dbDir + "/" + "startServer.sh" + " %s %s %s";
cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(portInner));
cmd = String.format(cmd, dbDir, chunkName, Integer.valueOf(portInner));
cs.runShell(cmd, portInner);
JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1", Integer.valueOf(portInner), 20000000);
boolean isJava = false;
if (projectType.equals("java")){
isJava =true;
if (projectType.equals("java")) {
isJava = true;
}
File folder = new File(inputPath);
File[] listOfFiles = folder.listFiles();
if(listOfFiles == null){
if (listOfFiles == null) {
throw new Exception("No projects found, please verify the projects in the input path");
}
Stream<File> stream = Arrays.stream(listOfFiles);
@@ -58,8 +58,7 @@ public class EnhancedASTDiff {
.filter(x -> !x.getName().startsWith("cocci"))
.filter(x -> !x.getName().endsWith(".index"))
.collect(Collectors.toList());
}
else {
} else {
List<Predicate<File>> allPredicates = new ArrayList<Predicate<File>>();
for (String s : projectList) {
Predicate<File> predicate = x -> x.getName().endsWith(s);
@@ -69,20 +68,16 @@ public class EnhancedASTDiff {
.filter(x -> !x.getName().startsWith("."))
.filter(x -> !x.getName().startsWith("cocci"))
.filter(x -> !x.getName().endsWith(".index"))
.filter(allPredicates.stream().reduce(x->false, Predicate::or))
.filter(allPredicates.stream().reduce(x -> false, Predicate::or))
.collect(Collectors.toList());
}
String project = folder.getName();
List<MessageFile> allMessageFiles = new ArrayList<>();
for (File target : folders) {
for (File target : folders) {
List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/",project,patchSize,isJava); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/", project, patchSize, isJava); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
// msgFiles = msgFiles.subList(0,3000);
if (msgFiles == null)
@@ -113,7 +108,16 @@ public class EnhancedASTDiff {
}
);
}
// allMessageFiles.stream().
// parallel().
// forEach(m ->
// {
// EDiffHunkParser parser = new EDiffHunkParser();
// parser.parseFixPatterns(m.getPrevFile(), m.getRevFile(), m.getDiffEntryFile(), project, innerPool, srcMLPath, hunkLimit, finalIsJava);
// }
// );
}
@@ -71,15 +71,22 @@ public class EDiffHelper {
}
public static ITree getTokenTree(HierarchicalActionSet actionSet, ITree parent, ITree children,TreeContext tc){
public static ITree getTokenTree(HierarchicalActionSet actionSet, ITree parent, ITree children,TreeContext tc,boolean isJava){
int newType = 0;
String astNodeType = actionSet.getAstNodeType();
String label = actionSet.getAction().toString();
Map<Integer, String> nodeMap;
if(isJava){
nodeMap = ASTNodeMap.map;
}else{
nodeMap = NodeMap_new.map;
}
// List<Integer> keysByValue = getKeysByValue(ASTNodeMap.map, astNodeType);
List<Integer> keysByValue = getKeysByValue(NodeMap_new.map, astNodeType);
List<Integer> keysByValue = getKeysByValue(nodeMap, astNodeType);
if(keysByValue.size() != 1){
log.error("More than 1");
@@ -102,7 +109,7 @@ public class EDiffHelper {
if(actionSet.getParent() == null){
children = parent;
}
getTokenTree(subAction,children,null,tc);
getTokenTree(subAction,children,null,tc,isJava);
}
@@ -307,6 +314,17 @@ public class EDiffHelper {
return tree;
}
public static ITree getTokenTree(HierarchicalActionSet actionSet,boolean isJava) {
ITree tree = null;
ITree parent = null;
ITree children = null;
TreeContext tc = new TreeContext();
tree = EDiffHelper.getTokenTree(actionSet, parent, children, tc,isJava);
//tree.setParent(null);
tc.validate();
return tree;
}
public static ITree getTargets(HierarchicalActionSet actionSet,boolean isJava) {
@@ -420,13 +438,15 @@ public class EDiffHelper {
// String[] split = prefix.split("-");
// String key = split[0] + "/"+split[1]+"/" + dist2load;
//
// byte[] s = outer.hget("dump".getBytes(), key.getBytes());
// actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
// String s = outer.hget("dump", key);
// actionSet = (HierarchicalActionSet) EDiffHelper.fromString(s);
//
//// actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
//
// ITree parent = null;
// ITree children = null;
// TreeContext tc = new TreeContext();
// tree = EDiffHelper.getTokenTree(actionSet, parent, children, tc);
// tree = EDiffHelper.getTokenTree(actionSet, parent, children, tc,is);
// tree.setParent(null);
// tc.validate();
//// getLeaves(tree);
+10 -7
View File
@@ -7,12 +7,14 @@ coccinelle:
dataset:
# home: /Users/anilkoyuncu/projects/fixminer/fixminer-core/python/data/gumInputLinux
inputPath : /Users/anil.koyuncu/projects/fixminer/fixminer-data/patches
repo: /Users/anil.koyuncu/projects/datasets
inputPath : /Users/anil.koyuncu/projects/release/fixminer-data/patches
repo: /Users/anil.koyuncu/projects/release/fixminer-data/datasets
fixminer:
projectType : c
datapath: /Users/anil.koyuncu/projects/fixminer/fixminer-data/
projectType : java
datapath: /Users/anil.koyuncu/projects/release/fixminer-data/
pjName : patches
@@ -22,7 +24,8 @@ fixminer:
hunkLimit : 2
patchSize : 50
projectList : ALL
inputPath : /Users/anil.koyuncu/projects/fixminer/fixminer-data/patches
redisPath : /Users/anil.koyuncu/projects/fixminer/fixminer_source/python/data/redis
projectList : fuse
inputPath : /Users/anil.koyuncu/projects/release/fixminer-data/patches
redisPath : /Users/anil.koyuncu/projects/release/fixminer_source/python/data/redis
srcMLPath : /usr/local/bin/srcml