├── .github
└── workflows
│ └── maven.yml
├── .gitignore
├── .idea
├── .gitignore
├── .name
├── compiler.xml
├── encodings.xml
├── libraries
│ └── Maven__junit_junit_3_8_1.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── LICENSE.md
├── README.md
├── diffsearch.iml
├── images
├── demo.gif
├── diffsearch.jpg
├── diffsearch.pdf
├── diffsearch.png
├── diffsearch.svg
└── overview.png
├── installDiffSearch.bat
├── installDiffSearch.sh
├── pom.xml
└── src
├── main
├── java
│ ├── ProgrammingLanguage
│ │ ├── .gitkeep
│ │ └── Python
│ │ │ ├── Python3LexerBase.java
│ │ │ └── Python3ParserBase.java
│ ├── matching
│ │ ├── Matching.java
│ │ ├── NodeMap.java
│ │ └── NodeUtil.java
│ └── research
│ │ └── diffsearch
│ │ ├── Config.java
│ │ ├── Matching_Methods.java
│ │ ├── Mode.java
│ │ ├── main
│ │ ├── AbstractQueryMode.java
│ │ ├── AnalysisMode.java
│ │ ├── App.java
│ │ ├── BatchMode.java
│ │ ├── DatasetCreationMode.java
│ │ ├── EffectivenessMode.java
│ │ ├── FeatureExtractionMode.java
│ │ ├── GitCloneMode.java
│ │ ├── NormalMode.java
│ │ ├── ParseMode.java
│ │ ├── QueryMode.java
│ │ ├── QueryResultRelationMode.java
│ │ ├── RandomQueryCreation.java
│ │ ├── RemoveEqualCodeChanges.java
│ │ ├── ScalabilityMode.java
│ │ ├── WebGUIMode.java
│ │ └── WebMode.java
│ │ ├── pipeline
│ │ ├── EffectivenessPipeline.java
│ │ ├── MatchingPipeline.java
│ │ ├── OnlinePipeline.java
│ │ ├── RecallPipeline.java
│ │ ├── base
│ │ │ ├── CodeChange.java
│ │ │ ├── DiffsearchResult.java
│ │ │ ├── IndexedConsumer.java
│ │ │ ├── ParallelPipeline.java
│ │ │ ├── Pipeline.java
│ │ │ └── TimeoutPipeline.java
│ │ ├── extraction
│ │ │ ├── ChangeExtractor.java
│ │ │ ├── GitDiffExtractor.java
│ │ │ └── GitHubCloner.java
│ │ └── feature
│ │ │ ├── FeatureExtractionPipeline.java
│ │ │ ├── FeatureVector.java
│ │ │ ├── RemoveCollisionPipeline.java
│ │ │ ├── changedistilling
│ │ │ ├── EditScriptCreator.java
│ │ │ ├── EditScriptOperation.java
│ │ │ ├── Match.java
│ │ │ ├── MatchList.java
│ │ │ └── ParseTreeMatcher.java
│ │ │ ├── count
│ │ │ ├── DocumentFrequencyCounter.java
│ │ │ ├── RuleCountExtractor.java
│ │ │ └── TfIdfTransformer.java
│ │ │ └── extractor
│ │ │ ├── AbstractRecursiveFeatureExtractor.java
│ │ │ ├── DescendentFeatureExtractor.java
│ │ │ ├── DividedFeatureExtractor.java
│ │ │ ├── EditScriptExtractor.java
│ │ │ ├── FeatureExtractor.java
│ │ │ ├── NodeExtractor.java
│ │ │ ├── ParentChildFeatureExtractor.java
│ │ │ ├── SiblingFeatureExtractor.java
│ │ │ └── TriangleFeatureExtractor.java
│ │ ├── server
│ │ ├── DiffSearchWebServer.java
│ │ ├── JavaHTTPServer.java
│ │ ├── PythonRunner.java
│ │ └── WebServerGUI.java
│ │ ├── tree
│ │ ├── AbstractTree.java
│ │ ├── JavaTree.java
│ │ ├── JavascriptTree.java
│ │ ├── ParseTreeNode.java
│ │ ├── Python3Tree.java
│ │ ├── SerializableTreeNode.java
│ │ ├── TreeFactory.java
│ │ └── TreeUtils.java
│ │ └── util
│ │ ├── CommandLineUtil.java
│ │ ├── FilePathUtils.java
│ │ ├── ProgrammingLanguage.java
│ │ ├── ProgrammingLanguageDependent.java
│ │ ├── ProgressWatcher.java
│ │ └── Util.java
└── resources
│ ├── ANTLR
│ ├── ECMAScript.g4
│ ├── JavaLexer.g4
│ ├── JavaParser.g4
│ ├── Python3Lexer.g4
│ └── Python3Parser.g4
│ ├── Effectiveness
│ ├── 1
│ │ └── queries.txt
│ ├── 2
│ │ └── queries.txt
│ ├── 3
│ │ └── queries.txt
│ ├── 4
│ │ └── queries.txt
│ ├── 5
│ │ └── queries.txt
│ ├── 6
│ │ └── queries.txt
│ ├── 7
│ │ └── queries.txt
│ ├── 8
│ │ └── queries.txt
│ ├── 9
│ │ └── queries.txt
│ ├── 10
│ │ └── queries.txt
│ ├── 11
│ │ └── queries.txt
│ └── 12
│ │ └── queries.txt
│ ├── GUI
│ ├── Output
│ │ └── .readme.txt
│ └── readme.txt
│ ├── Input
│ ├── repositories_list.txt
│ ├── repositories_list_js.txt
│ ├── repositories_list_oliver.txt
│ ├── repositories_list_py.txt
│ ├── topJavaMavenProjects.json
│ ├── topJavaMavenProjects.txt
│ └── topJavaMavenProjects2.txt
│ ├── META-INF
│ └── MANIFEST.MF
│ ├── Python
│ ├── DiffSearch_effectiveness.py
│ ├── FAISS_Nearest_Neighbor_Search.py
│ ├── FAISS_indexing.py
│ ├── FAISS_indexing_python.py
│ ├── FAISS_indexing_scalability.py
│ ├── effectiveness_dataset_creation.py
│ ├── extract_N_Lines.py
│ ├── extract_dataset_userstudy.py
│ ├── get_FAISS_index_size.py
│ ├── git_dataset_build.py
│ ├── git_dataset_build_ONEcommit.py
│ ├── graphs_scalability.py
│ ├── result_changes.json
│ └── sstubs5.json
│ ├── QueryResult
│ ├── JS
│ │ └── JS_Results_Query_Relation.csv
│ ├── Java
│ │ └── Java_Results_scalability.csv
│ └── Python
│ │ └── Python_Results_Query_Relation.csv
│ ├── Recall
│ ├── ExpectedValues.csv
│ ├── Input
│ │ ├── full
│ │ │ ├── queriesForRecall_JAVA.txt
│ │ │ ├── queriesForRecall_JS.txt
│ │ │ └── queriesForRecall_PY.txt
│ │ ├── queriesForRecall_JAVA.txt
│ │ ├── queriesForRecall_JS.txt
│ │ ├── queriesForRecall_JS_old.txt
│ │ ├── queriesForRecall_PY (copy).txt
│ │ └── queriesForRecall_PY.txt
│ ├── Java
│ │ ├── ExpectedValues.csv
│ │ └── RecallResults_5000_1000.csv
│ ├── Output
│ │ ├── ExpectedValues.csv
│ │ ├── JS
│ │ │ ├── 10000_vl1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 1000_vl1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 20000_vl1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 5000_vl4000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 5000_vl500
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ └── more
│ │ │ │ ├── 1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ │ ├── 5000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ │ ├── 10000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ │ └── 20000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ ├── Python
│ │ │ ├── 10000vl1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ └── RecallResults.csv
│ │ │ ├── 1000vl1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ └── RecallResults.csv
│ │ │ ├── 20000vl1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ └── RecallResults.csv
│ │ │ ├── 5000_vl500
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 5000vl1000
│ │ │ │ ├── .~lock.RecallResults.csv#
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 5000vl2000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 5000vl4000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ └── morevl2000
│ │ │ │ ├── 1000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ │ ├── 10000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ │ └── 20000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ ├── RecallResults.csv
│ │ ├── changes_feature_vectors_js.csv
│ │ ├── changes_feature_vectors_py.csv
│ │ ├── expected.txt
│ │ └── zMore
│ │ │ ├── JS - workhorse
│ │ │ ├── 1000
│ │ │ │ ├── .~lock.RecallResults.csv#
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 5000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ ├── 10000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ └── 20000
│ │ │ │ ├── ExpectedValues.csv
│ │ │ │ ├── RecallResults.csv
│ │ │ │ └── expected.txt
│ │ │ └── Python
│ │ │ ├── 5000
│ │ │ ├── ExpectedValues.csv
│ │ │ ├── RecallResults.csv
│ │ │ └── expected.txt
│ │ │ ├── 10000
│ │ │ ├── ExpectedValues.csv
│ │ │ ├── RecallResults.csv
│ │ │ └── expected.txt
│ │ │ └── 20000
│ │ │ ├── ExpectedValues.csv
│ │ │ ├── RecallResults.csv
│ │ │ └── expected.txt
│ ├── RecallResults.csv
│ ├── expected.txt
│ └── run_recall_script.sh
│ ├── RecallResults.csv
│ ├── Scalability
│ ├── JS
│ │ ├── JS_Results_scalability.csv
│ │ └── scalability_queries.txt
│ ├── Java
│ │ ├── Java_Results_scalability_dinamic.csv
│ │ ├── Java_Results_scalability_first.csv
│ │ ├── scalability_queries.txt
│ │ └── scalability_slow.csv
│ ├── Java_Results_scalability.csv
│ ├── Python
│ │ ├── Python_Results_scalability.csv
│ │ ├── Results_scalability.csv
│ │ └── scalability_queries.txt
│ ├── Slow
│ │ ├── JS
│ │ │ ├── JS_Results_scalability.csv
│ │ │ └── scalability_queries.txt
│ │ ├── Java
│ │ │ ├── Java_Results_scalability.csv
│ │ │ └── scalability_queries.txt
│ │ └── Python
│ │ │ ├── Python_Results_scalability.csv
│ │ │ ├── Results_scalability.csv
│ │ │ └── scalability_queries.txt
│ └── graphs_scalability.py
│ ├── User Study
│ ├── dataset_userstudy.patch
│ ├── server_log.log
│ └── userstudy_regex.log
│ ├── batchOutput.txt
│ ├── frequency.csv
│ ├── logback.xml
│ ├── make_swap_file.sh
│ ├── queries.txt
│ ├── queriesForRecall.txt
│ ├── queriesForRecall_JAVA.txt
│ ├── queriesForRecall_JS.txt
│ ├── queriesForRecall_PY.txt
│ ├── queriesForRecall_PYTHON.txt
│ └── scalability_queryes.txt
└── test
└── java
└── research
└── diffsearch
├── AppTest.java
├── AppTest_AbstractQueryJava.java
├── AppTest_JavaScript.java
├── AppTest_Python.java
└── ExtractionTest.java
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3 |
4 | name: Java CI with Maven
5 |
6 | on:
7 | push:
8 | branches: '**'
9 | pull_request:
10 | branches: '**'
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v2
19 | - name: Set up JDK 11
20 | uses: actions/setup-java@v1
21 | with:
22 | java-version: '11'
23 | - name: Cache Maven packages
24 | uses: actions/cache@v2
25 | with:
26 | path: ~/.m2
27 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
28 | restore-keys: ${{ runner.os }}-m2
29 | - name: Test with Maven
30 | run: mvn -B package --file pom.xml test '-Dtest=AppTest_Python,AppTest,AppTest_JavaScript,AppTest_AbstractQueryJava,ExtractionTest'
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
2 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
3 |
4 | .idea
5 | /target/classes/research/diffsearch/*
6 | target/test-classes/research/diffsearch/*
7 |
8 | src/main/resources/GitHub_Java/
9 | src/main/resources/Features_Vectors/candidate_changes.txt
10 | src/main/resources/Features_Vectors/changes_strings.txt
11 | src/main/resources/Features_Vectors/changes_gitdiff.txt
12 | src/main/resources/Features_Vectors/changes_feature_vectors.csv
13 | src/main/resources/Features_Vectors/query_feature_vectors.csv
14 | src/main/resources/Features_Vectors/HTML_changes.txt
15 | src/main/resources/Features_Vectors/faiss.index
16 | src/main/resources/GitHub/git_changes9000.txt
17 | src/main/resources/Depth_Corpus/*
18 |
19 | *.patch
20 |
21 | # User-specific stuff
22 | .idea/**/workspace.xml
23 | .idea/**/tasks.xml
24 | .idea/**/usage.statistics.xml
25 | .idea/**/dictionaries
26 | .idea/**/shelf
27 |
28 | # Generated files
29 | .idea/**/contentModel.xml
30 |
31 | # Sensitive or high-churn files
32 | .idea/**/dataSources/
33 | .idea/**/dataSources.ids
34 | .idea/**/dataSources.local.xml
35 | .idea/**/sqlDataSources.xml
36 | .idea/**/dynamic.xml
37 | .idea/**/uiDesigner.xml
38 | .idea/**/dbnavigator.xml
39 |
40 | # Gradle
41 | .idea/**/gradle.xml
42 | .idea/**/libraries
43 |
44 | # Gradle and Maven with auto-import
45 | # When using Gradle or Maven with auto-import, you should exclude module files,
46 | # since they will be recreated, and may cause churn. Uncomment if using
47 | # auto-import.
48 | # .idea/artifacts
49 | # .idea/compiler.xml
50 | # .idea/jarRepositories.xml
51 | # .idea/modules.xml
52 | # .idea/*.iml
53 | # .idea/modules
54 | # *.iml
55 | # *.ipr
56 |
57 | # CMake
58 | cmake-build-*/
59 |
60 | # Mongo Explorer plugin
61 | .idea/**/mongoSettings.xml
62 |
63 | # File-based project format
64 | *.iws
65 |
66 | # IntelliJ
67 | #out/
68 |
69 | # mpeltonen/sbt-idea plugin
70 | .idea_modules/
71 |
72 | # JIRA plugin
73 | atlassian-ide-plugin.xml
74 |
75 | # Cursive Clojure plugin
76 | .idea/replstate.xml
77 |
78 | # Crashlytics plugin (for Android Studio and IntelliJ)
79 | com_crashlytics_export_strings.xml
80 | crashlytics.properties
81 | crashlytics-build.properties
82 | fabric.properties
83 |
84 | # Editor-based Rest Client
85 | .idea/httpRequests
86 |
87 | # Android studio 3.1+ serialized cache file
88 | .idea/caches/build_file_checksums.ser
89 |
90 | # Compiled class file
91 | *.class
92 |
93 | # Log file
94 | *.log
95 |
96 | # BlueJ files
97 | *.ctxt
98 |
99 | # Mobile Tools for Java (J2ME)
100 | .mtj.tmp/
101 |
102 | # Package Files #
103 | *.jar
104 | *.war
105 | *.nar
106 | *.ear
107 | *.zip
108 | *.tar.gz
109 | *.rar
110 |
111 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
112 | hs_err_pid*
113 |
114 | patch/
115 | patch_python/
116 | Features_Vectors/
117 | target/
118 |
119 | # ANTLR4 generated files
120 | *.interp
121 | *.tokens
122 |
123 | # ANTLR4 generated Java source code
124 | src/main/java/ProgrammingLanguage/**/*.java
125 | src/main/resources/ANTLR/.antlr/
126 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /workspace.xml
3 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | diffsearch
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__junit_junit_3_8_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | MIT License
4 |
5 | Copyright 2022 Software Lab at University of Stuttgart
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 |
9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 |
13 |
--------------------------------------------------------------------------------
/images/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/images/demo.gif
--------------------------------------------------------------------------------
/images/diffsearch.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/images/diffsearch.jpg
--------------------------------------------------------------------------------
/images/diffsearch.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/images/diffsearch.pdf
--------------------------------------------------------------------------------
/images/diffsearch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/images/diffsearch.png
--------------------------------------------------------------------------------
/images/overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/images/overview.png
--------------------------------------------------------------------------------
/installDiffSearch.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: Script to install DiffSearch
3 |
4 | :: Run the script:
5 | :: ./installDiffSearch.bat
6 |
7 | echo Setting up virtual environment
8 | virtualenv diffsearch-env && (
9 | echo Finished setting up virtual environment
10 | ) || (
11 | (echo Y | rd /s diffsearch-env) > nul
12 | echo Failed to setup virtualenv..Aborting the setup 1>&2
13 | exit /b 1
14 | )
15 |
16 | echo Activating the virtual environment
17 | call diffsearch-env\Scripts\activate.bat && (
18 | echo Virtual environment activated
19 | ) || (
20 | (echo Y | rd /s diffsearch-env) > nul
21 | echo Failed to activate virtualenv..Aborting the setup 1>&2
22 | exit /b 1
23 | )
24 |
25 | echo Installing faiss..
26 | pip3 install faiss-cpu && (
27 | echo Installed faiss
28 | ) || (
29 | (echo Y | rd /s diffsearch-env) > nul
30 | echo Failed to install Faiss..Aborting the setup 1>&2
31 | exit /b 1
32 | )
33 |
34 | echo Installing numpy
35 | pip3 install numpy && (
36 | echo Installed numpy
37 | ) || (
38 | (echo Y | rd /s diffsearch-env) > nul
39 | echo Failed to install numpy..Aborting the setup 1>&2
40 | exit /b 1
41 | )
42 |
43 | echo Installing pandas
44 | pip3 install pandas && (
45 | echo Installed pandas
46 | ) || (
47 | (echo Y | rd /s diffsearch-env) > nul
48 | echo Failed to install pandas..Aborting the setup 1>&2
49 | exit /b 1
50 | )
51 |
52 | echo Installing dask
53 | pip3 install dask[dataframe] && (
54 | echo Installed dask
55 | ) || (
56 | (echo Y | rd /s diffsearch-env) > nul
57 | echo Failed to install dask..Aborting the setup 1>&2
58 | exit /b 1
59 | )
60 |
61 | echo Creating and copying required folders and files
62 | mkdir src\main\resources\Features_Vectors && (
63 | echo Created Features_Vectors folder in resources
64 | ) || (
65 | (echo Y | rd /s diffsearch-env) > nul
66 | echo Failed to create Features_Vectors folder in resources.. Aborting the setup 1>&2
67 | exit /b 1
68 | )
69 |
70 | (type nul > src\main\resources\Features_Vectors\server_log.log) && (
71 | echo Created server_log file
72 | ) || (
73 | echo Failed to create server_log file.. Aborting the setup
74 | (echo Y | rd /s diffsearch-env) > nul
75 | (echo Y | rd /s src\main\resources\Features_Vectors) > nul
76 | exit /b 1
77 | )
78 |
79 | :: To get the direct download link: https://bydik.com/onedrive-direct-link/
80 | (powershell -Command "iwr -outf src\main\resources\Features_Vectors\index.zip -Uri 'https://onedrive.live.com/download?cid=C19790BB35A78C2C&resid=C19790BB35A78C2C%%2114267&authkey=AJp_CBLDdCH1X1A'") && (
81 | echo Downloaded the zip file
82 | ) || (
83 | echo Failed to download the required files.. Aborting the setup 1>&2
84 | (echo Y | rd /s diffsearch-env) > nul
85 | (echo Y | rd /s src\main\resources\Features_Vectors) > nul
86 | exit /b 1
87 | )
88 |
89 | powershell -Command "Expand-Archive -Force src\main\resources\Features_Vectors\index.zip -d src\main\resources\Features_Vectors" && (
90 | (echo Y | del src\main\resources\Features_Vectors\index.zip) > nul
91 | echo Extracted the files
92 | ) || (
93 | echo Extraction failed.. Aborting the setup
94 | (echo Y | rd /s diffsearch-env) > nul
95 | (echo Y | rd /s src\main\resources\Features_Vectors) > nul
96 | exit /b 1
97 | )
98 | echo Setup done... You can compile now.
99 |
--------------------------------------------------------------------------------
/installDiffSearch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | # Script to install DiffSearch
3 |
4 | # Run the script:
5 | #chmod 754 installDiffSearch.sh
6 | #./installDiffSearch.sh
7 |
8 | echo Setting up virtual environment
9 | if virtualenv -p /usr/bin/python3 diffsearch-env; then
10 | echo Finished setting up virtual environment
11 | else
12 | rm -rf diffsearch-env
13 | echo Failed to setup virtualenv..Aborting the setup 1>&2
14 | exit 1
15 | fi
16 | echo Activating the virtual environment
17 | if source diffsearch-env/bin/activate; then
18 | echo Virtual environment activated
19 | else
20 | rm -rf diffsearch-env
21 | echo Failed to activate virtualenv..Aborting the setup 1>&2
22 | exit 1
23 | fi
24 | echo Installing faiss..
25 | if pip3 install faiss-cpu; then
26 | echo Installed faiss
27 | else
28 | rm -rf diffsearch-env
29 | echo Failed to install Faiss..Aborting the setup 1>&2
30 | exit 1
31 | fi
32 | echo Installing numpy
33 | if pip3 install numpy; then
34 | echo Installed numpy
35 | else
36 | rm -rf diffsearch-env
37 | echo Failed to install numpy..Aborting the setup 1>&2
38 | exit 1
39 | fi
40 | echo Installing pandas
41 | if pip3 install pandas; then
42 | echo Installed pandas
43 | else
44 | rm -rf diffsearch-env
45 | echo Failed to install pandas..Aborting the setup 1>&2
46 | exit 1
47 | fi
48 | echo Installing dask
49 | if pip3 install dask[dataframe]; then
50 | echo Installed dask
51 | else
52 | rm -rf diffsearch-env
53 | echo Failed to install dask..Aborting the setup 1>&2
54 | exit 1
55 | fi
56 | echo Creating and copying required folders and files
57 | if mkdir -p src/main/resources/Features_Vectors; then
58 | echo Created Features_Vectors folder in resources
59 | else
60 | echo Failed to create Features_Vectors folder in resources.. Aborting the setup
61 | rm -rf diffsearch-env 1>&2
62 | exit 1
63 | fi
64 | if touch src/main/resources/Features_Vectors/server_log.log; then
65 | echo Created server_log file
66 | else
67 | echo Failed to create server_log file.. Aborting the setup
68 | rm -rf diffsearch-env 1>&2
69 | exit 1
70 | fi
71 | # To get the direct download link: https://bydik.com/onedrive-direct-link/
72 | if wget -O src/main/resources/Features_Vectors/index.zip 'https://onedrive.live.com/download?cid=C19790BB35A78C2C&resid=C19790BB35A78C2C%2114267&authkey=AJp_CBLDdCH1X1A'; then
73 | echo Downloaded the zip file
74 | else
75 | echo Failed to download the required files.. Aborting the setup
76 | rm -rf diffsearch-env 1>&2
77 | exit 1
78 | fi
79 | if unzip src/main/resources/Features_Vectors/index.zip -d src/main/resources/Features_Vectors/; then
80 | rm -rf src/main/resources/Features_Vectors/index.zip
81 | echo Extracted the files
82 | else
83 | echo Extraction failed.. Aborting the setup
84 | rm -rf diffsearch-env 1>&2
85 | exit 1
86 | fi
87 | echo Setup done... You can compile now.
88 |
--------------------------------------------------------------------------------
/src/main/java/ProgrammingLanguage/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/java/ProgrammingLanguage/.gitkeep
--------------------------------------------------------------------------------
/src/main/java/ProgrammingLanguage/Python/Python3ParserBase.java:
--------------------------------------------------------------------------------
1 | package ProgrammingLanguage.Python;
2 |
3 | import org.antlr.v4.runtime.*;
4 | import org.antlr.v4.runtime.tree.ErrorNode;
5 | import org.antlr.v4.runtime.tree.ParseTreeListener;
6 | import org.antlr.v4.runtime.tree.TerminalNode;
7 |
8 | public abstract class Python3ParserBase extends Parser {
9 | protected Python3ParserBase(TokenStream input) {
10 | super(input);
11 | }
12 |
13 | public boolean CannotBePlusMinus() {
14 | return true;
15 | }
16 |
17 | public boolean CannotBeDotLpEq() {
18 | return true;
19 | }
20 |
21 | /**
22 | * Modified to not include {@code \n} nodes in parse tree;
23 | * Original Documentation:
24 | *
25 | * {@inheritDoc}
26 | */
27 | @Override
28 | public Token consume() {
29 | Token o = getCurrentToken();
30 | if (o.getType() != EOF) {
31 | getInputStream().consume();
32 | }
33 | boolean hasListener = _parseListeners != null && !_parseListeners.isEmpty();
34 | if (_buildParseTrees || hasListener) {
35 | if ( _errHandler.inErrorRecoveryMode(this) ) {
36 | ErrorNode node = _ctx.addErrorNode(createErrorNode(_ctx,o));
37 | if (_parseListeners != null) {
38 | for (ParseTreeListener listener : _parseListeners) {
39 | listener.visitErrorNode(node);
40 | }
41 | }
42 | }
43 | else if (!o.getText().equals("\n")) {
44 |
45 | TerminalNode node = _ctx.addChild(createTerminalNode(_ctx,o));
46 | if (_parseListeners != null) {
47 | for (ParseTreeListener listener : _parseListeners) {
48 | listener.visitTerminal(node);
49 | }
50 | }
51 | }
52 | }
53 | return o;
54 | }
55 | }
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/Mode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch;
2 |
3 | public class Mode {
4 | public static boolean ABSTRACT_QUERY = false;
5 | public static boolean QUERYRESULT = false;
6 | /**
7 | * Run DiffSearch Evaluation as a command line app.
8 | */
9 | public static boolean SCALABILITY = false;
10 | /**
11 | * Run DiffSearch as a command line app.
12 | */
13 | public static boolean NORMAL = false;
14 | /**
15 | * Run DiffSearch as a web app.
16 | */
17 | public static boolean WEB = false;
18 | /**
19 | * Run DiffSearch as a web gui app.
20 | */
21 | public static boolean WEB_GUI = true;
22 | /**
23 | * If true, DiffSearch starts in query mode. This will execute a single query.
24 | *
25 | * @see Config#query
26 | */
27 | public static boolean QUERY_MODE = false;
28 | /**
29 | * If true, detailed feature vector analysis and parse tree will be printed.
30 | */
31 | public static boolean ANALYSIS_MODE = false;
32 | public static boolean PARSE_MODE = false;
33 | public static boolean DATASET_CREATION = false;
34 | /**
35 | * If true, DiffSearch will run in Batch mode. This will process all queries of a text file and
36 | * save the results to an output file. This will not store results if {@link Config#SILENT} is true.
37 | */
38 | public static boolean BATCH = false;
39 | /**
40 | * If true, DiffSearch will not run to execute queries but to extract the features of the corpus
41 | * and build an index.
42 | */
43 | public static boolean CORPUS_FEATURE_EXTRACTION = false;
44 |
45 | public static boolean GIT_CLONE = false;
46 |
47 | public static boolean EFFECTIVENESS = false;
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/AnalysisMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.feature.FeatureExtractionPipeline;
7 | import research.diffsearch.tree.TreeFactory;
8 | import research.diffsearch.util.Util;
9 |
10 | public class AnalysisMode extends App {
11 | private static final Logger logger = LoggerFactory.getLogger(AnalysisMode.class);
12 |
13 | @Override
14 | public void run() {
15 | String query = Config.query;
16 | logger.info("Analysing " + query);
17 | var tree = TreeFactory.getAbstractTree(query, Config.PROGRAMMING_LANGUAGE);
18 |
19 | if (tree.getParser().getNumberOfSyntaxErrors() > 0 ) {
20 | logger.warn("Code change has syntax errors.");
21 | }
22 |
23 | Util.printParseTree(tree);
24 | Util.printFeatureVectorAnalysis(FeatureExtractionPipeline.getDefaultFeatureExtractionPipeline(true)
25 | .extractFeatures(tree.getParseTree()));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/BatchMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.OnlinePipeline;
7 | import research.diffsearch.pipeline.RecallPipeline;
8 | import research.diffsearch.util.Util;
9 |
10 | import java.io.FileOutputStream;
11 | import java.io.IOException;
12 | import java.io.PrintStream;
13 | import java.net.Socket;
14 |
15 | import static com.google.common.collect.Lists.newArrayList;
16 | import static research.diffsearch.util.FilePathUtils.getAllLines;
17 |
18 | /**
19 | * This mode is used to run a batch file of queries.
20 | *
21 | * Usage: diffsearch -b queries_file output_file.
22 | *
23 | * @author Paul Bredl
24 | * @author Luca Di Grazia
25 | */
26 | public class BatchMode extends App {
27 |
28 | private static final Logger logger = LoggerFactory.getLogger(BatchMode.class);
29 |
30 | @Override
31 | public void run() {
32 | try (FileOutputStream outputStream = new FileOutputStream(Config.batchOutput)) {
33 | startPythonServer();
34 | logger.info("DiffSearch in Batch mode");
35 |
36 | Socket socketFaiss = getFaissSocket();
37 |
38 | var queries = newArrayList(getAllLines(Config.batchFilePath));
39 |
40 | new OnlinePipeline(socketFaiss, Config.PROGRAMMING_LANGUAGE)
41 | .connectIf(Config.MEASURE_RECALL, new RecallPipeline(Config.PROGRAMMING_LANGUAGE, queries))
42 | .peek(result -> Util.printOutputList(result,
43 | new PrintStream(outputStream, true), false))
44 | .execute(queries);
45 |
46 | } catch (IOException exception) {
47 | logger.error(exception.getMessage(), exception);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/GitCloneMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.base.Pipeline;
7 | import research.diffsearch.pipeline.extraction.GitHubCloner;
8 | import research.diffsearch.util.FilePathUtils;
9 |
10 | import java.io.File;
11 | import java.util.function.Function;
12 |
13 | public class GitCloneMode extends App {
14 | private static final Logger logger = LoggerFactory.getLogger(GitCloneMode.class);
15 |
16 | @Override
17 | public void run() {
18 | new File(Config.repositoryPath).mkdir();
19 |
20 | Pipeline.from((Function) s -> {
21 | logger.info("Cloning {}", s);
22 | return s;
23 | }).connect(new GitHubCloner(Config.repositoryPath))
24 | .execute(FilePathUtils.getAllLines(Config.listOfRepositoriesPath),
25 | FilePathUtils.getNumberOfLines(Config.listOfRepositoriesPath));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/NormalMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.OnlinePipeline;
7 | import research.diffsearch.pipeline.RecallPipeline;
8 | import research.diffsearch.util.Util;
9 |
10 | import java.io.IOException;
11 | import java.net.Socket;
12 | import java.util.Scanner;
13 |
14 | /**
15 | * @author Paul Bredl
16 | * @author Luca Di Grazia
17 | */
18 | public class NormalMode extends App {
19 |
20 | private static final Logger logger = LoggerFactory.getLogger(NormalMode.class);
21 |
22 | private final Scanner scanner = new Scanner(System.in);
23 |
24 | private String readLine() {
25 | System.out.println("Enter a query or --exit to quit.");
26 | return scanner.nextLine();
27 | }
28 |
29 | @Override
30 | public void run() {
31 | try {
32 | startPythonServer();
33 |
34 | Socket socketFaiss = getFaissSocket();
35 | String nextLine;
36 |
37 | while (!(nextLine = readLine()).equals("--exit")) {
38 | new OnlinePipeline(socketFaiss, Config.PROGRAMMING_LANGUAGE)
39 | // add recall pipeline if necessary
40 | .connectIf(Config.MEASURE_RECALL, new RecallPipeline(Config.PROGRAMMING_LANGUAGE, nextLine))
41 | .peek(result -> logger.info("Found {} results", result.getResults().size()))
42 | .peek(Util::printOutputList)
43 | .execute(nextLine);
44 | }
45 | } catch (IOException exception) {
46 | logger.error(exception.getMessage(), exception);
47 | }
48 |
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/ParseMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.antlr.v4.runtime.tree.ParseTree;
4 | import org.antlr.v4.runtime.tree.Tree;
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import research.diffsearch.Config;
8 | import research.diffsearch.pipeline.base.Pipeline;
9 | import research.diffsearch.tree.SerializableTreeNode;
10 | import research.diffsearch.tree.TreeFactory;
11 | import research.diffsearch.util.ProgressWatcher;
12 | import research.diffsearch.util.Util;
13 |
14 | import java.io.IOException;
15 |
16 | import static research.diffsearch.util.FilePathUtils.*;
17 |
18 | public class ParseMode extends App {
19 | private static final Logger logger = LoggerFactory.getLogger(ParseMode.class);
20 |
21 | @Override
22 | public void run() {
23 | var lang = Config.PROGRAMMING_LANGUAGE;
24 | var numberOfLines = getNumberOfLines(getChangesJsonFilePath(lang));
25 |
26 | try {
27 | // first parse code changes
28 | Pipeline
29 | // check for correct formatting and illegal characters
30 | .from(Util::formatCodeChange)
31 | // parse with ANTLR
32 | .connect(ParseMode::parseCodeChange)
33 | .connect(ParseMode::toSerializableTree)
34 | .parallelUntilHere(Config.threadCount)
35 | // show progress in console:
36 | .connect(new ProgressWatcher<>("Parsing code changes"))
37 | // store parse trees in file
38 | .connect(getJSONFileWriterPipeline(getTreesFilePath(lang)))
39 | .executeIgnoreResults(getAllLines(getChangesJsonFilePath(lang), numberOfLines));
40 | } catch (IOException e) {
41 | logger.error(e.getMessage(), e);
42 | }
43 | }
44 |
45 | private static ParseTree parseCodeChange(String cc) {
46 | return TreeFactory.getAbstractTree(cc, Config.PROGRAMMING_LANGUAGE).getParseTree();
47 | }
48 |
49 | private static Tree toSerializableTree(ParseTree absTree) {
50 | return SerializableTreeNode.fromTree(absTree, Config.PROGRAMMING_LANGUAGE);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/QueryMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.OnlinePipeline;
7 | import research.diffsearch.pipeline.RecallPipeline;
8 | import research.diffsearch.util.Util;
9 |
10 | import java.io.IOException;
11 | import java.net.Socket;
12 |
13 | /**
14 | * DiffSearch mode that executes a single query.
15 | *
16 | * Usage: diffsearch -q query_string
17 | *
18 | * @author Paul Bredl
19 | * @author Luca Di Grazia
20 | */
21 | public class QueryMode extends App {
22 |
23 | private static final Logger logger = LoggerFactory.getLogger(QueryMode.class);
24 |
25 | @Override
26 | public void run() {
27 | try {
28 | startPythonServer();
29 | logger.info("DiffSearch in Query mode");
30 |
31 | Socket socketFaiss = getFaissSocket();
32 |
33 | new OnlinePipeline(socketFaiss, Config.PROGRAMMING_LANGUAGE)
34 | // add recall pipeline if necessary
35 | .connectIf(Config.MEASURE_RECALL, new RecallPipeline(Config.PROGRAMMING_LANGUAGE, Config.query))
36 | .peek(result -> logger.info("Found {} results", result.getResults().size()))
37 | .peek(Util::printOutputList)
38 | .execute(Config.query);
39 | } catch (IOException exception) {
40 | logger.error(exception.getMessage(), exception);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/RemoveEqualCodeChanges.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import research.diffsearch.pipeline.MatchingPipeline;
4 | import research.diffsearch.pipeline.base.Pipeline;
5 |
6 | import java.io.IOException;
7 |
8 | import static research.diffsearch.util.FilePathUtils.*;
9 | import static research.diffsearch.util.ProgrammingLanguage.JAVA;
10 |
11 | /**
12 | * Removes code changes of the form a --> a.
13 | * @author Paul Bredl
14 | */
15 | public class RemoveEqualCodeChanges {
16 |
17 | public static void main(String[] args) throws IOException {
18 | var codeChanges = getCodeChanges(JAVA);
19 | Pipeline
20 | .getFilter(MatchingPipeline::isNotEqualCodeChange)
21 | .connect(getStringFileWriterPipeline(getChangesFilePath(JAVA) + ".copy"))
22 | .execute(codeChanges);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/WebGUIMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.server.WebServerGUI;
7 |
8 | import java.io.FileOutputStream;
9 | import java.io.IOException;
10 | import java.net.ServerSocket;
11 | import java.net.Socket;
12 |
13 | /**
14 | * @author Paul Bredl
15 | * @author Luca Di Grazia
16 | */
17 | public class WebGUIMode extends App {
18 |
19 | private static final Logger logger = LoggerFactory.getLogger(WebGUIMode.class);
20 |
21 | @Override
22 | public void run() {
23 | Socket socket;
24 | Socket socketFaiss;
25 | ServerSocket server;
26 | FileOutputStream serverLog;
27 | try {
28 | startPythonServer();
29 |
30 | socketFaiss = getFaissSocket();
31 | server = getDiffSearchServerSocket();
32 | serverLog = getServerLog();
33 |
34 | } catch (IOException exception) {
35 | logger.error(exception.getMessage(), exception);
36 | return;
37 | }
38 | while (true) {
39 | try {
40 | logger.info("Waiting request on port " + Config.port_web);
41 | socket = server.accept();
42 | WebServerGUI client = new WebServerGUI(socket, socketFaiss, serverLog);
43 | client.start();
44 | } catch (IOException e) {
45 | logger.error(e.getMessage(), e);
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/main/WebMode.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.main;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.server.DiffSearchWebServer;
7 |
8 | import java.io.FileOutputStream;
9 | import java.io.IOException;
10 | import java.net.ServerSocket;
11 | import java.net.Socket;
12 |
13 | /**
14 | * DiffSearch web mode. Shows a simple gui to execute queries.
15 | *
16 | * @author Paul Bredl
17 | * @author Luca Di Grazia
18 | */
19 | public class WebMode extends App {
20 |
21 | private static final Logger logger = LoggerFactory.getLogger(WebMode.class);
22 |
23 | @Override
24 | public void run() {
25 | startPythonServer();
26 |
27 | Socket socketFaiss;
28 | Socket socket;
29 | ServerSocket server;
30 |
31 | FileOutputStream serverLog;
32 | try {
33 | serverLog = getServerLog();
34 | server = getDiffSearchServerSocket();
35 | socketFaiss = getFaissSocket();
36 | } catch (IOException exception) {
37 | logger.error(exception.getMessage(), exception);
38 | return;
39 | }
40 |
41 | while (true) {
42 | try {
43 | logger.debug("Waiting request on port " + Config.port_web);
44 | socket = server.accept();
45 | DiffSearchWebServer client = new DiffSearchWebServer(socket, socketFaiss, serverLog);
46 | client.start();
47 | } catch (IOException e) {
48 | logger.error(e.getMessage(), e);
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/EffectivenessPipeline.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.main.App;
7 | import research.diffsearch.main.NormalMode;
8 | import research.diffsearch.pipeline.OnlinePipeline;
9 | import research.diffsearch.pipeline.RecallPipeline;
10 | import research.diffsearch.util.Util;
11 |
12 | import java.io.BufferedReader;
13 | import java.io.FileInputStream;
14 | import java.io.IOException;
15 | import java.io.InputStreamReader;
16 | import java.net.Socket;
17 | import java.util.Scanner;
18 |
19 | public class EffectivenessPipeline extends App {
20 |
21 | private static final Logger logger = LoggerFactory.getLogger(NormalMode.class);
22 |
23 | private final Scanner scanner = new Scanner(System.in);
24 |
25 | private String readLine() {
26 | //System.out.println("Enter a query or --exit to quit.");
27 | return "ID.ID<0>(); --> ID.ID<0>();";
28 | }
29 |
30 | @Override
31 | public void run() {
32 | try {
33 | startPythonServer();
34 |
35 | Socket socketFaiss = getFaissSocket();
36 | String nextQuery;
37 |
38 | Config.simpleBugPattern = 0;
39 |
40 | while(Config.simpleBugPattern < 12) {
41 |
42 | Config.simpleBugPattern++;
43 |
44 | FileInputStream fstream = new FileInputStream("./src/main/resources/Effectiveness/" + Config.simpleBugPattern + "/queries.txt");
45 | BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
46 |
47 | while ((nextQuery = br.readLine()) != null) {
48 | new OnlinePipeline(socketFaiss, Config.PROGRAMMING_LANGUAGE)
49 | // add recall pipeline if necessary
50 | .connectIf(Config.MEASURE_RECALL, new RecallPipeline(Config.PROGRAMMING_LANGUAGE, nextQuery))
51 | .peek(result -> logger.info("Found {} results", result.getResults().size()))
52 | .peek(Util::printOutputList)
53 | .execute(nextQuery);
54 | System.out.println("ok");
55 |
56 | }
57 | }
58 | } catch (IOException exception) {
59 | logger.error(exception.getMessage(), exception);
60 | }
61 |
62 |
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/base/IndexedConsumer.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.base;
2 |
3 | /**
4 | * Helper interface for pipelines.
5 | *
6 | * @author Paul Bredl
7 | */
8 | public interface IndexedConsumer {
9 |
10 | void accept(O result, int index);
11 |
12 | default void skip(int index) {
13 | accept(null, index);
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/base/TimeoutPipeline.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.base;
2 |
3 | import org.slf4j.LoggerFactory;
4 |
5 | import java.util.concurrent.Executors;
6 | import java.util.concurrent.ScheduledExecutorService;
7 | import java.util.concurrent.TimeUnit;
8 |
9 | /**
10 | * Pipeline that times out the processing of an input after a certain time.
11 | *
12 | * @author Paul Bredl
13 | */
14 | public class TimeoutPipeline implements Pipeline {
15 |
16 | private volatile boolean[] processed;
17 | private final long timeoutMillis;
18 | private ScheduledExecutorService executorService;
19 | private final Pipeline basePipeline;
20 | private final O defaultResult;
21 |
22 | public TimeoutPipeline(long timeout, TimeUnit timeUnit, Pipeline basePipeline, O defaultResult) {
23 | this.timeoutMillis = timeUnit.toMillis(timeout);
24 | this.basePipeline = basePipeline;
25 | this.defaultResult = defaultResult;
26 | }
27 |
28 | @Override
29 | public O process(I input, int index) {
30 | throw new IllegalStateException(); // unused
31 | }
32 |
33 | @Override
34 | public void process(I input, int index, IndexedConsumer outputConsumer) {
35 | try {
36 | executorService.schedule(new Runnable() {
37 | @Override
38 | public void run() {
39 | try {
40 | if (!processed[index]) {
41 | processed[index] = true;
42 | LoggerFactory.getLogger(getClass()).warn("Timout for " + input.toString().lines().findFirst().orElse(" an input"));
43 | outputConsumer.accept(defaultResult, index);
44 | }
45 | } catch (Exception e) {
46 | e.printStackTrace();
47 | }
48 | }
49 | }, timeoutMillis, TimeUnit.MILLISECONDS);
50 |
51 | basePipeline.process(input, index, (result, index1) -> {
52 | try {
53 | if (!processed[index1]) {
54 | processed[index1] = true;
55 | outputConsumer.accept(result, index1);
56 | }
57 | } catch (Exception e) {
58 | e.printStackTrace();
59 | }
60 | });
61 | } catch (Exception e) {
62 | e.printStackTrace();
63 | }
64 | }
65 |
66 | @Override
67 | public void before(int size) {
68 | basePipeline.before(size);
69 | executorService = Executors.newSingleThreadScheduledExecutor();
70 | processed = new boolean[size];
71 | }
72 |
73 | @Override
74 | public void after() {
75 | executorService.shutdown();
76 | basePipeline.after();
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/extraction/GitDiffExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.extraction;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.zeroturnaround.exec.ProcessExecutor;
6 | import org.zeroturnaround.exec.stream.slf4j.Slf4jErrorOutputStream;
7 | import research.diffsearch.pipeline.base.Pipeline;
8 | import research.diffsearch.util.ProgrammingLanguage;
9 |
10 | import java.io.BufferedOutputStream;
11 | import java.io.File;
12 | import java.io.FileOutputStream;
13 | import java.io.IOException;
14 | import java.nio.file.Paths;
15 | import java.util.concurrent.ExecutionException;
16 |
17 | public class GitDiffExtractor implements Pipeline {
18 | private static final Logger logger = LoggerFactory.getLogger(GitDiffExtractor.class);
19 |
20 | private final String pathPatches;
21 |
22 | private final ProgrammingLanguage language;
23 |
24 | public GitDiffExtractor(String pathPatches, ProgrammingLanguage language) {
25 | this.pathPatches = Paths.get(pathPatches).toAbsolutePath().normalize().toString();
26 | this.language = language;
27 | }
28 |
29 | @Override
30 | public File process(File input, int index) {
31 | try(var out = new BufferedOutputStream(
32 | new FileOutputStream(new File(pathPatches + "/" + input.getName() + ".patch")))) {
33 | logger.info("Extracting batch of {}", input);
34 |
35 | new ProcessExecutor()
36 | .directory(input)
37 | .command("git", "config", "diff.renameLimit", "99999")
38 | .redirectOutput(new Slf4jErrorOutputStream(logger))
39 | .start().getFuture().get();
40 | new ProcessExecutor()
41 | .directory(input)
42 | .command("git", "log", "-p", "--", "*." + language.getSuffix())
43 | .redirectOutput(out)
44 | .start().getFuture().get();
45 | logger.info("Extracting batch of {} finished.", input);
46 | } catch (IOException | InterruptedException | ExecutionException e) {
47 | throw new RuntimeException(e);
48 | }
49 | return new File(pathPatches + input.getName() + ".patch");
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/extraction/GitHubCloner.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.extraction;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.zeroturnaround.exec.ProcessExecutor;
6 | import org.zeroturnaround.exec.stream.slf4j.Slf4jInfoOutputStream;
7 | import research.diffsearch.pipeline.base.Pipeline;
8 |
9 | import java.io.IOException;
10 | import java.nio.file.Paths;
11 | import java.util.concurrent.TimeoutException;
12 |
13 | public class GitHubCloner implements Pipeline {
14 | private static final Logger logger = LoggerFactory.getLogger(GitHubCloner.class);
15 | private final String outputPath;
16 |
17 | public GitHubCloner(String outputPath) {
18 | this.outputPath = outputPath;
19 | }
20 |
21 | @Override
22 | public String process(String input, int index) {
23 | var dir = Paths.get(outputPath).toAbsolutePath().normalize().toFile();
24 | if (dir.mkdirs()) {
25 | logger.info("Created directory {}", dir.getAbsolutePath());
26 | }
27 |
28 | var subfolder = dir + "/" + input.replace("https://github.com/", "").replace('/', '.');
29 |
30 | try {
31 | new ProcessExecutor()
32 | .directory(dir)
33 | .command("git", "clone", "--bare", input, subfolder)
34 | .redirectOutput(new Slf4jInfoOutputStream(logger))
35 | .execute();
36 | } catch (IOException | InterruptedException | TimeoutException e) {
37 | logger.error(e.getMessage(), e);
38 | }
39 |
40 | return input;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/FeatureExtractionPipeline.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 | import research.diffsearch.Config;
7 | import research.diffsearch.pipeline.base.Pipeline;
8 | import research.diffsearch.pipeline.feature.extractor.FeatureExtractor;
9 | import research.diffsearch.tree.SerializableTreeNode;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * Extracts features from code changes.
16 | *
17 | * @author Paul Bredl
18 | */
19 | public class FeatureExtractionPipeline implements Pipeline {
20 |
21 | private static final Logger logger = LoggerFactory.getLogger(FeatureExtractionPipeline.class);
22 | private final List extractorList = new ArrayList<>();
23 | private final byte countBits;
24 | private final int quadraticProbingMaxCount;
25 | private final boolean isQuery;
26 |
27 | public FeatureExtractionPipeline(byte countBits, int quadraticProbingMaxCount, boolean isQuery) {
28 | this.countBits = countBits;
29 | this.quadraticProbingMaxCount = quadraticProbingMaxCount;
30 | this.isQuery = isQuery;
31 | }
32 |
33 | /**
34 | * Adds a new extractor to the pipeline.
35 | */
36 | public void addFeatureExtractor(FeatureExtractor extractor) {
37 | extractorList.add(extractor);
38 | }
39 |
40 | public List getFeatureExtractors() {
41 | return this.extractorList;
42 | }
43 |
44 | /**
45 | * @return the length of the resulting feature vector.
46 | */
47 | public int getTotalFeatureVectorLength() {
48 | return extractorList.stream().mapToInt(FeatureExtractor::getFeatureVectorSectionLength).sum() * countBits;
49 | }
50 |
51 | /**
52 | * Extracts the features of the given code change.
53 | */
54 | public FeatureVector extractFeatures(T codeChangeTree) {
55 | FeatureVector featureVector = new FeatureVector(
56 | getTotalFeatureVectorLength() / countBits,
57 | countBits,
58 | quadraticProbingMaxCount);
59 | try {
60 | var startPosition = 0;
61 |
62 | for (FeatureExtractor extractor : getFeatureExtractors()) {
63 | var section = featureVector.getSection(extractor.getName(),
64 | startPosition, extractor.getFeatureVectorSectionLength());
65 | extractor.extractFeatures(codeChangeTree, section, isQuery);
66 | startPosition += extractor.getFeatureVectorSectionLength();
67 | }
68 | } catch (Exception e) {
69 | e.printStackTrace();
70 | }
71 |
72 | if (codeChangeTree instanceof SerializableTreeNode) {
73 | var treeNode = (SerializableTreeNode) codeChangeTree;
74 | treeNode.clear();
75 | }
76 |
77 | return featureVector;
78 | }
79 |
80 | @Override
81 | public FeatureVector process(T input, int index) {
82 | return extractFeatures(input);
83 | }
84 |
85 | public static FeatureExtractionPipeline getDefaultFeatureExtractionPipeline(boolean isQuery) {
86 | var pipeline = new FeatureExtractionPipeline(Config.COUNT_BITS, Config.FEATURE_MAX_COUNT, isQuery);
87 |
88 | var extractors = Config.featureExtractors.split(";");
89 |
90 | for (var extractorDef : extractors) {
91 | pipeline.addFeatureExtractor(
92 | FeatureExtractor.byDefinition(extractorDef,
93 | Config.SINGLE_FEATURE_VECTOR_LENGTH, Config.PROGRAMMING_LANGUAGE, Config.DIVIDE_EXTRACTORS));
94 | }
95 | return pipeline;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/RemoveCollisionPipeline.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.pipeline.base.Pipeline;
6 |
7 | /**
8 | * Removes and measures collisions in the feature vectors. In other words,
9 | * converts count vectors to binary vectors.
10 | *
11 | * @author Paul Bredl
12 | */
13 | public class RemoveCollisionPipeline implements Pipeline {
14 |
15 | private final Logger logger = LoggerFactory.getLogger(RemoveCollisionPipeline.class);
16 | private int sum = 0;
17 | private int maxIndex = 0;
18 | private int collisions = 0;
19 | private int greaterZeroOccurrences = 0;
20 | private double maxCount = 0;
21 |
22 | @Override
23 | public FeatureVector process(FeatureVector input, int index) {
24 | try {
25 | for (int i = 0; i < input.getVector().length; i++) {
26 | if (input.getVector()[i] >= 1) {
27 | if (maxCount < input.getVector()[i]) {
28 | maxCount = input.getVector()[i];
29 | }
30 |
31 | sum += 1;
32 | collisions += input.getVector()[i] - 1;
33 | input.getVector()[i] = 1;
34 | greaterZeroOccurrences++;
35 | }
36 | }
37 | if (index > maxIndex) {
38 | maxIndex = index;
39 | }
40 | return input;
41 | } catch (Exception e) {
42 | logger.error(e.getMessage(), e);
43 | throw new RuntimeException(e);
44 | }
45 | }
46 |
47 | @Override
48 | public void after() {
49 | logger.debug("Average non zero columns per vector: {}", sum / (double) (maxIndex + 1));
50 | logger.debug("Average collisions per vector: {}", collisions / (double) (maxIndex + 1));
51 | logger.debug("Max count: {}", maxCount);
52 | logger.debug("Average count per non zero entry: {}",
53 | (collisions + greaterZeroOccurrences) / (double) (greaterZeroOccurrences));
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/changedistilling/EditScriptOperation.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.changedistilling;
2 |
3 | import research.diffsearch.tree.ParseTreeNode;
4 |
5 | /**
6 | * @author Paul Bredl
7 | */
8 | public class EditScriptOperation {
9 |
10 | private final Type type;
11 | private final ParseTreeNode oldNode;
12 | private final ParseTreeNode newNode;
13 |
14 | public EditScriptOperation(Type type, ParseTreeNode oldNode, ParseTreeNode newNode) {
15 | this.type = type;
16 | this.oldNode = oldNode;
17 | this.newNode = newNode;
18 | }
19 |
20 | public Type getType() {
21 | return type;
22 | }
23 |
24 | public ParseTreeNode getOldNode() {
25 | return oldNode;
26 | }
27 |
28 | public ParseTreeNode getNewNode() {
29 | return newNode;
30 | }
31 |
32 | public ParseTreeNode getOldParent() {
33 | if (oldNode != null) {
34 | return oldNode.getParent();
35 | } else {
36 | return null;
37 | }
38 | }
39 |
40 | public ParseTreeNode getNewParent() {
41 | if (newNode != null) {
42 | return newNode.getParent();
43 | } else {
44 | return null;
45 | }
46 | }
47 |
48 | @Override
49 | public String toString() {
50 | final String ANSI_RED = "\u001B[31m";
51 | final String ANSI_RESET = "\u001B[0m";
52 | final String ANSI_GREEN = "\u001B[32m";
53 | final String ANSI_PURPLE = "\u001B[35m";
54 | final String ANSI_CYAN = "\u001B[36m";
55 | final String ANSI_BLUE = "\u001B[34m";
56 | final String ANSI_YELLOW = "\u001b[33m";
57 |
58 | StringBuilder result = new StringBuilder();
59 | switch (type) {
60 | case MOVE: case ALIGN:
61 | result.append(ANSI_CYAN);
62 | break;
63 | case INSERT:
64 | result.append(ANSI_GREEN);
65 | break;
66 | case DELETE:
67 | result.append(ANSI_RED);
68 | break;
69 | case UPDATE:
70 | result.append(ANSI_PURPLE);
71 | break;
72 | case POTENTIAL_UPDATE:
73 | result.append(ANSI_YELLOW);
74 | break;
75 | default:
76 | result.append("\u001b[38;5;244m");
77 |
78 | }
79 | result.append(type.toString(), 0, 3)
80 | .append(" ")
81 | .append(getNodeLabel(getOldNode()))
82 | .append(" @")
83 | .append(getNodeLabel(getOldParent()))
84 | .append(" --> ")
85 | .append(getNodeLabel(getNewNode()))
86 | .append(" @")
87 | .append(getNodeLabel(getNewParent()))
88 | .append(ANSI_RESET);
89 |
90 | return result.toString();
91 | }
92 |
93 | private static String getNodeLabel(ParseTreeNode node) {
94 | if (node != null) {
95 | return node.getNodeLabel();
96 | } else {
97 | return "null";
98 | }
99 | }
100 |
101 | public enum Type {
102 | EQUAL,
103 | UPDATE,
104 | POTENTIAL_UPDATE,
105 | MOVE,
106 | ALIGN,
107 | INSERT,
108 | DELETE
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/changedistilling/Match.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.changedistilling;
2 |
3 | import org.apache.commons.lang3.builder.EqualsBuilder;
4 | import org.apache.commons.lang3.builder.HashCodeBuilder;
5 | import research.diffsearch.tree.ParseTreeNode;
6 |
7 | import java.util.StringJoiner;
8 |
9 | /**
10 | * @author Paul Bredl
11 | */
12 | public class Match {
13 |
14 | private final ParseTreeNode oldNode, newNode;
15 | private final double similarity;
16 |
17 | public Match(ParseTreeNode oldNode, ParseTreeNode newNode, double similarity) {
18 | this.oldNode = oldNode;
19 | this.newNode = newNode;
20 | this.similarity = similarity;
21 | }
22 |
23 | public ParseTreeNode getOldNode() {
24 | return oldNode;
25 | }
26 |
27 | public ParseTreeNode getNewNode() {
28 | return newNode;
29 | }
30 |
31 | public double getSimilarity() {
32 | return similarity;
33 | }
34 |
35 | @Override
36 | public boolean equals(Object o) {
37 | if (this == o) {
38 | return true;
39 | }
40 |
41 | if (o == null || getClass() != o.getClass()) {
42 | return false;
43 | }
44 |
45 | Match match = (Match) o;
46 |
47 | return new EqualsBuilder().append(oldNode, match.oldNode).append(newNode, match.newNode).isEquals();
48 | }
49 |
50 | @Override
51 | public int hashCode() {
52 | return new HashCodeBuilder(17, 37)
53 | .append(oldNode)
54 | .append(newNode)
55 | .toHashCode();
56 | }
57 |
58 | @Override
59 | public String toString() {
60 | return new StringJoiner(", ", "(", ")")
61 | .add(oldNode.getNodeLabel())
62 | .add(newNode.getNodeLabel())
63 | .add(Double.toString(similarity))
64 | .toString();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/changedistilling/MatchList.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.changedistilling;
2 |
3 | import research.diffsearch.tree.ParseTreeNode;
4 |
5 | import java.util.Collection;
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | * @author Paul Bredl
11 | */
12 | public class MatchList {
13 |
14 | private final Map matchMap = new HashMap<>();
15 |
16 | public Collection getMatches() {
17 | return matchMap.values();
18 | }
19 |
20 | public void addMatch(ParseTreeNode oldNode, ParseTreeNode newNode, double similarity) {
21 | var match = new Match(oldNode, newNode, similarity);
22 |
23 | matchMap.put(oldNode.getId(), match);
24 | }
25 |
26 | public void addMatch(Match match) {
27 | matchMap.put(match.getOldNode().getId(), match);
28 | }
29 |
30 | public Match getMatchFor(ParseTreeNode node) {
31 | return matchMap.get(node.getId());
32 | }
33 |
34 | public Match getMatchForNewNode(ParseTreeNode node) {
35 | return matchMap.values().stream()
36 | .filter(match -> match.getNewNode() == node)
37 | .findAny()
38 | .orElse(null);
39 | }
40 |
41 | public boolean hasMatchFor(ParseTreeNode node) {
42 | var hasKey = matchMap.containsKey(node.getId());
43 | if (!hasKey) {
44 | return matchMap.values().stream()
45 | .map(Match::getNewNode)
46 | .map(ParseTreeNode::getId)
47 | .anyMatch(id -> node.getId() == id);
48 | }
49 | return true;
50 | }
51 |
52 | public boolean hasMatch(Match match) {
53 | return hasMatch(match.getOldNode(), match.getNewNode());
54 | }
55 |
56 | public boolean hasMatch(ParseTreeNode a, ParseTreeNode b) {
57 | var foundMatch = getMatchFor(a);
58 | if (foundMatch == null) {
59 | return false;
60 | } else {
61 | return foundMatch.getNewNode() == b;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/count/DocumentFrequencyCounter.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.count;
2 |
3 | import com.google.common.primitives.Ints;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 | import research.diffsearch.pipeline.base.Pipeline;
7 | import research.diffsearch.pipeline.feature.FeatureVector;
8 | import research.diffsearch.util.FilePathUtils;
9 |
10 | import java.io.IOException;
11 | import java.util.stream.StreamSupport;
12 |
13 | import static research.diffsearch.util.FilePathUtils.getAllLines;
14 |
15 | /**
16 | * @author Paul Bredl
17 | */
18 | public class DocumentFrequencyCounter implements Pipeline {
19 |
20 | private int[] documentFrequencies;
21 |
22 | private static final Logger logger = LoggerFactory.getLogger(DocumentFrequencyCounter.class);
23 |
24 | @Override
25 | public FeatureVector process(FeatureVector input, int index) {
26 | if (documentFrequencies == null) {
27 | documentFrequencies = new int[input.getVector().length];
28 | }
29 |
30 | for (int i = 0; i < input.getVector().length; i++) {
31 | if (input.getVector()[i] > 0) {
32 | documentFrequencies[i]++;
33 | }
34 | }
35 |
36 | return input;
37 | }
38 |
39 | public int getDocumentFrequency(int featureIndex) {
40 | return documentFrequencies[featureIndex];
41 | }
42 |
43 | public void saveToFile() {
44 | try {
45 | FilePathUtils
46 | .getStringFileWriterPipeline("./src/main/resources/frequency.csv")
47 | .execute(Ints.asList(documentFrequencies));
48 | } catch (IOException e) {
49 | logger.error(e.getMessage(), e);
50 | }
51 | }
52 |
53 | public void loadFromFile() {
54 | documentFrequencies = StreamSupport.stream(getAllLines(
55 | "./src/main/resources/frequency.csv").spliterator(), false)
56 | .mapToInt(Integer::parseInt)
57 | .toArray();
58 | }
59 |
60 | @Override
61 | public void after() {
62 | Pipeline.super.after();
63 | saveToFile();
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/count/RuleCountExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.count;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.antlr.v4.runtime.tree.Trees;
5 | import research.diffsearch.pipeline.feature.FeatureVector;
6 | import research.diffsearch.pipeline.feature.extractor.AbstractRecursiveFeatureExtractor;
7 | import research.diffsearch.util.ProgrammingLanguage;
8 |
9 | import java.util.HashMap;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | /**
14 | * @author Paul Bredl
15 | */
16 | public class RuleCountExtractor extends AbstractRecursiveFeatureExtractor {
17 |
18 | public RuleCountExtractor(ProgrammingLanguage language, int length) {
19 | super(language, length);
20 | }
21 |
22 | public static Map getRuleCountMapForTree(Tree node,
23 | List ruleNames,
24 | Map countMap) {
25 | var nodeText = Trees.getNodeText(node,ruleNames);
26 | if (ruleNames.contains(nodeText)) {
27 | var count = countMap.getOrDefault(nodeText, 0);
28 | countMap.put(nodeText, count + 1);
29 | }
30 |
31 | for (int i = 0; i < node.getChildCount(); i++) {
32 | countMap = getRuleCountMapForTree(node.getChild(i), ruleNames, countMap);
33 | }
34 |
35 | return countMap;
36 | }
37 |
38 | @Override
39 | public void extractFeaturesRecursive(Tree t, FeatureVector.Section section,
40 | boolean isQuery) {
41 |
42 | var ruleNames = getProgrammingLanguage().getRuleNames();
43 | var nodeText = Trees.getNodeText(t, ruleNames);
44 | var countMap = getRuleCountMapForTree(t, ruleNames, new HashMap<>());
45 |
46 | var index = 0;
47 | for (var rule : ruleNames) {
48 | var ruleMaxCount = this.getFeatureVectorSectionLength() / ruleNames.size();
49 |
50 | var countForCurrentCodeChange = countMap.getOrDefault(rule, 0);
51 | if (isNotBlacklisted(rule)) {
52 | for (int i = 0; i < ruleMaxCount && i < countForCurrentCodeChange; i++) {
53 | section.addFeature(rule, section.getStartPosition() + index + i);
54 | }
55 | }
56 |
57 | index += ruleMaxCount;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/count/TfIdfTransformer.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.count;
2 |
3 | import research.diffsearch.pipeline.base.Pipeline;
4 |
5 | import java.util.Arrays;
6 |
7 | /**
8 | * @author Paul Bredl
9 | */
10 | public class TfIdfTransformer implements Pipeline {
11 |
12 | private final DocumentFrequencyCounter counter;
13 | private final int numberOfDocuments;
14 |
15 | public TfIdfTransformer(DocumentFrequencyCounter counter, int numberOfDocuments) {
16 | this.counter = counter;
17 | this.numberOfDocuments = numberOfDocuments;
18 | }
19 |
20 | @Override
21 | public double[] process(double[] input, int index) {
22 | var maxTermFrequency = Arrays.stream(input)
23 | .max()
24 | .orElse(1);
25 |
26 | for (int i = 0; i < input.length; i++) {
27 | double tf = input[i] / maxTermFrequency;
28 | var documentFrequency = counter.getDocumentFrequency(i);
29 |
30 | double idf = Math.log(numberOfDocuments / (double) documentFrequency);
31 | if (documentFrequency == 0) {
32 | idf = 0;
33 | }
34 | input[i] = tf * idf;
35 | if (Double.isNaN(tf * idf)) {
36 | input[i] = 0;
37 | }
38 | }
39 |
40 | return input;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/extractor/AbstractRecursiveFeatureExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.extractor;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import research.diffsearch.pipeline.feature.FeatureVector;
5 | import research.diffsearch.util.ProgrammingLanguage;
6 |
7 | import java.util.Objects;
8 |
9 | /**
10 | * Represents any parse-tree based feature extractor that can be run recursive on
11 | * the parse tree.
12 | *
13 | * @author Paul Bredl
14 | */
15 | public abstract class AbstractRecursiveFeatureExtractor implements FeatureExtractor {
16 |
17 | private final ProgrammingLanguage programmingLanguage;
18 | private final int featureVectorLength;
19 |
20 | public AbstractRecursiveFeatureExtractor(ProgrammingLanguage language, int featureVectorLength) {
21 | programmingLanguage = language;
22 | this.featureVectorLength = featureVectorLength;
23 | }
24 |
25 | public static int getFeatureVectorIndex(int startIndex, int hashValue, long vectorLength) {
26 | return (int) (startIndex + Math.abs(hashValue % vectorLength));
27 | }
28 |
29 | public abstract void extractFeaturesRecursive(Tree t, FeatureVector.Section section,
30 | boolean isQuery);
31 |
32 | @Override
33 | public void extractFeatures(Tree changeTree, FeatureVector.Section section, boolean isQuery) {
34 | extractFeaturesRecursive(changeTree, section, isQuery);
35 | }
36 |
37 | @Override
38 | public int getFeatureVectorSectionLength() {
39 | return featureVectorLength;
40 | }
41 |
42 | @Override
43 | public ProgrammingLanguage getProgrammingLanguage() {
44 | return programmingLanguage;
45 | }
46 |
47 | protected static boolean isNotBlacklisted(String nodeText) {
48 | return !Objects.equals("querySnippet", nodeText);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/extractor/DescendentFeatureExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.extractor;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.antlr.v4.runtime.tree.Trees;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.feature.FeatureVector.Section;
7 | import research.diffsearch.util.ProgrammingLanguage;
8 |
9 | import static research.diffsearch.util.Util.isQueryPlaceholder;
10 |
11 | /**
12 | * @author Paul Bredl
13 | */
14 | public class DescendentFeatureExtractor extends AbstractRecursiveFeatureExtractor {
15 |
16 | public DescendentFeatureExtractor(ProgrammingLanguage language, int featureVectorLength) {
17 | super(language, featureVectorLength);
18 | }
19 |
20 | @Override
21 | public void extractFeaturesRecursive(Tree t, Section section, boolean isQuery) {
22 | String parentChildText = Trees.getNodeText(t, getProgrammingLanguage().getRuleNames());
23 |
24 | if (!parentChildText.equals("querySnippet")) {
25 | for (int i = 0; i < t.getChildCount(); i++) {
26 | extractFeaturesForParent(t.getChild(i), section, isQuery, parentChildText);
27 | }
28 | }
29 |
30 | for (int i = 0; i < t.getChildCount(); i++) {
31 | extractFeaturesRecursive(t.getChild(i), section, isQuery);
32 | }
33 | }
34 |
35 | private void extractFeaturesForParent(Tree t, Section section, boolean isQuery, String parentNode) {
36 | var childNodeText = Trees.getNodeText(t, getProgrammingLanguage().getRuleNames());
37 | if (shouldExtractFeature(childNodeText, isQuery)) {
38 |
39 | section.addFeature(parentNode + ' ' + childNodeText);
40 | }
41 |
42 | for (int i = 0; i < t.getChildCount(); i++) {
43 | extractFeaturesForParent(t.getChild(i), section, isQuery, parentNode);
44 | }
45 | }
46 |
47 | private static boolean shouldExtractFeature(String childNodeText, boolean isQuery) {
48 | return (!isQuery
49 | || Config.EXTRACT_QUERY_KEYWORDS
50 | || !isQueryPlaceholder(childNodeText)
51 | );
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/extractor/DividedFeatureExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.extractor;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.antlr.v4.runtime.tree.Trees;
5 | import research.diffsearch.pipeline.feature.FeatureVector;
6 | import research.diffsearch.util.ProgrammingLanguage;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * This feature extractor uses another {@link AbstractRecursiveFeatureExtractor} and extracts features
13 | * using this extractor but divided in the old and new part of the code change.
14 | *
15 | * @author Paul Bredl
16 | */
17 | public class DividedFeatureExtractor implements FeatureExtractor {
18 |
19 | private final AbstractRecursiveFeatureExtractor baseExtractor;
20 |
21 | public DividedFeatureExtractor(AbstractRecursiveFeatureExtractor baseExtractor) {
22 | this.baseExtractor = baseExtractor;
23 | }
24 |
25 | @Override
26 | public void extractFeatures(Tree tree, FeatureVector.Section section, boolean isQuery) {
27 |
28 | if (tree.getChildCount() >= 3) {
29 | for (var child : getRootsOfOldPart(tree)) {
30 | baseExtractor.extractFeaturesRecursive(child,
31 | section.getSubsection(baseExtractor.getName() + " [old]",
32 | 0, baseExtractor.getFeatureVectorSectionLength()),
33 | isQuery);
34 | }
35 |
36 | for (var child : getRootsOfNewPart(tree)) {
37 | baseExtractor.extractFeaturesRecursive(child,
38 | section.getSubsection(baseExtractor.getName() + " [new]",
39 | baseExtractor.getFeatureVectorSectionLength(),
40 | baseExtractor.getFeatureVectorSectionLength()),
41 | isQuery);
42 | }
43 | } else {
44 | baseExtractor.extractFeaturesRecursive(tree, section, isQuery);
45 | }
46 | }
47 |
48 | public List getRootsOfOldPart(Tree tree) {
49 | var result = new ArrayList();
50 | for (int i = 0; i < tree.getChildCount(); i++) {
51 | var child = tree.getChild(i);
52 | if (Trees.getNodeText(child, getProgrammingLanguage().getRuleNames()).trim().equals("-->")) {
53 | break;
54 | }
55 | result.add(child);
56 | }
57 | return result;
58 | }
59 |
60 | public List getRootsOfNewPart(Tree tree) {
61 | var result = new ArrayList();
62 | for (int i = tree.getChildCount() - 1; i >= 0; i--) {
63 | var child = tree.getChild(i);
64 | if (Trees.getNodeText(child, getProgrammingLanguage().getRuleNames()).trim().equals("-->")) {
65 | break;
66 | }
67 | result.add(child);
68 | }
69 | return result;
70 | }
71 |
72 | @Override
73 | public int getFeatureVectorSectionLength() {
74 | return baseExtractor.getFeatureVectorSectionLength() * 2;
75 | }
76 |
77 | @Override
78 | public ProgrammingLanguage getProgrammingLanguage() {
79 | return baseExtractor.getProgrammingLanguage();
80 | }
81 |
82 | @Override
83 | public String getName() {
84 | return baseExtractor.getName();
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/extractor/NodeExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.extractor;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.antlr.v4.runtime.tree.Trees;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.feature.FeatureVector;
7 | import research.diffsearch.util.ProgrammingLanguage;
8 | import research.diffsearch.util.Util;
9 |
10 | /**
11 | * This feature extractor extracts a feature for each node in the parse tree.
12 | *
13 | * @author Paul Bredl
14 | */
15 | public class NodeExtractor extends AbstractRecursiveFeatureExtractor {
16 | public NodeExtractor(ProgrammingLanguage language, int featureVectorLength) {
17 | super(language, featureVectorLength);
18 | }
19 |
20 | @Override
21 | public void extractFeaturesRecursive(Tree t, FeatureVector.Section section, boolean isQuery) {
22 | var nodeText = Trees.getNodeText(t, getProgrammingLanguage().getRuleNames());
23 |
24 | if (shouldExtractFeature(nodeText, isQuery)) {
25 | section.addFeature(nodeText);
26 | }
27 |
28 | for (int i = 0; i < t.getChildCount(); i++) {
29 | extractFeaturesRecursive(t.getChild(i), section, isQuery);
30 | }
31 | }
32 |
33 | private static boolean shouldExtractFeature(String nodeText, boolean isQuery) {
34 | return (!isQuery
35 | || Config.EXTRACT_QUERY_KEYWORDS
36 | || !Util.isQueryPlaceholder(nodeText));
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/extractor/ParentChildFeatureExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.extractor;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.antlr.v4.runtime.tree.Trees;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.feature.FeatureVector;
7 | import research.diffsearch.util.ProgrammingLanguage;
8 |
9 | import static research.diffsearch.util.Util.isQueryPlaceholder;
10 |
11 | /**
12 | * Feature extractor for parent child features.
13 | *
14 | * @author Paul Bredl
15 | * @author Luca Di Grazia
16 | */
17 | public class ParentChildFeatureExtractor extends AbstractRecursiveFeatureExtractor {
18 |
19 | public ParentChildFeatureExtractor(ProgrammingLanguage language, int featureVectorLength) {
20 | super(language, featureVectorLength);
21 | }
22 |
23 | @Override
24 | public void extractFeaturesRecursive(Tree t, FeatureVector.Section section, boolean isQuery) {
25 | var ruleNames = getProgrammingLanguage().getRuleNames();
26 | String parentChildText = Trees.getNodeText(t, ruleNames);
27 |
28 | if (!parentChildText.equals("querySnippet")) {
29 | for (int i = 0; i < t.getChildCount(); i++) {
30 | var child = t.getChild(i);
31 | var childNodeText = Trees.getNodeText(child, ruleNames);
32 | if (shouldExtractFeature(parentChildText, childNodeText, isQuery)) {
33 | var feature = parentChildText + ' ' + childNodeText;
34 |
35 | section.addFeature(feature);
36 | }
37 | }
38 | }
39 |
40 | for (int i = 0; i < t.getChildCount(); i++) {
41 | extractFeaturesRecursive(t.getChild(i), section, isQuery);
42 | }
43 | }
44 |
45 | private static boolean shouldExtractFeature(String parentChildText, String childNodeText, boolean isQuery) {
46 | return (!isQuery
47 | || Config.EXTRACT_QUERY_KEYWORDS
48 | || !isQueryPlaceholder(childNodeText)
49 | )
50 | && isNotBlacklisted(parentChildText)
51 | && isNotBlacklisted(childNodeText);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/extractor/SiblingFeatureExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.extractor;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.antlr.v4.runtime.tree.Trees;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.feature.FeatureVector;
7 | import research.diffsearch.util.ProgrammingLanguage;
8 |
9 | import static research.diffsearch.util.Util.isQueryPlaceholder;
10 |
11 | /**
12 | * This feature extractor extracts pairs of sibling from the parse tree.
13 | *
14 | * @author Paul Bredl
15 | */
16 | public class SiblingFeatureExtractor extends AbstractRecursiveFeatureExtractor {
17 |
18 | public SiblingFeatureExtractor(ProgrammingLanguage language, int featureVectorLength) {
19 | super(language, featureVectorLength);
20 | }
21 |
22 | @Override
23 | public void extractFeaturesRecursive(Tree t, FeatureVector.Section section, boolean isQuery) {
24 | var ruleNames = getProgrammingLanguage().getRuleNames();
25 | for (int i = 0; i < t.getChildCount() - 1; i++) {
26 | for (int j = i + 1; j < t.getChildCount(); j++) {
27 | var child = t.getChild(i);
28 | var child2 = t.getChild(j);
29 | var childNodeText = Trees.getNodeText(child, ruleNames);
30 | var child2NodeText = Trees.getNodeText(child2, ruleNames);
31 |
32 | if (shouldExtractFeature(childNodeText, child2NodeText, isQuery)) {
33 | section.addFeature(childNodeText + ' ' + child2NodeText);
34 | }
35 | }
36 | }
37 |
38 | for (int i = 0; i < t.getChildCount(); i++) {
39 | extractFeaturesRecursive(t.getChild(i), section, isQuery);
40 | }
41 | }
42 |
43 | private static boolean shouldExtractFeature(String nodeText1, String nodeText2, boolean isQuery) {
44 | return (!isQuery
45 | || Config.EXTRACT_QUERY_KEYWORDS
46 | || (!isQueryPlaceholder(nodeText1)
47 | && !isQueryPlaceholder(nodeText2)));
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/pipeline/feature/extractor/TriangleFeatureExtractor.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.pipeline.feature.extractor;
2 |
3 | import org.antlr.v4.runtime.tree.Tree;
4 | import org.antlr.v4.runtime.tree.Trees;
5 | import research.diffsearch.Config;
6 | import research.diffsearch.pipeline.feature.FeatureVector;
7 | import research.diffsearch.util.ProgrammingLanguage;
8 | import research.diffsearch.util.Util;
9 |
10 | /**
11 | * This feature extractor extracts parse tree triangles from code changes.
12 | *
13 | * @author Paul Bredl
14 | * @author Luca Di Grazia
15 | */
16 | public class TriangleFeatureExtractor extends AbstractRecursiveFeatureExtractor {
17 |
18 | public TriangleFeatureExtractor(ProgrammingLanguage language, int featureVectorLength) {
19 | super(language, featureVectorLength);
20 | }
21 |
22 | @Override
23 | public void extractFeaturesRecursive(Tree t, FeatureVector.Section section, boolean isQuery) {
24 | var ruleNames = getProgrammingLanguage().getRuleNames();
25 | StringBuilder sum = new StringBuilder();
26 | sum.append(Trees.getNodeText(t, ruleNames));
27 |
28 | int i;
29 | for (i = 0; i < t.getChildCount(); i++) {
30 | String childNodeText = Trees.getNodeText(t.getChild(i), ruleNames);
31 | if (!isQuery || Config.EXTRACT_QUERY_KEYWORDS || !Util.isQueryPlaceholder(childNodeText)) {
32 | sum.append(childNodeText).append(" ");
33 | } else {
34 | sum = new StringBuilder();
35 | break;
36 | }
37 | }
38 |
39 | if (!sum.toString().isBlank() && i > 0 /*&& !sum.toString().contains("querySnippet") */) {
40 | section.addFeature(sum.toString());
41 | }
42 |
43 | for (i = 0; i < t.getChildCount(); i++) {
44 | String childNodeText = Trees.getNodeText(t.getChild(i), ruleNames);
45 | if (childNodeText.contains("literal")) {
46 | continue;
47 | }
48 |
49 | extractFeaturesRecursive(t.getChild(i), section, isQuery);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/tree/JavaTree.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.tree;
2 |
3 | import ProgrammingLanguage.Java.JavaLexer;
4 | import ProgrammingLanguage.Java.JavaParser;
5 | import org.antlr.v4.runtime.*;
6 |
7 | import java.util.List;
8 |
9 | /* Antlr4 command to create java classes using the terminal with Linux:
10 | java -Xmx500M -cp /usr/local/lib/antlr-4.7.1-complete.jar org.antlr.v4.Tool -Dlanguage=Java JavaLexer.g4 JavaParser.g4
11 | */
12 | public class JavaTree extends AbstractTree {
13 | private final JavaLexer lexer;
14 | private final JavaParser parser;
15 | private boolean syntax_error = false;
16 |
17 | public JavaTree(String change) {
18 | super(change);
19 |
20 | lexer = initializeLexer(JavaLexer::new);
21 | MyErrorListener errorListener = new MyErrorListener();
22 | lexer.addErrorListener(errorListener);
23 | lexer.addErrorListener(errorListener);
24 | if (errorListener.hasSyntaxError){
25 | syntax_error = true;
26 | //lexer = null;
27 | parser = null;
28 | return;
29 | }
30 |
31 | tokens = initializeTokens(CommonTokenStream::new);
32 | parser = initializeParser(JavaParser::new);
33 | parser.setProfile(true);
34 |
35 | initializeErrorListeners();
36 |
37 | parsetree = initializeSafe(parser::program);
38 | }
39 |
40 | private class MyErrorListener extends BaseErrorListener {
41 | boolean hasSyntaxError = false;
42 |
43 | @Override
44 | public void syntaxError(Recognizer r, Object symbol, int line, int pos, String msg, RecognitionException e) {
45 | hasSyntaxError = true;
46 | }
47 | }
48 |
49 |
50 | @Override
51 | public JavaLexer getLexer() {
52 | return lexer;
53 | }
54 |
55 | @Override
56 | public JavaParser getParser() {
57 | return parser;
58 | }
59 |
60 | @Override
61 | public String[] getRuleNames() {
62 | return JavaParser.ruleNames;
63 | }
64 |
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/tree/JavascriptTree.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.tree;
2 |
3 | import ProgrammingLanguage.JavaScript.ECMAScriptLexer;
4 | import ProgrammingLanguage.JavaScript.ECMAScriptParser;
5 | import org.antlr.v4.runtime.*;
6 | import org.antlr.v4.runtime.tree.ParseTree;
7 |
8 | /* Antlr4 command to create java classes using the terminal with Linux:
9 | java -Xmx500M -cp /usr/local/lib/antlr-4.7.1-complete.jar org.antlr.v4.Tool -Dlanguage=Java ECMAScript.g4
10 | */
11 |
12 | public class JavascriptTree extends AbstractTree {
13 | private final ECMAScriptLexer lexer;
14 | private final ECMAScriptParser parser;
15 | private boolean syntax_error = false;
16 |
17 | public JavascriptTree(String change) {
18 | super(change);
19 |
20 | lexer = initializeLexer(ECMAScriptLexer::new);
21 | JavascriptTree.MyErrorListener errorListener = new JavascriptTree.MyErrorListener();
22 | lexer.addErrorListener(errorListener);
23 | lexer.addErrorListener(errorListener);
24 | if (errorListener.hasSyntaxError){
25 | syntax_error = true;
26 | parser = null;
27 | return;
28 | }
29 |
30 | tokens = initializeTokens(CommonTokenStream::new);
31 | parser = initializeParser(ECMAScriptParser::new);
32 |
33 | initializeErrorListeners();
34 | parsetree = initializeSafe(parser::program);
35 | }
36 |
37 | private class MyErrorListener extends BaseErrorListener {
38 | boolean hasSyntaxError = false;
39 |
40 | @Override
41 | public void syntaxError(Recognizer r, Object symbol, int line, int pos, String msg, RecognitionException e) {
42 | hasSyntaxError = true;
43 | }
44 | }
45 |
46 | public JavascriptTree(String codeChange, ParseTree parseTree) {
47 | super(codeChange);
48 |
49 | lexer = initializeLexer(ECMAScriptLexer::new);
50 | tokens = initializeTokens(CommonTokenStream::new);
51 | parser = initializeParser(ECMAScriptParser::new);
52 |
53 | initializeErrorListeners();
54 | parsetree = parseTree;
55 | }
56 |
57 | @Override
58 | public ECMAScriptLexer getLexer() {
59 | return lexer;
60 | }
61 |
62 | @Override
63 | public Parser getParser() {
64 | return parser;
65 | }
66 |
67 | @Override
68 | public String[] getRuleNames() {
69 | return ECMAScriptParser.ruleNames;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/tree/Python3Tree.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.tree;
2 |
3 | import ProgrammingLanguage.Python.Python3Lexer;
4 | import ProgrammingLanguage.Python.Python3Parser;
5 | import org.antlr.v4.runtime.BaseErrorListener;
6 | import org.antlr.v4.runtime.CommonTokenStream;
7 | import org.antlr.v4.runtime.RecognitionException;
8 | import org.antlr.v4.runtime.Recognizer;
9 |
10 | /* Antlr4 command to create java classes using the terminal with Linux:
11 | java -Xmx500M -cp /usr/local/lib/antlr-4.7.1-complete.jar org.antlr.v4.Tool -Dlanguage=Java Python3.g4
12 | */
13 |
14 | /* Python3 AST class with some useful methods.*/
15 | public class Python3Tree extends AbstractTree {
16 | private final Python3Lexer lexer;
17 | private final Python3Parser parser;
18 | boolean syntax_error = false;
19 |
20 | public Python3Tree(String change) {
21 | super(change);
22 | lexer = initializeLexer(Python3Lexer::new);
23 | Python3Tree.MyErrorListener errorListener = new Python3Tree.MyErrorListener();
24 | lexer.addErrorListener(errorListener);
25 | lexer.addErrorListener(errorListener);
26 | if (errorListener.hasSyntaxError){
27 | syntax_error = true;
28 | parser = null;
29 | return;
30 | }
31 |
32 | tokens = initializeTokens(CommonTokenStream::new);
33 | parser = initializeParser(Python3Parser::new);
34 |
35 | initializeErrorListeners();
36 |
37 | parsetree = initializeSafe(parser::program);
38 | }
39 |
40 | private class MyErrorListener extends BaseErrorListener {
41 | boolean hasSyntaxError = false;
42 |
43 | @Override
44 | public void syntaxError(Recognizer r, Object symbol, int line, int pos, String msg, RecognitionException e) {
45 | hasSyntaxError = true;
46 | }
47 | }
48 |
49 | @Override
50 | public Python3Lexer getLexer() {
51 | return lexer;
52 | }
53 |
54 | @Override
55 | public Python3Parser getParser() {
56 | return parser;
57 | }
58 |
59 | @Override
60 | public String[] getRuleNames() {
61 | return Python3Parser.ruleNames;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/tree/TreeFactory.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.tree;
2 |
3 | import com.google.gson.Gson;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 | import research.diffsearch.pipeline.base.CodeChange;
7 | import research.diffsearch.util.ProgrammingLanguage;
8 |
9 | /**
10 | * @author Paul Bredl
11 | */
12 | public class TreeFactory {
13 |
14 | private static final Logger logger = LoggerFactory.getLogger(TreeFactory.class);
15 |
16 | public static AbstractTree getAbstractTree(String candidate, ProgrammingLanguage language) {
17 | AbstractTree changeTree;
18 | switch (language) {
19 | case JAVA:
20 | changeTree = new JavaTree(candidate);
21 | break;
22 | case JAVASCRIPT:
23 | changeTree = new JavascriptTree(candidate);
24 | break;
25 | default:
26 | changeTree = new Python3Tree(candidate);
27 | }
28 | return changeTree;
29 | }
30 |
31 | public static SerializableTreeNode getTreeFromCodeChange(CodeChange change, ProgrammingLanguage language) {
32 | var gson = new Gson();
33 |
34 | SerializableTreeNode result;
35 | if (change.getJSONParseTree() == null) {
36 | logger.debug("Generating new parse tree...");
37 | var parseTree = getAbstractTree(change.getFullChangeString(), language).getParseTree();
38 | var sTree = SerializableTreeNode.fromTree(parseTree, language);
39 | change.setJSONParseTree(gson.toJson(sTree));
40 |
41 | result = sTree;
42 | } else {
43 |
44 | result = gson.fromJson(change.getJSONParseTree(), SerializableTreeNode.class);
45 | }
46 |
47 | return result;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/util/ProgrammingLanguage.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.util;
2 |
3 | import ProgrammingLanguage.Java.JavaLexer;
4 | import ProgrammingLanguage.Java.JavaParser;
5 | import ProgrammingLanguage.JavaScript.ECMAScriptLexer;
6 | import ProgrammingLanguage.JavaScript.ECMAScriptParser;
7 | import ProgrammingLanguage.Python.Python3Lexer;
8 | import ProgrammingLanguage.Python.Python3Parser;
9 | import org.antlr.v4.runtime.CharStreams;
10 | import org.antlr.v4.runtime.CommonTokenStream;
11 | import org.antlr.v4.runtime.Parser;
12 |
13 | import java.util.Arrays;
14 | import java.util.List;
15 |
16 | /**
17 | * @author Paul Bredl
18 | */
19 | public enum ProgrammingLanguage {
20 |
21 | JAVA(Arrays.asList(JavaParser.ruleNames), "java") {
22 | @Override
23 | public Parser getParser(String codeChange) {
24 | return new JavaParser(new CommonTokenStream(new JavaLexer(CharStreams.fromString(codeChange))));
25 | }
26 | },
27 | PYTHON(Arrays.asList(Python3Parser.ruleNames), "py") {
28 | @Override
29 | public Parser getParser(String codeChange) {
30 | return new Python3Parser(new CommonTokenStream(new Python3Lexer(CharStreams.fromString(codeChange))));
31 | }
32 | },
33 | JAVASCRIPT(Arrays.asList(ECMAScriptParser.ruleNames), "js") {
34 | @Override
35 | public Parser getParser(String codeChange) {
36 | return new ECMAScriptParser(new CommonTokenStream(new ECMAScriptLexer(CharStreams.fromString(codeChange))));
37 | }
38 | };
39 |
40 | private final List ruleNames;
41 | private final String suffix;
42 |
43 | ProgrammingLanguage(List ruleNames, String fileSuffix) {
44 | this.ruleNames = ruleNames;
45 | this.suffix = fileSuffix;
46 | }
47 |
48 | public List getRuleNames() {
49 | return ruleNames;
50 | }
51 |
52 | public abstract Parser getParser(String codeChange);
53 |
54 | public String getSuffix() {
55 | return suffix;
56 | }
57 |
58 | @Override
59 | public String toString() {
60 | switch (this) {
61 | case JAVA: return "Java";
62 | case JAVASCRIPT: return "JS";
63 | case PYTHON: return "Python";
64 | }
65 | throw new IllegalStateException();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/util/ProgrammingLanguageDependent.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.util;
2 |
3 | /**
4 | * Super interface for all components that depend on the target programming language of diffsearch.
5 | *
6 | * @author Paul Bredl
7 | */
8 | public interface ProgrammingLanguageDependent {
9 |
10 | ProgrammingLanguage getProgrammingLanguage();
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/research/diffsearch/util/ProgressWatcher.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch.util;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import research.diffsearch.pipeline.base.IndexedConsumer;
6 | import research.diffsearch.pipeline.base.Pipeline;
7 |
8 | import java.util.stream.IntStream;
9 |
10 | import static java.text.MessageFormat.format;
11 |
12 | /**
13 | * Shows the progress of the pipeline in a progressbar in the console.
14 | *
15 | * @author Paul Bredl
16 | */
17 | public class ProgressWatcher implements Pipeline {
18 |
19 | private int size;
20 | private final String progressName;
21 | private final double[] steps;
22 | private int currentStepIndex = 0;
23 | private long startTime = 0;
24 | private final Logger logger = LoggerFactory.getLogger(ProgressWatcher.class);
25 |
26 | public ProgressWatcher(String progressName, double... steps) {
27 | this.progressName = progressName;
28 | this.steps = steps;
29 | }
30 |
31 | public ProgressWatcher(String progressName) {
32 | this(progressName, IntStream.range(1, 1000).mapToDouble(i -> i / 1000.0).toArray());
33 | }
34 |
35 | @Override
36 | public void process(T input, int index, IndexedConsumer outputConsumer) {
37 | if (startTime == 0) {
38 | startTime = System.currentTimeMillis();
39 | }
40 | if (currentStepIndex < steps.length) {
41 | if (index / (double) size >= steps[currentStepIndex]) {
42 | var percent = Math.round(steps[currentStepIndex] * 100);
43 |
44 | System.out.print("[ ");
45 | System.out.print("█".repeat((int) (percent / 5)));
46 | System.out.print("░".repeat((int) (20 - (percent / 5))));
47 | System.out.print(" ] ");
48 | System.out.print(format("{0}: {1}% ({2}/{3})", progressName,
49 | Math.floor(steps[currentStepIndex] * 100), index, size));
50 |
51 | System.out.print("\r");
52 |
53 | currentStepIndex++;
54 | }
55 | }
56 | outputConsumer.accept(input, index);
57 | }
58 |
59 | @Override
60 | public T process(T input, int index) {
61 | throw new IllegalStateException(); // unused
62 | }
63 |
64 | @Override
65 | public void before(int size) {
66 | this.size = size;
67 | logger.info("{} started", progressName);
68 | }
69 |
70 | @Override
71 | public void after() {
72 | long endTime = System.currentTimeMillis();
73 | logger.info("{} done in {}", progressName,
74 | Util.formatDuration(startTime, endTime));
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/1/queries.txt:
--------------------------------------------------------------------------------
1 | EXPR.ID<0>(); --> EXPR.ID<0>();
2 | EXPR.ID<0>(EXPR<0>); --> EXPR.ID<0>(EXPR<0>);
3 | EXPR.ID<0>(EXPR<0>, EXPR<1>); --> EXPR.ID<0>(EXPR<0>, EXPR<1>);
4 | EXPR.ID<0>(EXPR<0>, EXPR<1>,EXPR<2>); --> EXPR.ID<0>(EXPR<0>, EXPR<1>, EXPR<2>);
5 | EXPR.ID<0>(EXPR<0>, EXPR<1>,EXPR<2>, EXPR<3>); --> EXPR.ID<0>(EXPR<0>, EXPR<1>, EXPR<2>, EXPR<2>);
6 | ID.ID<0>(<...>); --> ID.ID<0>(<...>);
7 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/10/queries.txt:
--------------------------------------------------------------------------------
1 | EXPR binOP<0> EXPR --> EXPR binOP<0> EXPR
2 | EXPR binOP<0> EXPR; --> EXPR binOP<0> EXPR;
3 | ID = EXPR binOP<0> EXPR -->ID = EXPR binOP<0> EXPR
4 | ID = EXPR binOP<0> EXPR; -->ID = EXPR binOP<0> EXPR;
5 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/11/queries.txt:
--------------------------------------------------------------------------------
1 | <...> ID(<...>) { --> <...> ID(<...>) throws ID {
2 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/12/queries.txt:
--------------------------------------------------------------------------------
1 | <...> ID(<...>) throws ID { --> <...> ID(<...>) {
2 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/2/queries.txt:
--------------------------------------------------------------------------------
1 | EXPR<0> binOP EXPR<1> --> EXPR<0> binOP EXPR<1>
2 | EXPR<0> binOP EXPR<1>; --> EXPR<0> binOP EXPR<1>;
3 | EXPR<0> binOP EXPR<1>; --> EXPR<0> binOP EXPR<1>;
4 | if(ID<0>.ID<1>() binOP LT<0> ){ --> if(ID<0>.ID<1>() binOP LT<0>){
5 | if(ID<0> binOP LT<0> ){ --> if(ID<0> binOP LT<0>){
6 | if(ID<0> binOP ID<1> ){ --> if(ID<0> binOP ID<1>){
7 | while(ID<0> binOP ID<1> ){ --> while(ID<0> binOP ID<1>){
8 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/3/queries.txt:
--------------------------------------------------------------------------------
1 | if (ID<0>) { <...> --> if (ID<0> && EXPR) { <...>
2 | if (ID<0>) { <...> --> if (EXPR && ID<0>) { <...>
3 | if (ID<0>) --> if (ID<0> && EXPR)
4 | if (ID<0>) --> if (EXPR && ID<0>)
5 | if (ID<0>(<...>)) { <...> --> if (ID<0>(<...>) && EXPR) { <...>
6 | if (ID<0>(<...>)) { <...> --> if (EXPR && ID<0>(<...>)) { <...>
7 | if (ID<0>(<...>)) --> if (ID<0>(<...>) && EXPR)
8 | if (ID<0>(<...>)) --> if (EXPR && ID<0>(<...>))
9 | if (ID<0> binOP<0> LT<0>){ <...> --> if (ID<0> binOP<0> LT<0> && EXPR) { <...>
10 | if (ID<0> binOP<0> LT<0>){ <...> --> if (EXPR && ID<0> binOP<0> LT<0>) { <...>
11 | if (ID<0> binOP<0> LT<0>){ <...> --> if (ID<0> binOP<0> LT<0> && EXPR) { <...>
12 | if (ID<0> binOP<0> LT<0>){ <...> --> if (EXPR && ID<0> binOP<0> LT<0>){ <...>
13 | if (ID<0> != LT) { --> if (ID<0> != LT && ID == LT) {
14 | if(EXPR){ --> if(EXPR){
15 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/4/queries.txt:
--------------------------------------------------------------------------------
1 | if (ID<0>) { <...> --> if (ID<0> || EXPR) { <...>
2 | if (ID<0>) { <...> --> if (EXPR || ID<0>) { <...>
3 | if (ID<0>) --> if (ID<0> || EXPR)
4 | if (ID<0>) --> if (EXPR || ID<0>)
5 | if (ID<0>(<...>)) { <...> --> if (ID<0>(<...>) || EXPR) { <...>
6 | if (ID<0>(<...>)) { <...> --> if (EXPR || ID<0>(<...>)) { <...>
7 | if (ID<0>(<...>)) --> if (ID<0>(<...>) || EXPR)
8 | if (ID<0>(<...>)) --> if (EXPR || ID<0>(<...>))
9 | if (ID<0> binOP<0> LT<0>){ <...> --> if (ID<0> binOP<0> LT<0> || EXPR) { <...>
10 | if (ID<0> binOP<0> LT<0>){ <...> --> if (EXPR || ID<0> binOP<0> LT<0>) { <...>
11 | if (ID<0> binOP<0> LT<0>){ <...> --> if (ID<0> binOP<0> LT<0> || EXPR) { <...>
12 | if (ID<0> binOP<0> LT<0>){ <...> --> if (EXPR || ID<0> binOP<0> LT<0>){ <...>
13 | if (ID<0> binOP<0> ID<1>){ <...> --> if (ID<0> binOP<0> ID<1> || EXPR) { <...>
14 | if (ID<0> binOP<0> ID<1>){ <...> --> if (EXPR || ID<0> binOP<0> ID<1>) { <...>
15 | if (ID<0> binOP<0> ID<1>){ <...> --> if (ID<0> binOP<0> ID<1> || EXPR) { <...>
16 | if (ID<0> binOP<0> ID<1>){ <...> --> if (EXPR || ID<0> binOP<0> ID<1>){ <...>
17 | if (ID<0> binOP<0> LT<0>) --> if (ID<0> binOP<0> LT<0> || EXPR)
18 | if (ID<0> binOP<0> LT<0>) --> if (EXPR || ID<0> binOP<0> LT<0>)
19 | if (ID<0> binOP<0> LT<0>) --> if (ID<0> binOP<0> LT<0> || EXPR)
20 | if (ID<0> binOP<0> LT<0>) --> if (EXPR || ID<0> binOP<0> LT<0>)
21 | if (ID<0> binOP<0> ID<1>) --> if (ID<0> binOP<0> ID<1> || EXPR)
22 | if (ID<0> binOP<0> ID<1>) --> if (EXPR || ID<0> binOP<0> ID<1>)
23 | if (ID<0> binOP<0> ID<1>) --> if (ID<0> binOP<0> ID<1> || EXPR)
24 | if (ID<0> binOP<0> ID<1>) --> if (EXPR || ID<0> binOP<0> ID<1>)
25 | if (ID<0>(<...>) binOP<0> LT<0>){ <...> --> if (ID<0>(<...>) binOP<0> LT<0> || EXPR) { <...>
26 | if (ID<0>(<...>) binOP<0> LT<0>){ <...> --> if (EXPR || ID<0>(<...>) binOP<0> LT<0>) { <...>
27 | if (ID<0>(<...>) binOP<0> LT<0>){ <...> --> if (ID<0> binOP<0> LT<0> || EXPR) { <...>
28 | if (ID<0>(<...>) binOP<0> LT<0>){ <...> --> if (EXPR || ID<0>(<...>) binOP<0> LT<0>){ <...>
29 | if (ID<0>(<...>) binOP<0> ID<1>){ <...> --> if (ID<0> binOP<0> ID<1> || EXPR) { <...>
30 | if (ID<0>(<...>) binOP<0> ID<1>){ <...> --> if (EXPR || ID<0>(<...>) binOP<0> ID<1>) { <...>
31 | if (ID<0>(<...>) binOP<0> ID<1>){ <...> --> if (ID<0> binOP<0> ID<1> || EXPR) { <...>
32 | if (ID<0>(<...>) binOP<0> ID<1>){ <...> --> if (EXPR || ID<0>(<...>) binOP<0> ID<1>){ <...>
33 | if (ID<0> == LT) { --> if (ID<0> == LT || ID == LT) {
34 | if (ID<0> == LT) { --> if (ID<0> == LT || ID.ID(<...>)) {
35 | if (ID.ID(<...>)) { --> if (ID.ID(<...>) || ID.ID(<...>)) {
36 | if(EXPR){ --> if(EXPR){
37 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/5/queries.txt:
--------------------------------------------------------------------------------
1 | EXPR<0>.ID() --> EXPR<0>.ID()
2 | EXPR<0>.ID(); -->EXPR<0>.ID();
3 | EXPR<0>.ID(EXPR<1>) --> EXPR<0>.ID(EXPR<1>)
4 | EXPR<0>.ID(EXPR<1>); -->EXPR<0>.ID(EXPR<2>);
5 | EXPR<0>.ID(EXPR<1>,EXPR<2>) --> EXPR<0>.ID(EXPR<1>,EXPR<2>)
6 | EXPR<0>.ID(EXPR<1>,EXPR<2>); --> EXPR<0>.ID(EXPR<1>, EXPR<2>);
7 | EXPR<0>.ID(EXPR<1>,EXPR<2>,EXPR<3>) --> EXPR<0>.ID(EXPR<1>,EXPR<2>,EXPR<3>)
8 | EXPR<0>.ID(EXPR<1>,EXPR<2>,EXPR<3>); --> EXPR<0>.ID(EXPR<1>, EXPR<2>, EXPR<3>);
9 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/7/queries.txt:
--------------------------------------------------------------------------------
1 | ID<0>(ID); --> ID<0>();
2 | ID<0>(ID<0>, ID); --> ID<0>(ID<0>);
3 | ID<0>(ID<0>, ID<1>, ID); --> ID<0>(ID<0>, ID<1>);
4 | ID<0>(ID<0>, ID<1>, ID<2>, ID); --> ID<0>(ID<0>, ID<1>, ID<2>);
5 | ID<0>(ID<0>, ID<1>, ID<2>, ID<3>, ID); -->ID<0>(ID<0>, ID<1>, ID<2>, ID<3>);
6 | ID<2>.ID<0>(ID); --> ID<2>.ID<0>();
7 | ID<2>.ID<0>(ID<0>, ID); --> ID<2>.ID<0>(ID<0>);
8 | ID<2>.ID<0>(ID<0>, ID<1>, ID); --> ID<2>.ID<0>(ID<0>, ID<1>);
9 | ID<2>.ID<0>(ID<0>, ID<1>,ID<3>, ID); --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>);
10 | ID<0>(ID, ID<0>); --> ID<0>(ID<0>);
11 | ID<0>(ID<0>, ID, ID<1>); --> ID<0>(ID<0>, ID<1>);
12 | ID<0>(ID, ID<0>, ID<1>); --> ID<0>(ID<0>, ID<1>);
13 | ID<0>(ID<0>, ID<1>, ID<2>, ID); --> ID<0>(ID<0>, ID<1>, ID<2>);
14 | ID<0>(ID<0>, ID<1>, ID, ID<2>); --> ID<0>(ID<0>, ID<1>, ID<2>);
15 | ID<0>(ID<0>, ID, ID<1>, ID<2>); --> ID<0>(ID<0>, ID<1>, ID<2>);
16 | ID<0>(ID, ID<0>, ID<1>, ID<2>); --> ID<0>(ID<0>, ID<1>, ID<2>);
17 | ID<0>(ID<0>, ID<1>, ID<2>, ID<3>, ID); --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>);
18 | ID<0>(ID<0>, ID<1>, ID<2>, ID, ID<3>); --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>);
19 | ID<0>(ID<0>, ID<1>, ID, ID<2>, ID<3>); --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>);
20 | ID<0>(ID<0>, ID, ID<1>, ID<2>, ID<3>); --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>);
21 | ID<0>(ID,ID<0>, ID<1>, ID<2>, ID<3>); --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>);
22 | ID<2>.ID<0>(ID); --> ID<2>.ID<0>();
23 | ID<2>.ID<0>(ID, ID<0>); --> ID<2>.ID<0>(ID<0>);
24 | ID<2>.ID<0>(ID<0>, ID, ID<1>); --> ID<2>.ID<0>(ID<0>, ID<1>);
25 | ID<2>.ID<0>(ID,ID<0>, ID<1>); --> ID<2>.ID<0>(ID<0>, ID<1>);
26 | ID<2>.ID<0>(ID<0>, ID<1>, ID,ID<3>); --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>);
27 | ID<2>.ID<0>(ID<0>, ID, ID<1>, ID<3>); --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>);
28 | ID<2>.ID<0>(ID,ID<0>, ID<1>, ID<3>); --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>);
29 | ID<0>(ID) --> ID<0>()
30 | ID<0>(ID<0>, ID) --> ID<0>(ID<0>)
31 | ID<0>(ID<0>, ID<1>, ID) --> ID<0>(ID<0>, ID<1>)
32 | ID<0>(ID<0>, ID<1>, ID<2>, ID) --> ID<0>(ID<0>, ID<1>, ID<2>)
33 | ID<0>(ID<0>, ID<1>, ID<2>, ID<3>, ID) -->ID<0>(ID<0>, ID<1>, ID<2>, ID<3>)
34 | ID<2>.ID<0>(ID) --> ID<2>.ID<0>()
35 | ID<2>.ID<0>(ID<0>, ID) --> ID<2>.ID<0>(ID<0>)
36 | ID<2>.ID<0>(ID<0>, ID<1>, ID) --> ID<2>.ID<0>(ID<0>, ID<1>)
37 | ID<2>.ID<0>(ID<0>, ID<1>,ID<3>, ID) --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>)
38 | ID<0>(ID, ID<0>) --> ID<0>(ID<0>)
39 | ID<0>(ID<0>, ID, ID<1>) --> ID<0>(ID<0>, ID<1>)
40 | ID<0>(ID, ID<0>, ID<1>) --> ID<0>(ID<0>, ID<1>)
41 | ID<0>(ID<0>, ID<1>, ID<2>, ID) --> ID<0>(ID<0>, ID<1>, ID<2>)
42 | ID<0>(ID<0>, ID<1>, ID, ID<2>) --> ID<0>(ID<0>, ID<1>, ID<2>)
43 | ID<0>(ID<0>, ID, ID<1>, ID<2>) --> ID<0>(ID<0>, ID<1>, ID<2>)
44 | ID<0>(ID, ID<0>, ID<1>, ID<2>) --> ID<0>(ID<0>, ID<1>, ID<2>)
45 | ID<0>(ID<0>, ID<1>, ID<2>, ID<3>, ID) --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>)
46 | ID<0>(ID<0>, ID<1>, ID<2>, ID, ID<3>) --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>)
47 | ID<0>(ID<0>, ID<1>, ID, ID<2>, ID<3>) --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>)
48 | ID<0>(ID<0>, ID, ID<1>, ID<2>, ID<3>) --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>)
49 | ID<0>(ID,ID<0>, ID<1>, ID<2>, ID<3>) --> ID<0>(ID<0>, ID<1>, ID<2>, ID<3>)
50 | ID<2>.ID<0>(ID) --> ID<2>.ID<0>()
51 | ID<2>.ID<0>(ID, ID<0>) --> ID<2>.ID<0>(ID<0>)
52 | ID<2>.ID<0>(ID<0>, ID, ID<1>) --> ID<2>.ID<0>(ID<0>, ID<1>)
53 | ID<2>.ID<0>(ID,ID<0>, ID<1>) --> ID<2>.ID<0>(ID<0>, ID<1>)
54 | ID<2>.ID<0>(ID<0>, ID<1>, ID,ID<3>) --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>)
55 | ID<2>.ID<0>(ID<0>, ID, ID<1>, ID<3>) --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>)
56 | ID<2>.ID<0>(ID,ID<0>, ID<1>, ID<3>) --> ID<2>.ID<0>(ID<0>, ID<1>,ID<3>)
57 | ID<0>.ID<1>(<...>) --> ID<0>.ID<1>(<...>)
58 | ID<0>(<...>) --> ID<0>(<...>)
59 | ID<0>.ID<1>.ID<2>(<...>) --> ID<0>.ID<1>.ID<2>(<...>)
60 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/8/queries.txt:
--------------------------------------------------------------------------------
1 | ID<2>(ID<1>, ID<0>) --> ID<2>(ID<0>, ID<1>)
2 | ID<2>(ID<1>, LT<0>) --> ID<2>(LT<0>, ID<1>)
3 | ID<2>(LT<1>, ID<0>) --> ID<2>(ID<0>, LT<1>)
4 | ID<3>.ID<2>(ID<1>, LT<0>) --> ID<3>.ID<2>(LT<0>, ID<1>)
5 | ID<3>.ID<2>(LT<1>, ID<0>) --> ID<3>.ID<2>(ID<0>, LT<1>)
6 | ID<3>.ID<2>(ID.ID<1>, LT<0>) --> ID<3>.ID<2>(LT<0>, ID.ID<1>)
7 | ID<3>.ID<2>(LT<1>, ID.ID<0>) --> ID<3>.ID<2>(ID.ID<0>, LT<1>)
8 | ID<2>(ID<1>, LT<0>); --> ID<2>(LT<0>, ID<1>);
9 | ID<2>(LT<1>, ID<0>); --> ID<2>(ID<0>, LT<1>);
10 | ID<3>.ID<2>(ID<1>, LT<0>); --> ID<3>.ID<2>(LT<0>, ID<1>);
11 | ID<3>.ID<2>(LT<1>, ID<0>); --> ID<3>.ID<2>(ID<0>, LT<1>);
12 | ID<2>(ID<3>.ID<1>, LT<0>); --> ID<2>(LT<0>, ID<3>.ID<1>);
13 | ID<2>(LT<1>, ID<3>.ID<0>); --> ID<2>(ID<3>.ID<0>, LT<1>);
14 | ID<3>(ID<1>, ID<0>, ID<2>) --> ID<3>(ID<0>, ID<1>, ID<2>)
15 | ID<3>(ID<1>, ID<2>, ID<0>) --> ID<3>(ID<0>, ID<1>, ID<2>)
16 | ID<3>( ID<2>, ID<1>, ID<0>) --> ID<3>(ID<0>, ID<1>, ID<2>)
17 | ID<3>(ID<1>, ID<2>, ID<0>) --> ID<3>(ID<0>,ID<2>, ID<1>)
18 | ID<3>( ID<2>, ID<1>, ID<0>) --> ID<3>(ID<0>, ID<2>, ID<1>)
19 | ID<3>.ID<2>(ID<1>, ID<0>) --> ID<3>.ID<2>(ID<0>, ID<1>)
20 | ID<3>.ID<2>(ID<1>, ID<0>); --> ID<3>.ID<2>(ID<0>, ID<1>);
21 | ID<3>.ID<2>(ID<1>, LT<0>) --> ID<3>.ID<2>(LT<0>, ID<1>)
22 | ID<3>.ID<2>(ID<1>, LT<0>); --> ID<3>.ID<2>(LT<0>, ID<1>);
23 | ID<3>(ID<1>, ID<0>); --> ID<3>(ID<3>, ID<1>);
24 | ID<3>(ID<1>, ID<0>, ID<2>); --> ID<3>(ID<0>, ID<1>, ID<2>);
25 | ID<3>(ID<1>, ID<2>, ID<0>); --> ID<3>(ID<0>, ID<1>, ID<2>);
26 | ID<3>( ID<2>, ID<1>, ID<0>); --> ID<3>(ID<0>, ID<1>, ID<2>);
27 | ID<3>(ID<1>, ID<2>, ID<0>); --> ID<3>(ID<0>,ID<2>, ID<1>);
28 | ID<3>( ID<2>, ID<1>, ID<0>); --> ID<3>(ID<0>, ID<2>, ID<1>);
29 | ID<3>.ID<2>(ID<1>, ID<0>); --> ID<3>.ID<2>(ID<0>, ID<1>);
30 | ID<2>(LT<1>, LT<0>); --> ID<2>(LT<0>, LT<1>);
31 | ID<2>(LT<1>, LT<0>); --> ID<2>(LT<0>, LT<1>);
32 | ID<3>.ID<2>(LT<1>, LT<0>); --> ID<3>.ID<2>(LT<0>, LT<1>);
33 | ID<3>.ID<2>(LT<1>, LT<0>); --> ID<3>.ID<2>(LT<0>, LT<1>);
34 |
--------------------------------------------------------------------------------
/src/main/resources/Effectiveness/9/queries.txt:
--------------------------------------------------------------------------------
1 | ID<0>(<...>) unOP; --> ID<0>(<...>) unOP;
2 | ID<0>(<...>) unOP --> ID<0>(<...>) unOP
3 | unOP ID<0>(<...>); --> unOP ID<0>(<...>);
4 | unOP ID<0>(<...>) --> unOP ID<0>(<...>)
5 | ID<0>(<...>) unOP; --> ID<0>(<...>) unOP;
6 | ID<0>(<...>) unOP --> ID<0>(<...>) unOP
7 | unOP ID<0>(<...>); -->unOP ID<0>(<...>) ;
8 | unOP ID<0>(<...>) --> unOP ID<0>(<...>)
9 | ID<0> unOP; --> ID<0> unOP;
10 | ID<0> unOP --> ID<0> unOP
11 | unOP ID<0>; --> ID<0> unOP;
12 | unOP ID<0> --> ID<0> unOP
13 | ID<0> unOP; -->unOP ID<0> ;
14 | ID<0> unOP -->unOP ID<0>
15 | unOP ID<0>; --> unOP ID<0>;
16 | unOP ID<0> --> unOP ID<0>
17 | ID<0> unOP; --> ID<0> unOP;
18 | ID<0> unOP --> ID<0> unOP
19 | unOP ID<0>; --> unOP ID<0>;
20 | unOP ID<0> --> unOP ID<0>
21 | ID<1>.ID<0>(<...>) unOP; --> ID<1>.ID<0>(<...>) unOP;
22 | ID<1>.ID<0>(<...>) unOP --> ID<1>.ID<0>(<...>) unOP
23 | unOP ID<1>.ID<0>(<...>); --> unOP ID<1>.ID<0>(<...>);
24 | unOP ID<1>.ID<0>(<...>) --> unOP ID<1>.ID<0>(<...>)
25 | ID<1>.ID<0>(<...>) unOP; --> unOP ID<1>.ID<0>(<...>);
26 | ID<1>.ID<0>(<...>) unOP --> unOP ID<1>.ID<0>(<...>)
27 | unOP ID<1>.ID<0>(<...>); --> unOP ID<1>.ID<0>(<...>);
28 | unOP ID<1>.ID<0>(<...>) --> unOP ID<1>.ID<0>(<...>)
29 | ID<1>.ID<0> unOP; --> ID<1>.ID<0> unOP;
30 | ID<1>.ID<0> unOP --> ID<1>.ID<0> unOP
31 | unOP ID<1>.ID<0>; --> unOP ID<1>.ID<0>;
32 | unOP ID<1>.ID<0> --> unOP ID<1>.ID<0>
33 | ID<0>.ID<1>(<...>) --> !ID<0>.ID<1>(<...>)
34 | if(ID<0>.ID<1>(<...>)){ --> if(!ID<0>.ID<1>(<...>)){
35 | if(!ID<0>.ID<1>(<...>)){ --> if(ID<0>.ID<1>(<...>)){
36 | if(ID<1>(<...>)){ --> if(!ID<1>(<...>)){
37 |
--------------------------------------------------------------------------------
/src/main/resources/GUI/Output/.readme.txt:
--------------------------------------------------------------------------------
1 | JSONfile contaning the code changes for each query.
2 |
3 |
--------------------------------------------------------------------------------
/src/main/resources/GUI/readme.txt:
--------------------------------------------------------------------------------
1 | This is a short guide how to run the jar file to test the new GUI.
2 |
3 | =========================================================================================
4 |
5 | I used the following Java version on Ubuntu:
6 |
7 | openjdk 11.0.7 2020-04-14
8 | OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu219.10)
9 | OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu219.10, mixed mode, sharing)
10 |
11 |
12 | You can run diffsearch.jar using with the following command:
13 |
14 | java -jar ./out/artifacts/diffsearch_jar/diffsearch.jar
15 |
16 | where . is the folder Diffsearch/
17 |
18 | If you have the error: java.net.BindException: Address already in use
19 |
20 | you can fix with the command:
21 | fuser -k 8843/tcp
22 |
23 | To stop diffsearch you can use CTRL+C instead of CTRL+Z, because CTRL+Z keeps the ports open.
24 |
25 | ==========================================================================================
26 |
27 | The server waits on the port 8843 for a post data. The post data is with two elements: Text1: "old part" of the query and Text2: "new part" of the query.
28 |
29 | Then, the server will send the JSON file with the results on the same port. The JSON file is also saved in the file GUI/Output/output.json for tests.
30 |
31 | A practical example:
32 |
33 | [INPUT]
34 |
35 | The query is, for example:
36 |
37 | old part: ID<1>(ID<2>, LT<3>);
38 | new part: ID<1>(LT<3>, ID<2>);
39 |
40 | The post data is with two elements: Text1: "old part" of the query and Text2: "new part" of the query: Text1=ID%3C1%3E%28ID%3C2%3E%2C+LT%3C3%3E%29%3B&Text2=ID%3C1%3E%28LT%3C3%3E%2C+ID%3C2%3E%29%3B
41 |
42 | Then I use:
43 |
44 | result = java.net.URLDecoder.decode(postData.toString().replaceAll("Text1=","").replaceAll("&Text2=","-->"), StandardCharsets.UTF_8);
45 |
46 | and I have:
47 |
48 | ID<1>(ID<2>, LT<3>);-->ID<1>(LT<3>, ID<2>);
49 |
50 | [OUTPUT]
51 |
52 | An example of the JSON file with two code changes is:
53 |
54 | [
55 | {"url":"https://github.com/quarkusio/quarkus/commit/8b3d76af5e8f056334cc6ca39b78b90eedd8136a",
56 | "hunk_lines":"-120,15 +120,15",
57 | "codeChange_old":"assertEquals(numberOfSegments,2);",
58 | "codeChange_new":"assertEquals(2,numberOfSegments);"},
59 |
60 | {"url":"https://github.com/quarkusio/quarkus/commit/1c89c51f6626fed09d594ea69289da13736d613b",
61 | "hunk_lines":"-0,0 +1,34",
62 | "codeChange_old":"assertFalse(deployed,\"Shouldnotdeployinvalidrule\");",
63 | "codeChange_new":"assertFalse(\"Shouldnotdeployinvalidrule\",deployed);"}
64 | ]
65 |
66 | The urls can be sometimes wrong, I will fix this bug soon.
67 |
68 | ===============================================================================================
69 |
70 | If you want to read the code of the java server, it is in the file:
71 | src/main/java/research/diffsearch/WebServerGUI.java
72 |
73 | ===============================================================================================
74 |
75 | There are some queries tested by me that you can use at the beginning, they are in the file:
76 | src/main/resources/queries.txt
77 |
78 |
--------------------------------------------------------------------------------
/src/main/resources/Input/repositories_list.txt:
--------------------------------------------------------------------------------
1 | https://github.com/spring-projects/spring-boot
2 | https://github.com/iluwatar/java-design-patterns
3 | https://github.com/square/retrofit
4 | https://github.com/zxing/zxing
5 | https://github.com/libgdx/libgdx
6 | https://github.com/google/guava
7 | https://github.com/alibaba/dubbo
8 | https://github.com/jfeinstein10/SlidingMenu
9 | https://github.com/netty/netty
10 | https://github.com/JakeWharton/ActionBarSherlock
11 | https://github.com/chrisbanes/Android-PullToRefresh
12 | https://github.com/alibaba/fastjson
13 | https://github.com/deeplearning4j/deeplearning4j
14 | https://github.com/JakeWharton/ViewPagerIndicator
15 | https://github.com/alibaba/druid
16 | https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh
17 | https://github.com/mybatis/mybatis-3
18 | https://github.com/springside/springside4
19 | https://github.com/apache/storm
20 | https://github.com/xetorthio/jedis
21 | https://github.com/dropwizard/dropwizard
22 | https://github.com/swagger-api/swagger-codegen
23 | https://github.com/code4craft/webmagic
24 | https://github.com/junit-team/junit
25 | https://github.com/Trinea/android-common
26 | https://github.com/nhaarman/ListViewAnimations
--------------------------------------------------------------------------------
/src/main/resources/Input/repositories_list_js.txt:
--------------------------------------------------------------------------------
1 | https://github.com/twbs/bootstrap
2 | https://github.com/FortAwesome/Font-Awesome
3 | https://github.com/atom/atom
4 | https://github.com/typicode/json-server
5 | https://github.com/lodash/lodash
6 | https://github.com/iptv-org/iptv
7 | https://github.com/TryGhost/Ghost
8 | https://github.com/iamkun/dayjs
9 | https://github.com/hexojs/hexo
10 | https://github.com/Marak/faker.js
11 | https://github.com/cypress-io/cypress
12 | https://github.com/photonstorm/phaser
13 | https://github.com/preactjs/preact
14 | https://github.com/jashkenas/backbone
15 | https://github.com/agalwood/Motrix
16 | https://github.com/microsoft/monaco-editor
17 | https://github.com/markedjs/marked
18 | https://github.com/select2/select2
19 | https://github.com/ajaxorg/ace
20 | https://github.com/codemirror/CodeMirror
21 | https://github.com/Automattic/mongoose
22 | https://github.com/SortableJS/Sortable
23 | https://github.com/hammerjs/hammer.js
24 | https://github.com/pcottle/learnGitBranching
25 | https://github.com/emberjs/ember.js
26 | https://github.com/pure-css/pure
27 | https://github.com/bevacqua/dragula
28 | https://github.com/sampotts/plyr
29 | https://github.com/jlmakes/scrollreveal
30 | https://github.com/react-bootstrap/react-bootstrap
31 | https://github.com/postcss/autoprefixer
32 | https://github.com/portainer/portainer
33 | https://github.com/zhaoolee/ChromeAppHeroes
34 | https://github.com/benweet/stackedit
35 | https://github.com/docsifyjs/docsify
36 | https://github.com/reduxjs/reselect
37 | https://github.com/validatorjs/validator.js
38 | https://github.com/popperjs/popper-core
39 | https://github.com/winstonjs/winston
40 | https://github.com/wekan/wekan
41 | https://github.com/twbs/bootstrap
42 |
43 |
--------------------------------------------------------------------------------
/src/main/resources/Input/repositories_list_oliver.txt:
--------------------------------------------------------------------------------
1 | https://github.com/JabRef/jabref.git
2 | https://github.com/eclipse/winery.git
3 | https://github.com/oracle/graal.git
4 | https://github.com/eclipse/eclipse-collections.git
5 |
--------------------------------------------------------------------------------
/src/main/resources/Input/topJavaMavenProjects.txt:
--------------------------------------------------------------------------------
1 | https://github.com/Graylog2/graylog2-server
2 | https://github.com/pedrovgs/EffectiveAndroidUI
3 | https://github.com/Devlight/InfiniteCycleViewPager
4 | https://github.com/davemorrissey/subsampling-scale-image-view
5 | https://github.com/Angel-ML/angel
6 | https://github.com/facebook/stetho
7 | https://github.com/singwhatiwanna/dynamic-load-apk
8 | https://github.com/dropwizard/metrics
9 | https://github.com/CarGuo/GSYVideoPlayer
10 | https://github.com/bazelbuild/bazel
11 | https://github.com/zhihu/Matisse
12 | https://github.com/dropwizard/dropwizard
13 | https://github.com/NLPchina/elasticsearch-sql
14 | https://github.com/haifengl/smile
15 | https://github.com/seven332/EhViewer
16 | https://github.com/yixia/VitamioBundle
17 | https://github.com/signalapp/Signal-Android
18 | https://github.com/Yalantis/uCrop
19 | https://github.com/square/javapoet
20 | https://github.com/leolin310148/ShortcutBadger
21 | https://github.com/quarkusio/quarkus
22 | https://github.com/hs-web/hsweb-framework
23 | https://github.com/youth5201314/banner
24 | https://github.com/androidannotations/androidannotations
25 | https://github.com/JessYanCoding/AndroidAutoSize
26 | https://github.com/guolindev/LitePal
27 | https://github.com/motianhuo/wechat
28 | https://github.com/alibaba/atlas
29 | https://github.com/oracle/graal
30 | https://github.com/react-native-device-info/react-native-device-info
31 | https://github.com/prolificinteractive/material-calendarview
32 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Main-Class: research.diffsearch.main.App
3 | Class-Path: slf4j-api-1.7.2.jar javax.servlet-api-3.1.0.jar org.eclipse.
4 | jgit-4.8.0.201705170830-rc1.jar jetty-client-9.4.30.v20200611.jar diffu
5 | tils-1.2.1.jar websocket-client-9.4.30.v20200611.jar jetty-xml-9.4.30.v
6 | 20200611.jar websocket-server-9.4.30.v20200611.jar log4j-1.2.12.jar com
7 | mons-io-2.6.jar commons-lang3-3.11.jar commons-codec-1.6.jar JavaEWAH-1
8 | .1.6.jar jetty-server-9.4.30.v20200611.jar gson-2.8.6.jar httpclient-4.
9 | 3.6.jar jetty-security-9.4.30.v20200611.jar antlr4-runtime-4.7.1.jar je
10 | tty-io-9.4.30.v20200611.jar websocket-common-9.4.30.v20200611.jar jetty
11 | -util-9.4.30.v20200611.jar websocket-api-9.4.30.v20200611.jar jetty-htt
12 | p-9.4.30.v20200611.jar commons-logging-1.1.3.jar jsoup-1.12.2.jar jsch-
13 | 0.1.54.jar websocket-servlet-9.4.30.v20200611.jar jetty-servlet-9.4.30.
14 | v20200611.jar Java-WebSocket-1.5.1.jar httpcore-4.3.3.jar
15 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/Python/DiffSearch_effectiveness.py:
--------------------------------------------------------------------------------
1 | import json
2 |
3 | def compare_JSON():
4 | with open("../Features_Vectors/result_changes.json") as f1:
5 | diffSeach_changes = json.load(f1)
6 |
7 | print(len(diffSeach_changes))
8 | with open("./sstubs5.json") as f2:
9 | sstubs_changes = json.load(f2)
10 |
11 | intersection = 0
12 |
13 | for change_diffsearch in diffSeach_changes:
14 | for change_sstubs in sstubs_changes:
15 |
16 | if change_diffsearch['c'] == change_sstubs['fixCommitSHA1']:
17 | if change_diffsearch['f'] == change_sstubs['bugFilePath']:
18 | intersection += 1
19 | print(change_diffsearch['o'])
20 | print(change_sstubs['sourceBeforeFix'],"\n")
21 | break
22 |
23 | print("intersection: ", intersection)
24 | print("End of the program.")
25 |
26 | ##################################
27 | ##### MAIN #######################
28 | ##################################
29 | if __name__ == "__main__":
30 | compare_JSON()
31 |
--------------------------------------------------------------------------------
/src/main/resources/Python/FAISS_indexing.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/python3
2 | import logging
3 |
4 | import dask.dataframe as dd
5 | import faiss
6 | import numpy as np
7 | import sys
8 | import pandas as pd
9 |
10 | logging.basicConfig()
11 | logger = logging.getLogger()
12 | logger.setLevel(logging.DEBUG)
13 | logger.info("Starting python")
14 |
15 |
16 | def indexing(feature_in, index_out, dimension, nchanges, part):
17 | # Reading csv feature vectors files
18 | logger.info("Reading " + str(feature_in))
19 | #changes_feature_vectors = pd.read_csv('./src/main/resources/'+ str(feature_in),
20 | # header=None, nrows=int(nchanges)).iloc[:, :].values[0:, :-1].astype('float32')
21 |
22 |
23 | changes_feature_vectors = dd.read_csv('./src/main/resources/' + str(feature_in), header=None).head(n=int(nchanges), npartitions=int(part))
24 |
25 | changes_feature_vectors = changes_feature_vectors.iloc[:, :]
26 | # changes_feature_vectors = changes_feature_vectors.values[0:, :-1]
27 | changes_feature_vectors = changes_feature_vectors.astype('float32')
28 |
29 |
30 | #######################################################################
31 | # FAISS Installation:
32 | # CPU version only
33 | # pip3 install faiss-cpu --no-cache
34 |
35 | # make faiss available
36 | # n = len(changes_feature_vectors) # number of vectors
37 | logger.debug("Dimension: " + str(dimension))
38 | logger.info("Starting indexing")
39 | nlist = 10
40 | quantiser = faiss.IndexFlatL2(dimension)
41 | index = faiss.IndexIVFFlat(quantiser, dimension, nlist, faiss.METRIC_L2)
42 |
43 | np_array = np.ascontiguousarray(changes_feature_vectors)
44 | # print(faiss.MatrixStats(np_array).comments)
45 |
46 | # norm = np.linalg.norm(np_array)
47 | # if norm != 0:
48 | # np_array = np_array / norm
49 | # print(str(np_array))
50 |
51 | index.train(np_array) # train on the database vectors
52 | logger.info("Training finished")
53 | index.add(np_array) # add the vectors and update the index
54 | logger.info("Index added: " + str(index.ntotal) + " entries")
55 |
56 | faiss.write_index(index, "./src/main/resources/" + str(index_out))
57 |
58 |
59 | # print(str(sys.argv[-3]), str(sys.argv[-2]), str(sys.argv[-1]))
60 | indexing(sys.argv[-5], sys.argv[-4], int(sys.argv[-3]), int(sys.argv[-2]), int(sys.argv[-1]))
61 |
--------------------------------------------------------------------------------
/src/main/resources/Python/FAISS_indexing_python.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/python3
2 | import logging
3 |
4 | import dask.dataframe as dd
5 | import faiss
6 | import numpy as np
7 | import sys
8 |
9 | logging.basicConfig()
10 | logger = logging.getLogger()
11 | logger.setLevel(logging.DEBUG)
12 | logger.info("Starting python")
13 |
14 |
15 | def indexing(feature_in, index_out, dimension, nlist, tfidf=False):
16 | # Reading csv feature vectors files
17 | feature_in = str(feature_in) + (".tfidf" if tfidf else "")
18 | logger.info("Reading " + str(feature_in))
19 | changes_feature_vectors = dd.read_csv(str(feature_in), header=None)
20 | changes_feature_vectors = changes_feature_vectors.iloc[:, :]
21 | # changes_feature_vectors = changes_feature_vectors.values[0:, :-1]
22 | changes_feature_vectors = changes_feature_vectors.astype('float32')
23 | logger.debug(f"nlist = {nlist}")
24 |
25 | #######################################################################
26 | # FAISS Installation:
27 | # CPU version only
28 | # pip3 install faiss-cpu --no-cache
29 |
30 | # make faiss available
31 | # n = len(changes_feature_vectors) # number of vectors
32 | logger.debug("Dimension: " + str(dimension))
33 | logger.info("Starting indexing")
34 | quantiser = faiss.IndexFlatL2(dimension)
35 | metric = faiss.METRIC_L2
36 |
37 | if tfidf:
38 | quantiser = faiss.IndexFlatIP(dimension)
39 | metric = faiss.METRIC_INNER_PRODUCT
40 |
41 | index = faiss.IndexIVFFlat(quantiser, dimension, nlist, metric)
42 |
43 | np_array = np.ascontiguousarray(changes_feature_vectors)
44 |
45 | if tfidf:
46 | faiss.normalize_L2(np_array)
47 | index.train(np_array) # train on the database vectors
48 | logger.info("Training finished")
49 | index.add(np_array) # add the vectors and update the index
50 | logger.info("Index added: " + str(index.ntotal) + " entries")
51 |
52 | faiss.write_index(index, str(index_out))
53 |
54 |
55 | indexing(sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv[4]), sys.argv[5] == 'true')
56 |
--------------------------------------------------------------------------------
/src/main/resources/Python/FAISS_indexing_scalability.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/python3
2 | import logging
3 |
4 | import dask.dataframe as dd
5 | import faiss
6 | import numpy as np
7 | import sys
8 |
9 | logging.basicConfig()
10 | logger = logging.getLogger()
11 | logger.setLevel(logging.DEBUG)
12 | logger.info("Starting python")
13 |
14 |
15 | def indexing(feature_in, index_out, dimension, nlist, nchanges, part, tfidf=False):
16 | try:
17 | # Reading csv feature vectors files
18 | feature_in = str(feature_in) + (".tfidf" if tfidf else "")
19 | logger.info("Reading " + str(feature_in))
20 | changes_feature_vectors = dd.read_csv(str(feature_in), header=None).head(n=int(nchanges), npartitions=int(part))
21 | changes_feature_vectors = changes_feature_vectors.iloc[:, :]
22 | # changes_feature_vectors = changes_feature_vectors.values[0:, :-1]
23 | changes_feature_vectors = changes_feature_vectors.astype('float32')
24 | logger.debug(f"nlist = {nlist}")
25 |
26 | #######################################################################
27 | # FAISS Installation:
28 | # CPU version only
29 | # pip3 install faiss-cpu --no-cache
30 |
31 | # make faiss available
32 | # n = len(changes_feature_vectors) # number of vectors
33 | logger.debug("Dimension: " + str(dimension))
34 | logger.info("Starting indexing")
35 | quantiser = faiss.IndexFlatL2(dimension)
36 | metric = faiss.METRIC_L2
37 |
38 | if tfidf:
39 | quantiser = faiss.IndexFlatIP(dimension)
40 | metric = faiss.METRIC_INNER_PRODUCT
41 |
42 | index = faiss.IndexIVFFlat(quantiser, dimension, 10, metric)
43 |
44 | np_array = np.ascontiguousarray(changes_feature_vectors)
45 |
46 | if tfidf:
47 | faiss.normalize_L2(np_array)
48 | index.train(np_array) # train on the database vectors
49 | logger.info("Training finished")
50 | index.add(np_array) # add the vectors and update the index
51 | logger.info("Index added: " + str(index.ntotal) + " entries")
52 |
53 | faiss.write_index(index, str(index_out))
54 | except Exception:
55 | traceback.print_exc()
56 |
57 | indexing(sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv[4]), int(sys.argv[5]), int(sys.argv[6]), sys.argv[7] == 'true')
58 |
--------------------------------------------------------------------------------
/src/main/resources/Python/effectiveness_dataset_creation.py:
--------------------------------------------------------------------------------
1 | import json
2 | import os
3 | import re
4 | from difflib import SequenceMatcher
5 | import pygit2 as git
6 | from pprint import pprint
7 |
8 |
9 | datasetInput = "./sstubs5.json"
10 |
11 | with open(datasetInput) as fh:
12 | dataset = json.load(fh)
13 |
14 | total = len(dataset)
15 | counter = 0
16 | for code_change in dataset:
17 | counter +=1
18 | print("Commits performed", counter, "/", total)
19 | try:
20 | commit = code_change['fixCommitSHA1']
21 | parent_commit = code_change['fixCommitParentSHA1']
22 | projectName = code_change['projectName']
23 | oldline = code_change['bugLineNum']
24 | newline = code_change['fixLineNum']
25 | myFile = open("../java_patch/dataset.patch", 'a')
26 | myFile.write("#@#@!$%#@#@!$%" + commit + "$$$$" + parent_commit + "$$$$" + str(oldline) + "$$$$" + str(newline) + "@@" + projectName + "\n")
27 | myFile.close()
28 | command = "git --git-dir ../GitHub_Java/" + projectName + "/.git diff " + parent_commit + " " + commit + " >> ../java_patch/dataset.patch"
29 | os.system(command)
30 | #print(command)
31 | except:
32 | print('[Error]')
33 | continue
34 |
--------------------------------------------------------------------------------
/src/main/resources/Python/extract_N_Lines.py:
--------------------------------------------------------------------------------
1 | from os import listdir
2 | from os.path import isfile, join
3 |
4 | mypath = "./"
5 | final_path = "../dataset_userstudy.patch"
6 | onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
7 | final_file = []
8 |
9 | def read_first_lines(filename, limit):
10 | result = []
11 | with open(filename, 'r') as input_file:
12 | try:
13 | # files are iterable, you can have a for-loop over a file.
14 | for line_number, line in enumerate(input_file):
15 | if line_number > limit: # line_number starts at 0.
16 | break
17 | result.append(line)
18 | except:
19 | return result
20 | return result
21 |
22 |
23 | for patch_file in onlyfiles:
24 | if 'extract_N_Lines.py' in patch_file:
25 | continue
26 |
27 | final_file += read_first_lines(patch_file, 7500)
28 |
29 |
30 | #for items in final_file:
31 | # print(items)
32 |
33 | textfile = open(final_path, "w")
34 |
35 | for element in final_file:
36 | textfile.write(element)
37 |
38 | textfile.close()
39 |
--------------------------------------------------------------------------------
/src/main/resources/Python/extract_dataset_userstudy.py:
--------------------------------------------------------------------------------
1 | from os import listdir
2 | from os.path import isfile, join
3 |
4 | mypath = "."
5 | final_path = "../dataset_userstudy.patch"
6 | onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
7 | final_file = []
8 |
9 | def read_first_lines(filename, limit):
10 | result = []
11 | with open(filename, 'r') as input_file:
12 | try:
13 | # files are iterable, you can have a for-loop over a file.
14 | for line_number, line in enumerate(input_file):
15 | if line[:2] != '+ ' and line[:2] != '- ':
16 | break
17 | result.append(line)
18 | except:
19 | return result
20 | return result
21 |
22 |
23 | for patch_file in onlyfiles:
24 | if 'extract_N_Lines.py' in patch_file:
25 | continue
26 |
27 | final_file += read_first_lines(patch_file, 7500)
28 |
29 |
30 | #for items in final_file:
31 | # print(items)
32 |
33 | textfile = open(final_path, "w")
34 |
35 | for element in final_file:
36 | textfile.write(element)
37 |
38 | textfile.close()
39 |
--------------------------------------------------------------------------------
/src/main/resources/Python/get_FAISS_index_size.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/python3
2 | import logging
3 | import faiss # make faiss available
4 | import sys
5 |
6 | logging.basicConfig()
7 | logger = logging.getLogger()
8 | logger.setLevel(logging.DEBUG)
9 |
10 | def get_size(index_path, size_file_name):
11 | index = faiss.read_index(index_path)
12 | logger.debug("FAISS index size: " + str(index.ntotal))
13 | # write the index size to file
14 | with open(size_file_name, 'w') as f:
15 | f.write("%s" % str(index.ntotal))
16 |
17 | get_size(index_path=str(sys.argv[1]),
18 | size_file_name=str(sys.argv[2]));
19 |
--------------------------------------------------------------------------------
/src/main/resources/Python/git_dataset_build.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 | import io
4 | import subprocess
5 | from os import walk
6 |
7 | def perform_commit(r, files, commit, commit_message):
8 |
9 | # parent commit
10 | subprocess.run(f"git checkout {commit[:-1]}^".split(" "), cwd=r)
11 |
12 | for file in files:
13 | with open(r + file) as f:
14 | lines = f.read()
15 |
16 | temp = file.split("/")
17 | with open('/home/luca/Downloads/datset/java_top100_dataset/dataset/Activiti-Activiti/' + temp[-1], "w") as myfile:
18 | myfile.write(lines)
19 |
20 | subprocess.run(f"git add .".split(" "), cwd='/home/luca/Downloads/datset/java_top100_dataset')
21 | subprocess.run(f"git~commit~-m~'ARTIFICIAL COMMIT FOR NEW FILES'".split("~"), cwd='/home/luca/Downloads/datset/java_top100_dataset')
22 | subprocess.run(f"git push".split(" "), cwd='/home/luca/Downloads/datset/java_top100_dataset')
23 |
24 | # commit
25 | subprocess.run(f"git checkout {commit[:-1]}".split(" "), cwd=r)
26 |
27 | for file in files:
28 | with open(r + file) as f:
29 | lines = f.read()
30 |
31 | temp = file.split("/")
32 | with open('/home/luca/Downloads/datset/java_top100_dataset/dataset/Activiti-Activiti/' + temp[-1], "w") as myfile:
33 | myfile.write(lines)
34 |
35 | subprocess.run(f"git add .".split(" "), cwd='/home/luca/Downloads/datset/java_top100_dataset')
36 | subprocess.run(f"git~commit~-m~{commit_message}".split("~"), cwd='/home/luca/Downloads/datset/java_top100_dataset')
37 | subprocess.run(f"git push".split(" "), cwd='/home/luca/Downloads/datset/java_top100_dataset')
38 |
39 | filenames = next(walk('./java_patch/'), (None, None, []))[2] # [] if no file
40 |
41 | for filename in filenames:
42 |
43 | file1 = open('./java_patch/' + filename, 'r')
44 | Lines = file1.readlines()
45 |
46 | count = 0
47 | repo = './GitHub_Java/' + filename.replace('.patch', '')
48 | d = {}
49 | files = []
50 | commit = ''
51 | commit_message = ''
52 | flag = False
53 | flag_merge = False
54 |
55 | for line in Lines:
56 | if 'Merge:' in line[:6]:
57 | flag_merge = True
58 |
59 | if flag_merge == True and 'commit' not in line[:6]:
60 | continue
61 | else:
62 | if flag_merge == True:
63 | commit = ''
64 | if count > 0 and count % 2 != 0:
65 | count -= 1
66 | flag_merge = False
67 |
68 | if 'commit' in line[:6]:
69 |
70 | count += 1
71 | if count % 2 == 0 and 'Merge' not in line:
72 | if count > 1 and commit != '':
73 | perform_commit(repo, files, commit, commit_message)
74 |
75 | commit = line.replace('commit ', '')
76 | files = []
77 | commit_message = ''
78 | flag = False
79 | continue
80 |
81 | if 'Date:' in line[:5] and flag_merge == False:
82 | flag = True
83 | continue
84 |
85 | if 'diff --git' in line:
86 | flag = False
87 | temp = line.split(' ')
88 |
89 | if '.java' in temp[2][-7:]:
90 | files.append(temp[2][1:])
91 | continue
92 |
93 | if flag:
94 | commit_message += line
95 |
96 | perform_commit(repo, files, commit, commit_message)
97 | print(repo, "COMPLETED\n")
98 |
99 | print("ALL REPO COMPLETED\n")
--------------------------------------------------------------------------------
/src/main/resources/Python/graphs_scalability.py:
--------------------------------------------------------------------------------
1 | # libraries
2 | import matplotlib.pyplot as plt
3 | import matplotlib.style as style
4 | import numpy as np
5 | import pandas as pd
6 | from matplotlib.ticker import MaxNLocator
7 |
8 | def plot_method(path):
9 | style.use('seaborn-paper') #sets the size of the charts
10 | style.use('seaborn-paper')
11 |
12 | plt.rc('xtick',labelsize=18)
13 | plt.rc('ytick',labelsize=18)
14 |
15 | #Reading csv feature vectors files
16 | data = pd.read_csv('./'+path+'/scalability.csv', header=None, sep= ',').iloc[:, :].values[0:, :].astype('float32')
17 |
18 | axes = plt.gca()
19 |
20 | #axes.xaxis.set_major_locator(MaxNLocator(integer=True))
21 | axes.ticklabel_format(useOffset=False, style='plain')
22 | plt.setp(axes.get_xticklabels(), rotation=30, horizontalalignment='right')
23 |
24 | x = [0, 10000, 50000, 100000, 250000, 400000, 500000, 600000, 700000, 850000, 1000000]
25 |
26 | query1_tot = []
27 | query1_tot.append(0)
28 |
29 | i = 0
30 | while i < 10:
31 | query1_tot.append(data[i][1]+data[i][2])
32 | i += 1
33 |
34 | query2_tot = []
35 | query2_tot.append(0)
36 |
37 | i = 0
38 | while i < 10:
39 | query2_tot.append(data[i][3]+data[i][4])
40 | i += 1
41 |
42 | query3_tot = []
43 | query3_tot.append(0)
44 |
45 | i = 0
46 | while i < 10:
47 | query3_tot.append(data[i][5]+data[i][6])
48 | i += 1
49 |
50 | query4_tot = []
51 | query4_tot.append(0)
52 |
53 | i = 0
54 | while i < 10:
55 | query4_tot.append(data[i][7]+data[i][8])
56 | i += 1
57 |
58 | query5_tot = []
59 | query5_tot.append(0)
60 |
61 | i = 0
62 | while i < 10:
63 | query5_tot.append(data[i][9]+data[i][10])
64 | i += 1
65 |
66 | query6_tot = []
67 | query6_tot.append(0)
68 |
69 | i = 0
70 | while i < 10:
71 | query6_tot.append(data[i][11]+data[i][12])
72 | i += 1
73 |
74 | query7_tot = []
75 | query7_tot.append(0)
76 |
77 | i = 0
78 | while i < 10:
79 | query7_tot.append(data[i][13]+data[i][14])
80 | i += 1
81 |
82 | query8_tot = []
83 | query8_tot.append(0)
84 |
85 | i = 0
86 | while i < 10:
87 | query8_tot.append(data[i][15]+data[i][16])
88 | i += 1
89 |
90 | query9_tot = []
91 | query9_tot.append(0)
92 |
93 | i = 0
94 | while i < 10:
95 | query9_tot.append(data[i][17]+data[i][18])
96 | i += 1
97 |
98 | query10_tot = []
99 | query10_tot.append(0)
100 |
101 | i = 0
102 | while i < 10:
103 | query10_tot.append(data[i][19]+data[i][20])
104 | i += 1
105 |
106 | #axes.set_ylim([0,max(query1_tot + query2_tot + query3_tot + query5_tot +
107 | # query6_tot + query7_tot + query8_tot + query9_tot + query10_tot)+0.2])
108 |
109 | axes.set_ylim([0,30])
110 |
111 | # use the plot function
112 | plt.plot(x,query1_tot, marker='', color='red', label='Query 1', linewidth=2)
113 | plt.plot(x,query2_tot, marker='', color='olive', label='Query 2', linewidth=2)
114 | plt.plot(x,query3_tot, marker='', color='blue', label='Query 3', linewidth=2)
115 | plt.plot(x,query4_tot, marker='', color='orange',label='Query 4', linewidth=2)
116 | plt.plot(x,query5_tot, marker='', color='black', label='Query 5',linewidth=2)
117 | plt.plot(x,query6_tot, marker='', color='lightblue', label='Query 6', linewidth=2)
118 | plt.plot(x,query7_tot, marker='', color='brown', label='Query 7', linewidth=2)
119 | plt.plot(x,query8_tot, marker='', color='yellow', label='Query 8', linewidth=2)
120 | plt.plot(x,query9_tot, marker='', color='silver',label='Query 9', linewidth=2)
121 | plt.plot(x,query10_tot, marker='', color='green', label='Query 10',linewidth=2)
122 |
123 | plt.legend(fontsize=9)
124 | plt.ylabel('Time (seconds)', fontsize=18)
125 | plt.xlabel('# Changes', fontsize=18)
126 |
127 | plt.savefig(path+"Scalability.pdf", bbox_inches='tight')
128 |
129 | plt.close()
130 |
131 |
132 |
133 | plot_method('Java')
134 | #plot_method('JavaScript')
135 | #plot_method('Python')
136 |
--------------------------------------------------------------------------------
/src/main/resources/QueryResult/JS/JS_Results_Query_Relation.csv:
--------------------------------------------------------------------------------
1 | 23,26
2 | 53,55
3 | 102,102
4 | 37,37
5 | 25,24
6 | 35,37
7 | 49,49
8 | 42,42
9 | 54,54
10 | 31,45
11 | 30,34
12 | 63,64
13 | 76,76
14 | 46,46
15 | 28,91
16 | 25,25
17 | 32,32
18 | 25,25
19 | 60,60
20 | 30,61
21 | 20,26
22 | 45,55
23 | 77,102
24 | 28,37
25 | 19,24
26 | 29,37
27 | 51,49
28 | 41,45
29 | 39,54
30 | 25,45
31 | 38,34
32 | 63,64
33 | 50,76
34 | 42,46
35 | 26,91
36 | 24,25
37 | 25,32
38 | 15,27
39 | 26,44
40 | 27,47
41 | 22,39
42 | 22,52
43 | 77,102
44 | 13,45
45 | 14,27
46 | 23,77
47 | 33,49
48 | 37,77
49 | 19,46
50 | 23,49
51 | 31,34
52 | 43,106
53 | 34,76
54 | 38,49
55 | 27,88
56 | 21,33
57 | 27,32
58 | 13,45
59 | 23,38
60 | 25,40
61 | 13,57
62 | 24,54
63 | 61,0
64 | 16,37
65 | 13,27
66 | 23,87
67 | 21,109
68 | 39,110
69 | 39,68
70 | 24,68
71 | 23,54
72 | 32,58
73 | 32,139
74 | 46,66
75 | 45,49
76 | 15,98
77 | 24,59
78 | 31,101
79 | 14,37
80 | 20,55
81 |
82 |
--------------------------------------------------------------------------------
/src/main/resources/QueryResult/Java/Java_Results_scalability.csv:
--------------------------------------------------------------------------------
1 | 93,93
2 | 80,80
3 | 192,192
4 | 43,42
5 | 107,146
6 | 69,106
7 | 65,65
8 | 53,56
9 | 83,83
10 | 119,119
11 | 186,186
12 | 169,169
13 | 92,92
14 | 82,82
15 | 20,212
16 | 121,121
17 | 268,250
18 | 56,56
19 | 277,277
20 | 94,94
21 | 28,30
22 | 31,67
23 | 46,53
24 | 50,63
25 | 156,200
26 | 189,179
27 | 52,64
28 | 89,153
29 | 48,42
30 | 67,84
31 | 76,66
32 | 228,319
33 | 449,425
34 | 1004,304
35 | 125,118
36 | 104,149
37 | 55,144
38 | 48,79
39 | 279,262
40 | 43,92
41 | 31,30
42 | 66,112
43 | 29,118
44 | 25,48
45 | 69,94
46 | 38,83
47 | 85,192
48 | 100,101
49 | 34,178
50 | 34,45
51 | 54,90
52 | 28,242
53 | 111,114
54 | 257,260
55 | 30,63
56 | 46,40
57 | 23,47
58 | 68,243
59 | 31,73
60 | 25,32
61 | 12,26
62 | 61,107
63 | 29,32
64 | 58,82
65 | 46,123
66 | 49,145
67 | 43,173
68 | 25,44
69 | 38,93
70 | 78,130
71 | 63,82
72 | 34,95
73 | 32,87
74 | 42,80
75 | 33,197
76 | 85,115
77 | 79,136
78 | 57,219
79 | 94,211
80 | 30,263
81 |
82 |
--------------------------------------------------------------------------------
/src/main/resources/QueryResult/Python/Python_Results_Query_Relation.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/QueryResult/Python/Python_Results_Query_Relation.csv
--------------------------------------------------------------------------------
/src/main/resources/Recall/Input/full/queriesForRecall_PY.txt:
--------------------------------------------------------------------------------
1 | return test --> return None
2 | if training:\nuse_mems = use_mems if use_mems is not None else self.use_mems_train --> if training and inputs["use_mems"] is None:\ninputs["use_mems"] = self.use_mems_train
3 | words.arrange_submobjects(DOWN) --> words.arrange(DOWN)
4 | return test --> return None
5 | self.stdscr.clear() --> self.stdscr.erase()
6 | out = feed._handle_response(response) --> feed._handle_response(response)
7 | print_succ('Executed specified command via WMI') --> print_succ('{}:{} Executed command via WMIEXEC'.format(self.__win32Process.get_target(),settings.args.port))
8 | print("Creating table reference") --> print("Creating table [unicode_test] reference")
9 | if pc:\non_connect(pc) --> if pc and self.handler:\nevent(ON_CONNECT, pc, self.handler, self.config)
10 | matrix.highlight_columns(X_COLOR, Y_COLOR) --> matrix.set_color_columns(X_COLOR, Y_COLOR)
11 | return self._sep_token --> return None
12 | self.blob_write(extra_data) --> self.blob_writer.write(extra_data)
13 | items = rcol.perform_collect() --> rcol.perform_collect()\nitems = rcol.items
14 | exit(0) --> sys.exit(0)
15 | print('Epoch %d' % epoch) --> print('Epoch %d out of %d' % (epoch, self.nb_epoch))
16 | if license_: --> if license_ and show("license"):
17 | if download_mirrors: --> if download_mirrors or conf.settings['download_mirrors']:
18 | model.to_gpu() --> model.to_device(device)
19 | pg = p.path_group() --> pg = p.factory.path_group()
20 | outcome = RunExecutor.execute(self) --> outcome = RunExecutor.execute(self, False)
21 | return ID --> return None
22 | if ID:\nuse_mems = use_mems if ID is not None else self.use_mems_train --> if ID and inputs["use_mems"] is None:\ninputs["use_mems"] = self.ID
23 | words.ID(DOWN) --> words.ID(DOWN)
24 | return test --> return LT
25 | self.stdscr.ID() --> self.stdscr.ID()
26 | out = ID<0>._handle_response(response) --> ID<0>._handle_response(response)
27 | ID('Executed specified command via WMI') --> ID('{}:{} Executed command via WMIEXEC'.format(self.__win32Process.get_target(),settings.args.port))
28 | ID("Creating table reference") --> ID("Creating table [unicode_test] reference")
29 | if ID:\non_connect(pc) --> if ID and self.handler:\nevent(ON_CONNECT, pc, self.handler, self.config)
30 | ID<0>.highlight_columns(X_COLOR, Y_COLOR) --> ID<0>.set_color_columns(X_COLOR, Y_COLOR)
31 | return self.ID --> return None
32 | self.blob_write(ID) --> self.blob_writer.write(ID)
33 | items = rcol.ID<0>() --> rcol.ID<0>()\nitems = rcol.items
34 | ID<0>(0) --> sys.ID<0>(0)
35 | ID<0>('Epoch %d' % epoch) --> ID<0>('Epoch %d out of %d' % (epoch, self.nb_epoch))
36 | if ID: --> if ID and show("license"):
37 | if ID<0>: --> if ID<0> or conf.settings['download_mirrors']:
38 | ID<0>.to_gpu() --> ID<0>.to_device(device)
39 | pg = p.ID<0>() --> pg = p.factory.ID<0>()
40 | outcome = RunExecutor.ID<0>(self) --> outcome = RunExecutor.ID<0>(self, False)
41 | return ID --> return LT
42 | if ID:\nuse_mems = ID if ID is not None else self.ID --> if ID and inputs["use_mems"] is None:\ninputs["use_mems"] = ID.ID
43 | ID.ID(DOWN) --> ID.ID(DOWN)
44 | return ID.ID --> return LT
45 | self.ID.ID() --> self.ID.ID()
46 | out = ID<0>.ID(response) --> ID<0>.ID(response)
47 | ID.ID(LT) --> ID.ID(LT)
48 | ID.ID.ID(LT) --> ID.ID.ID(LT)
49 | if ID:\non_connect(ID) --> if ID and self.ID:\nevent(ON_CONNECT, ID, self.handler, self.config)
50 | ID<0>.ID(X_COLOR, Y_COLOR) --> ID<0>.ID(X_COLOR, Y_COLOR)
51 | return self.ID --> return LT
52 | self.ID(ID) --> self.blob_writer.ID(ID)
53 | items = ID.ID<0>() --> ID.ID<0>()\nitems = rcol.items
54 | ID<0>(0) --> ID.ID<0>(0)
55 | ID<0>('Epoch %d' % ID) --> ID<0>('Epoch %d out of %d' % (ID, self.nb_epoch))
56 | if ID: --> if ID and ID("license"):
57 | if ID<0>: --> if ID<0> or ID.settings['download_mirrors']:
58 | ID<0>.to_gpu() --> ID<0>.ID(device)
59 | pg = p.ID<0>() --> pg = p.ID.ID<0>()
60 | outcome = ID.ID<0>(self) --> outcome = ID.ID<0>(self, False)
61 | return <...> --> return EXPR
62 | if ID:\nuse_mems = EXPR if ID is not None else self.ID --> if ID and inputs["use_mems"] is None:\ninputs["use_mems"] = ID.ID
63 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Input/queriesForRecall_JS.txt:
--------------------------------------------------------------------------------
1 | _ --> 'hasCORS': false,
2 | _ --> this.setState({routerClasses: 'page-current'});
3 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);
4 | change_skin('skin-blue-light'); --> _
5 | position: relative; --> _
6 | sleep(delay) --> await sleep(delay)
7 | var buttonEl = this; --> var $buttonEl = $(this);
8 | this.timeout(200); --> this.timeout(1500);
9 | _ --> this.audioController = audioControllerFactory();
10 | body = this.json(params); --> _
11 | if (a != undefined) --> if (a)
12 | if (value) {expressions.push(value); --> argsComma.push(value);
13 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;
14 | if (roomUrl == null) --> if (roomUrl === null)
15 | _ --> throw e;}return true;}
16 | return app.ready(); --> _
17 | while (true) --> while (current)
18 | success_callback(); --> _
19 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);
20 | return input; --> return null;
21 | _ --> 'hasCORS': LT,
22 | _ --> ID.ID({routerClasses: 'page-current'});
23 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);
24 | ID('skin-blue-light'); --> _
25 | ID: relative; --> _
26 | ID(delay) --> await ID(delay)
27 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);
28 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);
29 | _ --> ID.ID = audioControllerFactory();
30 | body = this.ID(ID); --> _
31 | if (ID<0> != undefined) --> if (ID<0>)
32 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);
33 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;
34 | if (ID<0> == null) --> if (ID<0> === null)
35 | _ --> throw e;}return LT;}
36 | return ID.ready(); --> _
37 | while (LT) --> while (ID)
38 | ID(true); --> _
39 | ID<0>(); --> ID<0>(error);
40 | return ID; --> return null;
41 | if(EXPR) --> if(EXPR),
42 | _ --> ID.ID({ID: LT});
43 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);
44 | ID(LT); --> _
45 | ID: ID; --> _
46 | ID(ID) --> await ID(ID)
47 | var ID = ID; --> var ID = $(ID);
48 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);
49 | _ --> ID.ID = ID();
50 | ID = this.ID(ID); --> _
51 | if (ID<0> != ID) --> if (ID<0>)
52 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);
53 | ID<0> = ID; --> ID<0> = ID * 1000;
54 | if (ID<0> == LT) --> if (ID<0> === LT)
55 | _ --> throw ID;}return LT;}
56 | return ID.ID(); --> _
57 | while (LT) --> while (EXPR)
58 | ID(LT); --> _
59 | ID<0>(); --> ID<0>(ID);
60 | return ID; --> return LT;
61 | _ --> LT :LT,
62 | _ --> ID.ID({ID: EXPR});
63 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);
64 | ID(<...>); --> _
65 | ID: EXPR;-->_
66 | ID<0>: LT --> ID<0>: LT
67 | <...> --> await <...>
68 | var ID = <...>; --> var ID = ID(<...>);
69 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);
70 | _ --> ID.ID = ID(<...>);
71 | ID = ID.ID(<...>); -->_
72 | if (ID binOP ID) --> if (<...>)
73 | if (ID) { ID.ID(<...>); --><...>
74 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;
75 | if (ID<0> binOP null)-->if (ID<0> binOP null)
76 | _-->throw EXPR;
77 | return ID.ID(<...>);-->_
78 | while (<...>) --> while (<...>)
79 | ID(<...>);-->_
80 | ID(<...>);-->ID(ID);
81 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Input/queriesForRecall_PY (copy).txt:
--------------------------------------------------------------------------------
1 | return test --> return None
2 | if training:\nuse_mems = use_mems if use_mems is not None else self.use_mems_train --> if training and inputs["use_mems"] is None:\ninputs["use_mems"] = self.use_mems_train
3 | words.arrange_submobjects(DOWN) --> words.arrange(DOWN)
4 | return test --> return None
5 | self.stdscr.clear() --> self.stdscr.erase()
6 | out = feed._handle_response(response) --> feed._handle_response(response)
7 | print_succ('Executed specified command via WMI') --> print_succ('{}:{} Executed command via WMIEXEC'.format(self.__win32Process.get_target(),settings.args.port))
8 | print("Creating table reference") --> print("Creating table [unicode_test] reference")
9 | if pc:\non_connect(pc) --> if pc and self.handler:\nevent(ON_CONNECT, pc, self.handler, self.config)
10 | matrix.highlight_columns(X_COLOR, Y_COLOR) --> matrix.set_color_columns(X_COLOR, Y_COLOR)
11 | return self._sep_token --> return None
12 | self.blob_write(extra_data) --> self.blob_writer.write(extra_data)
13 | items = rcol.perform_collect() --> rcol.perform_collect()\nitems = rcol.items
14 | exit(0) --> sys.exit(0)
15 | print('Epoch %d' % epoch) --> print('Epoch %d out of %d' % (epoch, self.nb_epoch))
16 | if license_: --> if license_ and show("license"):
17 | if download_mirrors: --> if download_mirrors or conf.settings['download_mirrors']:
18 | model.to_gpu() --> model.to_device(device)
19 | pg = p.path_group() --> pg = p.factory.path_group()
20 | outcome = RunExecutor.execute(self) --> outcome = RunExecutor.execute(self, False)
21 | return ID --> return None
22 | if ID:\nuse_mems = use_mems if ID is not None else self.use_mems_train --> if ID and inputs["use_mems"] is None:\ninputs["use_mems"] = self.ID
23 | words.ID(DOWN) --> words.ID(DOWN)
24 | return test --> return LT
25 | self.stdscr.ID() --> self.stdscr.ID()
26 | out = ID<0>._handle_response(response) --> ID<0>._handle_response(response)
27 | ID('Executed specified command via WMI') --> ID('{}:{} Executed command via WMIEXEC'.format(self.__win32Process.get_target(),settings.args.port))
28 | ID("Creating table reference") --> ID("Creating table [unicode_test] reference")
29 | if ID:\non_connect(pc) --> if ID and self.handler:\nevent(ON_CONNECT, pc, self.handler, self.config)
30 | ID<0>.highlight_columns(X_COLOR, Y_COLOR) --> ID<0>.set_color_columns(X_COLOR, Y_COLOR)
31 | return self.ID --> return None
32 | self.blob_write(ID) --> self.blob_writer.write(ID)
33 | items = rcol.ID<0>() --> rcol.ID<0>()\nitems = rcol.items
34 | ID<0>(0) --> sys.ID<0>(0)
35 | ID<0>('Epoch %d' % epoch) --> ID<0>('Epoch %d out of %d' % (epoch, self.nb_epoch))
36 | if ID: --> if ID and show("license"):
37 | if ID<0>: --> if ID<0> or conf.settings['download_mirrors']:
38 | ID<0>.to_gpu() --> ID<0>.to_device(device)
39 | pg = p.ID<0>() --> pg = p.factory.ID<0>()
40 | outcome = RunExecutor.ID<0>(self) --> outcome = RunExecutor.ID<0>(self, False)
41 | return ID --> return LT
42 | if ID:\nuse_mems = ID if ID is not None else self.ID --> if ID and inputs["use_mems"] is None:\ninputs["use_mems"] = ID.ID
43 | ID.ID(DOWN) --> ID.ID(DOWN)
44 | return ID.ID --> return LT
45 | self.ID.ID() --> self.ID.ID()
46 | out = ID<0>.ID(response) --> ID<0>.ID(response)
47 | ID.ID(LT) --> ID.ID(LT)
48 | ID.ID.ID(LT) --> ID.ID.ID(LT)
49 | if ID:\non_connect(ID) --> if ID and self.ID:\nevent(ON_CONNECT, ID, self.handler, self.config)
50 | ID<0>.ID(X_COLOR, Y_COLOR) --> ID<0>.ID(X_COLOR, Y_COLOR)
51 | return self.ID --> return LT
52 | self.ID(ID) --> self.blob_writer.ID(ID)
53 | items = ID.ID<0>() --> ID.ID<0>()\nitems = rcol.items
54 | ID<0>(0) --> ID.ID<0>(0)
55 | ID<0>('Epoch %d' % ID) --> ID<0>('Epoch %d out of %d' % (ID, self.nb_epoch))
56 | if ID: --> if ID and ID("license"):
57 | if ID<0>: --> if ID<0> or ID.settings['download_mirrors']:
58 | ID<0>.to_gpu() --> ID<0>.ID(device)
59 | pg = p.ID<0>() --> pg = p.ID.ID<0>()
60 | outcome = ID.ID<0>(self) --> outcome = ID.ID<0>(self, False)
61 | return <...> --> return EXPR
62 | if ID:\nuse_mems = EXPR if ID is not None else self.ID --> if ID and inputs["use_mems"] is None:\ninputs["use_mems"] = ID.ID
63 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/10000_vl1000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/10000_vl1000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/10000_vl1000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/1000_vl1000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/1000_vl1000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/1000_vl1000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/20000_vl1000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/20000_vl1000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/20000_vl1000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/5000_vl4000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/5000_vl4000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/5000_vl4000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/5000_vl500/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/5000_vl500/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/5000_vl500/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/1000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/1000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/more/1000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/10000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/10000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/more/10000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/20000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/20000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/more/20000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/5000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/JS/more/5000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/JS/more/5000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/5000_vl500/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/Python/5000_vl500/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/5000vl1000/.~lock.RecallResults.csv#:
--------------------------------------------------------------------------------
1 | ,luca,PC,17.11.2021 12:57,file:///home/luca/.config/libreoffice/4;
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/5000vl1000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/Python/5000vl1000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/5000vl2000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/Python/5000vl2000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/5000vl4000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/Python/5000vl4000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/morevl2000/1000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/Python/morevl2000/1000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/morevl2000/10000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/Python/morevl2000/10000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/Python/morevl2000/20000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/Python/morevl2000/20000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/1000/.~lock.RecallResults.csv#:
--------------------------------------------------------------------------------
1 | ,luca,PC,16.11.2021 21:01,file:///home/luca/.config/libreoffice/4;
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/1000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/1000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/zMore/JS - workhorse/1000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/10000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/10000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/zMore/JS - workhorse/10000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/20000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/20000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/zMore/JS - workhorse/20000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/5000/ExpectedValues.csv:
--------------------------------------------------------------------------------
1 | success_callback(); --> _$2
2 | ID('skin-blue-light'); --> _$1
3 | if (value) {expressions.push(value); --> argsComma.push(value);$3
4 | if (ID<0> != undefined) --> if (ID<0>)$1
5 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);$551
6 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;$99
7 | _ --> ID.ID({routerClasses: 'page-current'});$4
8 | ID = ID.ID(<...>); -->_$797
9 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);$3
10 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;$2
11 | if (ID binOP ID) --> if (<...>)$472
12 | if (roomUrl == null) --> if (roomUrl === null)$1
13 | _ --> ID.ID({ID: EXPR});$89
14 | _ --> ID.ID({ID: LT});$62
15 | ID(ID) --> await ID(ID)$86
16 | ID(<...>);-->_$4925
17 | while (LT) --> while (EXPR)$1
18 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;$2
19 | ID: EXPR;-->_$97
20 | if (ID<0> != ID) --> if (ID<0>)$1
21 | if (ID<0> == null) --> if (ID<0> === null)$1
22 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);$1
23 | if (ID) { ID.ID(<...>); --><...>$131
24 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);$46
25 | return ID.ready(); --> _$3
26 | _ --> throw ID;}return LT;}$146
27 | _ --> 'hasCORS': false,$178
28 | <...> --> await <...>$2415
29 | ID(<...>);-->ID(ID);$1348
30 | if (ID<0> binOP null)-->if (ID<0> binOP null)$11
31 | sleep(delay) --> await sleep(delay)$1
32 | if (a != undefined) --> if (a)$1
33 | body = this.ID(ID); --> _$14
34 | while (LT) --> while (ID)$1
35 | _ --> throw e;}return LT;}$55
36 | if (ID<0> == LT) --> if (ID<0> === LT)$254
37 | ID<0>(); --> ID<0>(error);$6
38 | return ID.ID(); --> _$122
39 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);$1
40 | ID = this.ID(ID); --> _$51
41 | return ID; --> return LT;$216
42 | ID(<...>); --> _$4925
43 | _ --> ID.ID = ID();$30
44 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);$13
45 | var buttonEl = this; --> var $buttonEl = $(this);$1
46 | var ID = ID; --> var ID = $(ID);$1
47 | ID: ID; --> _$95
48 | body = this.json(params); --> _$5
49 | ID<0> = ID; --> ID<0> = ID * 1000;$2
50 | _ --> LT :LT,$28932
51 | _ --> this.setState({routerClasses: 'page-current'});$4
52 | _ --> 'hasCORS': LT,$178
53 | _-->throw EXPR;$176
54 | if(EXPR) --> if(EXPR),$285
55 | ID(true); --> _$19
56 | this.timeout(200); --> this.timeout(1500);$1
57 | while (<...>) --> while (<...>)$38
58 | return ID; --> return null;$51
59 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);$1
60 | _ --> ID.ID = ID(<...>);$443
61 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);$1
62 | while (true) --> while (current)$1
63 | ID<0>: LT --> ID<0>: LT$8204
64 | ID<0>(); --> ID<0>(ID);$126
65 | _ --> this.audioController = audioControllerFactory();$9
66 | return input; --> return null;$7
67 | _ --> ID.ID = audioControllerFactory();$9
68 | position: relative; --> _$2
69 | var ID = <...>; --> var ID = ID(<...>);$524
70 | ID(LT); --> _$470
71 | _ --> throw e;}return true;}$55
72 | return ID.ID(<...>);-->_$348
73 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);$1
74 | change_skin('skin-blue-light'); --> _$1
75 | ID(delay) --> await ID(delay)$1
76 | ID: relative; --> _$2
77 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);$2153
78 | return app.ready(); --> _$3
79 |
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/JS - workhorse/5000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/zMore/JS - workhorse/5000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/Python/10000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/zMore/Python/10000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/Python/20000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/zMore/Python/20000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/Output/zMore/Python/5000/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/Output/zMore/Python/5000/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/expected.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Recall/expected.txt
--------------------------------------------------------------------------------
/src/main/resources/Recall/run_recall_script.sh:
--------------------------------------------------------------------------------
1 | mvn exec:java -Dexec.mainClass=research.diffsearch.main.App -Dexec.args="-fe -r -k 5000 -silent -lang java -vl 300 -extractors node;triangle;rulecount:1400 -mt 10" -e
2 | mvn exec:java -Dexec.mainClass=research.diffsearch.main.App -Dexec.args="-b -r -k 5000 -silent -lang java -vl 300 -extractors node;triangle;rulecount:1400 -mt 10" -e
--------------------------------------------------------------------------------
/src/main/resources/Scalability/JS/JS_Results_scalability.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Scalability/JS/JS_Results_scalability.csv
--------------------------------------------------------------------------------
/src/main/resources/Scalability/JS/scalability_queries.txt:
--------------------------------------------------------------------------------
1 | return LT; --> return ID.ID();
2 | ID<0>(ID<1>,ID); --> ID<0>(ID,ID<1>);
3 | _ --> import ID.ID;
4 | _ --> ID.close();
5 | if( ID == null){ <...> --> if( ID != null){ <...>
6 | ID(EXPR); --> _
7 | _ --> assert(ID);
8 | <...> --> try{ <...>} catch(<...>){ <...>
9 | while(EXPR){ <...> --> while(EXPR){ <...>
10 | console.log(<...>) --> _
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Java/Java_Results_scalability_dinamic.csv:
--------------------------------------------------------------------------------
1 | 2.589,1.756,1.073,1.099,1.441,0.823,0.68,2.092,1.011,1.054,0.849,1.12,0.699,0.735,1.045,0.633,0.541,1.96,0.93,1.131,0.816,1.087,0.687,0.739,1.094,0.616,0.585,1.754,0.874,1.058,
2 | 5.573,2.265,1.747,2.005,2.513,1.844,1.784,4.045,1.817,2.326,2.506,2.127,1.728,1.779,2.053,1.634,1.86,4.366,1.89,2.583,2.699,2.109,1.627,2.073,2.713,1.792,1.844,3.625,1.888,2.323,
3 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Java/Java_Results_scalability_first.csv:
--------------------------------------------------------------------------------
1 | 0.9134,0.9564,0.6418,0.6022,0.7698,0.6172,0.6182,1.3678,0.7798,0.7924,
2 | 1.058,1.6622,1.0564,0.8344,1.0966,0.7618,0.6632,1.449,0.9292,1.0192,
3 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Java/scalability_queries.txt:
--------------------------------------------------------------------------------
1 | return LT; --> return ID.ID();
2 | ID<0>(ID<1>,ID); --> ID<0>(ID,ID<1>);
3 | _ --> import ID.ID;
4 | _ --> ID.close();
5 | if( ID == null){ <...> --> if( ID != null){ <...>
6 | ID(EXPR); --> _
7 | _ --> assert ID;
8 | <...> --> try{ <...>} catch(<...>){ <...>
9 | while(EXPR){ <...> --> while(EXPR){ <...>
10 | System.out.println(<...>) --> _
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Java/scalability_slow.csv:
--------------------------------------------------------------------------------
1 | 0.0,1.933,0.0,1.783,0.0,1.361,0.0,1.294,0.0,1.653,0.0,1.135,0.0,0.903,0.0,2.738,0.0,1.164,0.0,1.815,
2 | 0.0,4.136,0.0,5.451,0.0,3.917,0.0,3.892,0.0,4.981,0.0,5.166,0.0,3.683,0.0,8.668,0.0,4.789,0.0,6.097,
3 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Java_Results_scalability.csv:
--------------------------------------------------------------------------------
1 | 1.997,1.4994,1.0378,1.0752,1.2612,1.0682,1.0056,2.4628,1.103,1.3496,
2 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Python/Python_Results_scalability.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Scalability/Python/Python_Results_scalability.csv
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Python/Results_scalability.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Scalability/Python/Results_scalability.csv
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Python/scalability_queries.txt:
--------------------------------------------------------------------------------
1 | return LT; --> return ID.ID();
2 | ID<0>(ID<1>,ID); --> ID<0>(ID,ID<1>);
3 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Slow/JS/JS_Results_scalability.csv:
--------------------------------------------------------------------------------
1 | 0.0,1.929,0.0,1.581,0.0,0.547,0.0,0.482,0.0,0.483,0.0,0.414,0.0,0.387,0.0,0.436,0.0,0.38,0.0,0.528,
2 | 0.0,1.183,0.0,12.547,0.0,1.148,0.0,1.052,0.0,1.451,0.0,1.407,0.0,1.053,0.0,1.606,0.0,1.048,0.0,1.078,
3 | 0.0,1.836,0.0,2.723,0.0,1.892,0.0,1.991,0.0,1.871,0.0,2.075,0.0,1.707,0.0,1.766,0.0,1.814,0.0,1.961,
4 | 0.0,3.881,0.0,82.643,0.0,4.332,0.0,3.646,0.0,4.215,0.0,4.278,0.0,3.594,0.0,3.834,0.0,3.775,0.0,4.205,
5 | 0.0,6.563,0.0,7.085,0.0,6.34,0.0,5.739,0.0,5.964,0.0,7.542,0.0,6.105,0.0,5.368,0.0,6.184,0.0,8.226,
6 | 0.0,8.125,0.0,53.079,0.0,8.527,0.0,7.471,0.0,7.937,0.0,9.564,0.0,7.368,0.0,7.418,0.0,8.088,0.0,8.681,
7 | 0.0,9.096,0.0,14.638,0.0,9.906,0.0,8.668,0.0,9.351,0.0,11.992,0.0,8.134,0.0,9.26,0.0,9.21,0.0,10.959,
8 | 0.0,10.626,0.0,71.298,0.0,11.995,0.0,10.627,0.0,10.586,0.0,13.616,0.0,10.23,0.0,10.624,0.0,11.16,0.0,12.783,
9 | 0.0,12.835,0.0,23.878,0.0,14.135,0.0,12.852,0.0,12.789,0.0,20.814,0.0,12.507,0.0,12.44,0.0,13.346,0.0,17.673,
10 | 0.0,15.432,0.0,80.773,0.0,17.139,0.0,16.153,0.0,15.939,0.0,23.217,0.0,14.552,0.0,15.969,0.0,16.117,0.0,19.912,
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Slow/JS/scalability_queries.txt:
--------------------------------------------------------------------------------
1 | return LT; --> return ID.ID();
2 | ID<0>(ID<1>,ID); --> ID<0>(ID,ID<1>);
3 | _ --> import ID.ID;
4 | _ --> ID.close();
5 | if( ID == null){ <...> --> if( ID != null){ <...>
6 | ID(EXPR); --> _
7 | _ --> assert(ID);
8 | <...> --> try{ <...>} catch(<...>){ <...>
9 | while(EXPR){ <...> --> while(EXPR){ <...>
10 | console.log(<...>) --> _
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Slow/Java/Java_Results_scalability.csv:
--------------------------------------------------------------------------------
1 | 0.0,1.875,0.0,1.337,0.0,0.508,0.0,0.388,0.0,0.6,0.0,0.507,0.0,0.462,0.0,1.121,0.0,0.597,0.0,0.937,
2 | 0.0,1.986,0.0,1.836,0.0,1.253,0.0,1.151,0.0,1.672,0.0,1.346,0.0,0.992,0.0,3.557,0.0,1.218,0.0,3.48,
3 | 0.0,3.178,0.0,2.749,0.0,2.006,0.0,2.025,0.0,2.892,0.0,2.399,0.0,2.117,0.0,7.312,0.0,2.073,0.0,5.997,
4 | 0.0,5.686,0.0,8.615,0.0,5.297,0.0,5.43,0.0,7.189,0.0,6.222,0.0,5.432,0.0,15.426,0.0,5.369,0.0,15.87,
5 | 0.0,9.027,0.0,14.741,0.0,9.284,0.0,8.285,0.0,11.152,0.0,10.265,0.0,8.129,0.0,27.88,0.0,8.723,0.0,26.716,
6 | 0.0,11.297,0.0,279.396,0.0,11.729,0.0,10.491,0.0,14.902,0.0,14.853,0.0,10.501,0.0,38.229,0.0,11.342,0.0,33.431,
7 | 0.0,13.842,0.0,213.079,0.0,13.47,0.0,12.419,0.0,19.513,0.0,16.747,0.0,12.272,0.0,43.904,0.0,13.904,0.0,40.33,
8 | 0.0,16.266,0.0,234.243,0.0,16.639,0.0,15.084,0.0,25.3,0.0,22.41,0.0,14.449,0.0,52.935,0.0,17.298,0.0,47.46,
9 | 0.0,20.717,0.0,162.68,0.0,23.36,0.0,17.022,0.0,30.294,0.0,26.057,0.0,17.324,0.0,64.241,0.0,19.829,0.0,57.081,
10 | 0.0,23.715,0.0,266.539,0.0,24.898,0.0,20.221,0.0,38.771,0.0,31.283,0.0,21.056,0.0,72.829,0.0,24.141,0.0,65.497,
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Slow/Java/scalability_queries.txt:
--------------------------------------------------------------------------------
1 | return LT; --> return ID.ID();
2 | ID<0>(ID<1>,ID); --> ID<0>(ID,ID<1>);
3 | _ --> import ID.ID;
4 | _ --> ID.close();
5 | if( ID == null){ <...> --> if( ID != null){ <...>
6 | ID(EXPR); --> _
7 | _ --> assert ID;
8 | <...> --> try{ <...>} catch(<...>){ <...>
9 | while(EXPR){ <...> --> while(EXPR){ <...>
10 | System.out.println(<...>) --> _
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Slow/Python/Python_Results_scalability.csv:
--------------------------------------------------------------------------------
1 | 0.0,2.241,0.0,0.836,0.0,0.536,0.0,0.485,0.0,0.578,0.0,0.458,0.0,0.494,0.0,0.368,0.0,0.572,0.0,0.581,
2 | 0.0,1.444,0.0,2.774,0.0,1.129,0.0,0.973,0.0,0.91,0.0,1.143,0.0,0.823,0.0,0.67,0.0,0.895,0.0,1.237,
3 | 0.0,2.451,0.0,27.048,0.0,2.197,0.0,2.358,0.0,2.189,0.0,2.657,0.0,1.909,0.0,1.268,0.0,2.862,0.0,3.016,
4 | 0.0,5.743,0.0,33.074,0.0,7.332,0.0,9.02,0.0,9.536,0.0,9.434,0.0,7.182,0.0,3.127,0.0,9.182,0.0,9.725,
5 | 0.0,12.034,0.0,53.779,0.0,11.907,0.0,15.719,0.0,14.681,0.0,15.416,0.0,12.597,0.0,4.883,0.0,12.937,0.0,15.35,
6 | 0.0,16.278,0.0,64.844,0.0,14.644,0.0,18.439,0.0,15.886,0.0,18.945,0.0,12.933,0.0,6.275,0.0,17.022,0.0,18.029,
7 | 0.0,19.876,0.0,70.491,0.0,16.851,0.0,20.933,0.0,20.161,0.0,21.287,0.0,17.61,0.0,6.664,0.0,14.588,0.0,20.602,
8 | 0.0,23.13,0.0,82.94,0.0,17.847,0.0,21.392,0.0,21.64,0.0,24.965,0.0,19.968,0.0,7.569,0.0,20.506,0.0,23.512,
9 | 0.0,27.013,0.0,100.494,0.0,20.545,0.0,29.624,0.0,28.003,0.0,27.997,0.0,19.804,0.0,9.268,0.0,26.42,0.0,27.65,
10 | 0.0,31.926,0.0,106.914,0.0,27.187,0.0,31.381,0.0,31.521,0.0,32.886,0.0,24.942,0.0,10.815,0.0,35.931,0.0,33.574,
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Slow/Python/Results_scalability.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/Scalability/Slow/Python/Results_scalability.csv
--------------------------------------------------------------------------------
/src/main/resources/Scalability/Slow/Python/scalability_queries.txt:
--------------------------------------------------------------------------------
1 | return LT --> return ID.ID()
2 | ID<0>(ID<1>,ID) --> ID<0>(ID,ID<1>)
3 | _ --> import ID.ID
4 | _ --> ID.close()
5 | if ID == null: <...> --> if ID != null: <...>
6 | ID(EXPR) --> _
7 | _ --> assert ID
8 | <...> --> try: <...> except: <...>
9 | while(EXPR): <...> --> while(EXPR): <...>
10 | print(LT) --> _
11 |
--------------------------------------------------------------------------------
/src/main/resources/Scalability/graphs_scalability.py:
--------------------------------------------------------------------------------
1 | # libraries
2 | import matplotlib.pyplot as plt
3 | import matplotlib.style as style
4 | import pandas as pd
5 |
6 |
7 | def plot_method(path):
8 | style.use('seaborn-paper') # sets the size of the charts
9 | style.use('seaborn-paper')
10 |
11 | plt.rc('xtick', labelsize=18)
12 | plt.rc('ytick', labelsize=18)
13 |
14 | # Reading csv feature vectors files
15 | data = pd.read_csv('./' + path + '/scalability.csv', header=None, sep=',').iloc[:, :].values[0:, :].astype(
16 | 'float32')
17 |
18 | axes = plt.gca()
19 |
20 | # axes.xaxis.set_major_locator(MaxNLocator(integer=True))
21 | axes.ticklabel_format(useOffset=False, style='plain')
22 | plt.setp(axes.get_xticklabels(), rotation=30, horizontalalignment='right')
23 |
24 | x = [0, 10000, 50000, 100000, 250000, 400000, 500000, 600000, 700000, 850000, 1000000]
25 |
26 | query1_tot = []
27 | query1_tot.append(0)
28 |
29 | i = 0
30 | while i < 10:
31 | query1_tot.append(data[i][1] + data[i][2])
32 | i += 1
33 |
34 | query2_tot = []
35 | query2_tot.append(0)
36 |
37 | i = 0
38 | while i < 10:
39 | query2_tot.append(data[i][3] + data[i][4])
40 | i += 1
41 |
42 | query3_tot = []
43 | query3_tot.append(0)
44 |
45 | i = 0
46 | while i < 10:
47 | query3_tot.append(data[i][5] + data[i][6])
48 | i += 1
49 |
50 | query4_tot = []
51 | query4_tot.append(0)
52 |
53 | i = 0
54 | while i < 10:
55 | query4_tot.append(data[i][7] + data[i][8])
56 | i += 1
57 |
58 | query5_tot = []
59 | query5_tot.append(0)
60 |
61 | i = 0
62 | while i < 10:
63 | query5_tot.append(data[i][9] + data[i][10])
64 | i += 1
65 |
66 | query6_tot = []
67 | query6_tot.append(0)
68 |
69 | i = 0
70 | while i < 10:
71 | query6_tot.append(data[i][11] + data[i][12])
72 | i += 1
73 |
74 | query7_tot = []
75 | query7_tot.append(0)
76 |
77 | i = 0
78 | while i < 10:
79 | query7_tot.append(data[i][13] + data[i][14])
80 | i += 1
81 |
82 | query8_tot = []
83 | query8_tot.append(0)
84 |
85 | i = 0
86 | while i < 10:
87 | query8_tot.append(data[i][15] + data[i][16])
88 | i += 1
89 |
90 | query9_tot = []
91 | query9_tot.append(0)
92 |
93 | i = 0
94 | while i < 10:
95 | query9_tot.append(data[i][17] + data[i][18])
96 | i += 1
97 |
98 | query10_tot = []
99 | query10_tot.append(0)
100 |
101 | i = 0
102 | while i < 10:
103 | query10_tot.append(data[i][19] + data[i][20])
104 | i += 1
105 |
106 | # axes.set_ylim([0,max(query1_tot + query2_tot + query3_tot + query5_tot +
107 | # query6_tot + query7_tot + query8_tot + query9_tot + query10_tot)+0.2])
108 |
109 | axes.set_ylim([0, 30])
110 |
111 | # use the plot function
112 | plt.plot(x, query1_tot, marker='', color='red', label='Query 1', linewidth=2)
113 | plt.plot(x, query2_tot, marker='', color='olive', label='Query 2', linewidth=2)
114 | plt.plot(x, query3_tot, marker='', color='blue', label='Query 3', linewidth=2)
115 | plt.plot(x, query4_tot, marker='', color='orange', label='Query 4', linewidth=2)
116 | plt.plot(x, query5_tot, marker='', color='black', label='Query 5', linewidth=2)
117 | plt.plot(x, query6_tot, marker='', color='lightblue', label='Query 6', linewidth=2)
118 | plt.plot(x, query7_tot, marker='', color='brown', label='Query 7', linewidth=2)
119 | plt.plot(x, query8_tot, marker='', color='yellow', label='Query 8', linewidth=2)
120 | plt.plot(x, query9_tot, marker='', color='silver', label='Query 9', linewidth=2)
121 | plt.plot(x, query10_tot, marker='', color='green', label='Query 10', linewidth=2)
122 |
123 | plt.legend(fontsize=9)
124 | plt.ylabel('Time (seconds)', fontsize=18)
125 | plt.xlabel('# Changes', fontsize=18)
126 |
127 | plt.savefig(path + "Scalability.pdf", bbox_inches='tight')
128 |
129 | plt.close()
130 |
131 |
132 | plot_method('Java')
133 | # plot_method('JavaScript')
134 | # plot_method('Python')
135 |
--------------------------------------------------------------------------------
/src/main/resources/batchOutput.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sola-st/DiffSearch/8cc9584fbf20ca0823ea284acc488116ea647f96/src/main/resources/batchOutput.txt
--------------------------------------------------------------------------------
/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 | %highlight(%d{HH:mm:ss.SSS} %-44logger{44} : %-5level : %msg%n)
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/make_swap_file.sh:
--------------------------------------------------------------------------------
1 | sudo fallocate -l 38G /swapfile
2 | sudo chmod 600 /swapfile
3 | sudo mkswap /swapfile
4 | sudo swapon /swapfile
5 | sudo swapon --show
--------------------------------------------------------------------------------
/src/main/resources/queries.txt:
--------------------------------------------------------------------------------
1 | Same example of queries that return results:
2 |
3 | ID<1>(ID<2>, LT<3>);-->ID<1>(LT<3>, ID<2>);
4 |
5 | EXPR = ID<1>(<...>);-->EXPR = ID<1>(<...>);
6 |
7 | ID<1>(ID<2>, ID<3>);-->ID<1>(ID<3>, ID<2>);
8 |
9 | ID<1>(ID<2>, ID<3>);-->ID<1>(ID<3>, ID<2>);
10 |
11 | ID<0>.ID<1>(ID, LT)-->ID<0>.ID<1>(ID, LT)
12 |
13 | LT-->LT binOP LT
14 |
15 | return;-->return ID;
16 |
17 | System.out.println(EXPR);-->_
18 |
19 | ID<0> * ID<1>;-->ID<0> + ID<1>;
20 |
21 | EXPR = LT;-->EXPR = ID;
22 |
23 | _-->import java.io.ID;
24 |
25 | if (EXPR != null) {-->if (EXPR == null) {
26 |
27 | EXPR-->try {EXPR;} catch (ID ID) {<...>}
--------------------------------------------------------------------------------
/src/main/resources/queriesForRecall.txt:
--------------------------------------------------------------------------------
1 | _ -->-1 3:1 6:1 14:1 25:1 38:1 41:1 49:1 64:1 69:1 72:1 74:1 76:1 80:1 112:1
2 | public static CallInstruction fromSymbols(Symbols symbols, Type type, int targetIndex, int[] arguments) { final CallInstruction inst = new CallInstruction(type); --> public static CallInstruction fromSymbols(Symbols symbols, Type type, int targetIndex, int[] arguments, AttributesCodeEntry paramAttr) { final CallInstruction inst = new CallInstruction(type, paramAttr);
3 | _ -->import org.androidannotations.annotations.ServiceAction;
4 | import com.oracle.truffle.api.dsl.NodeChild; -->_
5 | import com.oracle.graal.compiler.test.*; -->import com.oracle.graal.compiler.test.GraalCompilerTest;
6 | _ --> elasticsearch-rest-client
7 | return Constant.forShort((short) lowerBound); --> return JavaConstant.forShort((short) lowerBound);
8 | assertFails(() -> value.asByte(), ClassCastException.class); --> // TODO expecting PolyglotException is a temporary workaround GR-21744 assertFails(() -> value.asByte(), ClassCastException.class, PolyglotException.class);
9 | import com.oracle.svm.core.headers.Errno; -->_
10 | /** * @author Lennart Koopmann */ -->_
11 | return String.format("Spherical Variogram (range = %.4f, sill = %.4f, nugget effect = %.4f)", a, b, c); --> return String.format("Spherical Variogram(range = %.4f, sill = %.4f, nugget effect = %.4f)", a, b, c);
12 | --> //
13 |
--------------------------------------------------------------------------------
/src/main/resources/queriesForRecall_JS.txt:
--------------------------------------------------------------------------------
1 | _ --> 'hasCORS': false,
2 | _ --> this.setState({routerClasses: 'page-current'});
3 | var attr = new core.Attr(name, value); --> var attr = this.ownerDocument.createAttribute(name, value);
4 | change_skin('skin-blue-light'); --> _
5 | position: relative; --> _
6 | sleep(delay) --> await sleep(delay)
7 | var buttonEl = this; --> var $buttonEl = $(this);
8 | this.timeout(200); --> this.timeout(1500);
9 | _ --> this.audioController = audioControllerFactory();
10 | body = this.json(params); --> _
11 | if (a != undefined) --> if (a)
12 | if (value) {expressions.push(value); --> argsComma.push(value);
13 | lastTradeTimestamp = timeFilled; --> lastTradeTimestamp = timeFilled * 1000;
14 | if (roomUrl == null) --> if (roomUrl === null)
15 | _ --> throw e;}return true;}
16 | return app.ready(); --> _
17 | while (true) --> while (current)
18 | success_callback(); --> _
19 | getDesktopStreamFailed(); --> getDesktopStreamFailed(error);
20 | return input; --> return null;
21 | _ --> 'hasCORS': LT,
22 | _ --> ID.ID({routerClasses: 'page-current'});
23 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);
24 | ID('skin-blue-light'); --> _
25 | ID: relative; --> _
26 | ID(delay) --> await ID(delay)
27 | var buttonEl = ID<0>; --> var $buttonEl = $(ID<0>);
28 | ID<0>.timeout(LT); --> ID<0>.timeout(LT);
29 | _ --> ID.ID = audioControllerFactory();
30 | body = this.ID(ID); --> _
31 | if (ID<0> != undefined) --> if (ID<0>)
32 | if (ID<0>) {expressions.push(ID<0>); --> argsComma.push(ID<0>);
33 | ID<0> = timeFilled; --> ID<0> = timeFilled * 1000;
34 | if (ID<0> == null) --> if (ID<0> === null)
35 | _ --> throw e;}return LT;}
36 | return ID.ready(); --> _
37 | while (LT) --> while (ID)
38 | ID(true); --> _
39 | ID<0>(); --> ID<0>(error);
40 | return ID; --> return null;
41 | if(EXPR) --> if(EXPR),
42 | _ --> ID.ID({ID: LT});
43 | var attr = new ID.Attr(ID, ID); --> var attr = this.ownerDocument.ID(ID, ID);
44 | ID(LT); --> _
45 | ID: ID; --> _
46 | ID(ID) --> await ID(ID)
47 | var ID = ID; --> var ID = $(ID);
48 | ID<0>.ID<1>(LT); --> ID<0>.ID<1>(LT);
49 | _ --> ID.ID = ID();
50 | ID = this.ID(ID); --> _
51 | if (ID<0> != ID) --> if (ID<0>)
52 | if (ID<0>) {ID.ID(ID<0>); --> ID.ID(ID<0>);
53 | ID<0> = ID; --> ID<0> = ID * 1000;
54 | if (ID<0> == LT) --> if (ID<0> === LT)
55 | _ --> throw ID;}return LT;}
56 | return ID.ID(); --> _
57 | while (LT) --> while (EXPR)
58 | ID(LT); --> _
59 | ID<0>(); --> ID<0>(ID);
60 | return ID; --> return LT;
61 | _ --> LT :LT,
62 | _ --> ID.ID({ID: EXPR});
63 | var ID<0> = new ID.ID(<...>); -->var ID<0> = ID.ID.ID(<...>);
64 | ID(<...>); --> _
65 | ID: EXPR;-->_
66 | ID<0>: LT --> ID<0>: LT
67 | <...> --> await <...>
68 | var ID = <...>; --> var ID = ID(<...>);
69 | this.ID<0>(EXPR); --> this.ID<0>(EXPR);
70 | _ --> ID.ID = ID(<...>);
71 | ID = ID.ID(<...>); -->_
72 | if (ID binOP ID) --> if (<...>)
73 | if (ID) { ID.ID(<...>); --><...>
74 | <...> = EXPR<0>;--><...> = EXPR<0> binOP EXPR;
75 | if (ID<0> binOP null)-->if (ID<0> binOP null)
76 | _-->throw EXPR;
77 | return ID.ID(<...>);-->_
78 | while (<...>) --> while (<...>)
79 | ID(<...>);-->_
80 | ID(<...>);-->ID(ID);
81 |
--------------------------------------------------------------------------------
/src/main/resources/scalability_queryes.txt:
--------------------------------------------------------------------------------
1 | return LT; --> return ID.ID();
2 | ID<0>(ID<1>,ID); --> ID<0>(ID,ID<1>);
3 |
--------------------------------------------------------------------------------
/src/test/java/research/diffsearch/ExtractionTest.java:
--------------------------------------------------------------------------------
1 | package research.diffsearch;
2 |
3 | import com.google.gson.Gson;
4 | import junit.framework.TestCase;
5 | import research.diffsearch.pipeline.base.CodeChange;
6 | import research.diffsearch.tree.SerializableTreeNode;
7 |
8 | import static research.diffsearch.tree.TreeFactory.getAbstractTree;
9 | import static research.diffsearch.util.FilePathUtils.*;
10 | import static research.diffsearch.util.ProgrammingLanguage.JAVA;
11 |
12 | import org.junit.jupiter.api.Test;
13 |
14 | public class ExtractionTest extends TestCase {
15 |
16 | @Test
17 | public void testExtraction() {
18 | var ccIterator = getAllLines(getChangesJsonFilePath(JAVA)).iterator();
19 | var treesIterator = getAllLines(getTreesFilePath(JAVA)).iterator();
20 |
21 | var gson = new Gson();
22 | var index = 0;
23 | while (ccIterator.hasNext() && treesIterator.hasNext()) {
24 | var codeChange = gson.fromJson(ccIterator.next(), CodeChange.class);
25 | var changeTree = gson.fromJson(treesIterator.next(), SerializableTreeNode.class);
26 |
27 | var javaTree = getAbstractTree(codeChange.getFullChangeString().replaceAll("\n", " "), JAVA);
28 | var parsedTree = SerializableTreeNode.fromTree(javaTree.getParseTree(),
29 | JAVA);
30 |
31 | assertEquals("Parse tree and tree do not match at " + index,
32 | changeTree.toTreeString().replaceAll("\\s+", " "),
33 | parsedTree.toTreeString().replaceAll("\\s+", " "));
34 |
35 | index++;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------