diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 9d2856b..13d317f 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -6,22 +6,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index aad31c1..e79da7e 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -2,11 +2,5 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_2.xml b/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_2.xml
deleted file mode 100644
index a8b0d9c..0000000
--- a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_7.xml b/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_7.xml
deleted file mode 100644
index cdd7959..0000000
--- a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_7.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml b/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml
deleted file mode 100644
index 6fec8f4..0000000
--- a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_2.xml b/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_2.xml
deleted file mode 100644
index 1c76d0b..0000000
--- a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_7.xml b/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_7.xml
deleted file mode 100644
index 6c2a760..0000000
--- a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_7.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml b/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml
deleted file mode 100644
index 9eb8596..0000000
--- a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_github_mpkorstanje_simmetrics_core_3_0_3.xml b/.idea/libraries/Maven__com_github_mpkorstanje_simmetrics_core_3_0_3.xml
deleted file mode 100644
index a009f87..0000000
--- a/.idea/libraries/Maven__com_github_mpkorstanje_simmetrics_core_3_0_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_code_findbugs_jsr305_1_3_9.xml b/.idea/libraries/Maven__com_google_code_findbugs_jsr305_1_3_9.xml
deleted file mode 100644
index 0e66824..0000000
--- a/.idea/libraries/Maven__com_google_code_findbugs_jsr305_1_3_9.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_3.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_3.xml
deleted file mode 100644
index 4dcaf15..0000000
--- a/.idea/libraries/Maven__com_google_code_gson_gson_2_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_guava_guava_11_0_2.xml b/.idea/libraries/Maven__com_google_guava_guava_11_0_2.xml
deleted file mode 100644
index 01a573a..0000000
--- a/.idea/libraries/Maven__com_google_guava_guava_11_0_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_guava_guava_18_0.xml b/.idea/libraries/Maven__com_google_guava_guava_18_0.xml
deleted file mode 100644
index bbd71d7..0000000
--- a/.idea/libraries/Maven__com_google_guava_guava_18_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_nanohttpd_nanohttpd_2_1_1.xml b/.idea/libraries/Maven__com_nanohttpd_nanohttpd_2_1_1.xml
deleted file mode 100644
index 7c43448..0000000
--- a/.idea/libraries/Maven__com_nanohttpd_nanohttpd_2_1_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_nanohttpd_nanohttpd_webserver_2_1_1.xml b/.idea/libraries/Maven__com_nanohttpd_nanohttpd_webserver_2_1_1.xml
deleted file mode 100644
index c265679..0000000
--- a/.idea/libraries/Maven__com_nanohttpd_nanohttpd_webserver_2_1_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_rabbitmq_amqp_client_4_0_0.xml b/.idea/libraries/Maven__com_rabbitmq_amqp_client_4_0_0.xml
deleted file mode 100644
index 0583b43..0000000
--- a/.idea/libraries/Maven__com_rabbitmq_amqp_client_4_0_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_sparkjava_spark_core_2_6_0.xml b/.idea/libraries/Maven__com_sparkjava_spark_core_2_6_0.xml
deleted file mode 100644
index a1b274c..0000000
--- a/.idea/libraries/Maven__com_sparkjava_spark_core_2_6_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_typesafe_akka_akka_actor_2_11_2_4_11.xml b/.idea/libraries/Maven__com_typesafe_akka_akka_actor_2_11_2_4_11.xml
deleted file mode 100644
index 09604f8..0000000
--- a/.idea/libraries/Maven__com_typesafe_akka_akka_actor_2_11_2_4_11.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_typesafe_config_1_3_0.xml b/.idea/libraries/Maven__com_typesafe_config_1_3_0.xml
deleted file mode 100644
index f92ac86..0000000
--- a/.idea/libraries/Maven__com_typesafe_config_1_3_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_codec_commons_codec_1_10.xml b/.idea/libraries/Maven__commons_codec_commons_codec_1_10.xml
deleted file mode 100644
index 27424a1..0000000
--- a/.idea/libraries/Maven__commons_codec_commons_codec_1_10.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml b/.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml
deleted file mode 100644
index a66d039..0000000
--- a/.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml b/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml
deleted file mode 100644
index 14681ee..0000000
--- a/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml b/.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml
deleted file mode 100644
index c24f7e3..0000000
--- a/.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_3_8_1.xml b/.idea/libraries/Maven__junit_junit_3_8_1.xml
deleted file mode 100644
index 71b2993..0000000
--- a/.idea/libraries/Maven__junit_junit_3_8_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_11.xml b/.idea/libraries/Maven__junit_junit_4_11.xml
deleted file mode 100644
index f33320d..0000000
--- a/.idea/libraries/Maven__junit_junit_4_11.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_12.xml b/.idea/libraries/Maven__junit_junit_4_12.xml
deleted file mode 100644
index d411041..0000000
--- a/.idea/libraries/Maven__junit_junit_4_12.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__log4j_log4j_1_2_14.xml b/.idea/libraries/Maven__log4j_log4j_1_2_14.xml
deleted file mode 100644
index 2825a67..0000000
--- a/.idea/libraries/Maven__log4j_log4j_1_2_14.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml b/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml
deleted file mode 100644
index 72d4d7e..0000000
--- a/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__net_sourceforge_jexcelapi_jxl_2_6_12.xml b/.idea/libraries/Maven__net_sourceforge_jexcelapi_jxl_2_6_12.xml
deleted file mode 100644
index 19e6af8..0000000
--- a/.idea/libraries/Maven__net_sourceforge_jexcelapi_jxl_2_6_12.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_1.xml b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_1.xml
deleted file mode 100644
index 32bfe3b..0000000
--- a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_7.xml b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_7.xml
deleted file mode 100644
index 28edf49..0000000
--- a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_7.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_pool2_2_4_2.xml b/.idea/libraries/Maven__org_apache_commons_commons_pool2_2_4_2.xml
deleted file mode 100644
index 2970b5e..0000000
--- a/.idea/libraries/Maven__org_apache_commons_commons_pool2_2_4_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_text_1_3.xml b/.idea/libraries/Maven__org_apache_commons_commons_text_1_3.xml
deleted file mode 100644
index 2930e62..0000000
--- a/.idea/libraries/Maven__org_apache_commons_commons_text_1_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_poi_poi_3_12.xml b/.idea/libraries/Maven__org_apache_poi_poi_3_12.xml
deleted file mode 100644
index f3bfa63..0000000
--- a/.idea/libraries/Maven__org_apache_poi_poi_3_12.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_poi_poi_ooxml_3_12.xml b/.idea/libraries/Maven__org_apache_poi_poi_ooxml_3_12.xml
deleted file mode 100644
index 0f92377..0000000
--- a/.idea/libraries/Maven__org_apache_poi_poi_ooxml_3_12.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_3_12.xml b/.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_3_12.xml
deleted file mode 100644
index fb871da..0000000
--- a/.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_3_12.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_2_6_0.xml b/.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_2_6_0.xml
deleted file mode 100644
index cb0f76d..0000000
--- a/.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_2_6_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_birt_runtime_org_eclipse_core_resources_3_10_0_v20150423_0755.xml b/.idea/libraries/Maven__org_eclipse_birt_runtime_org_eclipse_core_resources_3_10_0_v20150423_0755.xml
deleted file mode 100644
index bec40e7..0000000
--- a/.idea/libraries/Maven__org_eclipse_birt_runtime_org_eclipse_core_resources_3_10_0_v20150423_0755.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_core_contenttype_3_4_200_v20140207_1251.xml b/.idea/libraries/Maven__org_eclipse_core_contenttype_3_4_200_v20140207_1251.xml
deleted file mode 100644
index f23ea73..0000000
--- a/.idea/libraries/Maven__org_eclipse_core_contenttype_3_4_200_v20140207_1251.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_core_jobs_3_6_0_v20140424_0053.xml b/.idea/libraries/Maven__org_eclipse_core_jobs_3_6_0_v20140424_0053.xml
deleted file mode 100644
index ecd0a0f..0000000
--- a/.idea/libraries/Maven__org_eclipse_core_jobs_3_6_0_v20140424_0053.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_core_runtime_3_10_0_v20140318_2214.xml b/.idea/libraries/Maven__org_eclipse_core_runtime_3_10_0_v20140318_2214.xml
deleted file mode 100644
index b1c50eb..0000000
--- a/.idea/libraries/Maven__org_eclipse_core_runtime_3_10_0_v20140318_2214.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_equinox_app_1_3_200_v20130910_1609.xml b/.idea/libraries/Maven__org_eclipse_equinox_app_1_3_200_v20130910_1609.xml
deleted file mode 100644
index c5372f9..0000000
--- a/.idea/libraries/Maven__org_eclipse_equinox_app_1_3_200_v20130910_1609.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_equinox_common_3_6_200_v20130402_1505.xml b/.idea/libraries/Maven__org_eclipse_equinox_common_3_6_200_v20130402_1505.xml
deleted file mode 100644
index 0e8e398..0000000
--- a/.idea/libraries/Maven__org_eclipse_equinox_common_3_6_200_v20130402_1505.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_equinox_preferences_3_5_200_v20140224_1527.xml b/.idea/libraries/Maven__org_eclipse_equinox_preferences_3_5_200_v20140224_1527.xml
deleted file mode 100644
index cf2ff45..0000000
--- a/.idea/libraries/Maven__org_eclipse_equinox_preferences_3_5_200_v20140224_1527.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_equinox_registry_3_5_400_v20140428_1507.xml b/.idea/libraries/Maven__org_eclipse_equinox_registry_3_5_400_v20140428_1507.xml
deleted file mode 100644
index a35d91c..0000000
--- a/.idea/libraries/Maven__org_eclipse_equinox_registry_3_5_400_v20140428_1507.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_client_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_client_9_4_4_v20170414.xml
deleted file mode 100644
index 753cd46..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_client_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_http_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_http_9_4_4_v20170414.xml
deleted file mode 100644
index 24b9595..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_http_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_io_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_io_9_4_4_v20170414.xml
deleted file mode 100644
index be4af0a..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_io_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_security_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_security_9_4_4_v20170414.xml
deleted file mode 100644
index 0a0a61a..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_security_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_server_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_server_9_4_4_v20170414.xml
deleted file mode 100644
index aa28eb9..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_server_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_servlet_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_servlet_9_4_4_v20170414.xml
deleted file mode 100644
index 8923ab4..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_servlet_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_util_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_util_9_4_4_v20170414.xml
deleted file mode 100644
index b7d325c..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_util_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_webapp_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_webapp_9_4_4_v20170414.xml
deleted file mode 100644
index bd09afa..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_webapp_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_jetty_xml_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_jetty_xml_9_4_4_v20170414.xml
deleted file mode 100644
index 9f8b202..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_jetty_xml_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_api_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_api_9_4_4_v20170414.xml
deleted file mode 100644
index 597060a..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_api_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_client_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_client_9_4_4_v20170414.xml
deleted file mode 100644
index be2f9c9..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_client_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_common_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_common_9_4_4_v20170414.xml
deleted file mode 100644
index af4b520..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_common_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_server_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_server_9_4_4_v20170414.xml
deleted file mode 100644
index 26b182a..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_server_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_servlet_9_4_4_v20170414.xml b/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_servlet_9_4_4_v20170414.xml
deleted file mode 100644
index d11dc2b..0000000
--- a/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_servlet_9_4_4_v20170414.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_osgi_3_10_0_v20140606_1445.xml b/.idea/libraries/Maven__org_eclipse_osgi_3_10_0_v20140606_1445.xml
deleted file mode 100644
index 4f8664b..0000000
--- a/.idea/libraries/Maven__org_eclipse_osgi_3_10_0_v20140606_1445.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_eclipse_tycho_org_eclipse_jdt_core_3_12_2_v20161117_1814.xml b/.idea/libraries/Maven__org_eclipse_tycho_org_eclipse_jdt_core_3_12_2_v20161117_1814.xml
deleted file mode 100644
index 152bde1..0000000
--- a/.idea/libraries/Maven__org_eclipse_tycho_org_eclipse_jdt_core_3_12_2_v20161117_1814.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
deleted file mode 100644
index f58bbc1..0000000
--- a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_javassist_javassist_3_16_1_GA.xml b/.idea/libraries/Maven__org_javassist_javassist_3_16_1_GA.xml
deleted file mode 100644
index 7b4e548..0000000
--- a/.idea/libraries/Maven__org_javassist_javassist_3_16_1_GA.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_javatuples_javatuples_1_2.xml b/.idea/libraries/Maven__org_javatuples_javatuples_1_2.xml
deleted file mode 100644
index b524531..0000000
--- a/.idea/libraries/Maven__org_javatuples_javatuples_1_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_reflections_reflections_0_9_9_RC1.xml b/.idea/libraries/Maven__org_reflections_reflections_0_9_9_RC1.xml
deleted file mode 100644
index 95dd64a..0000000
--- a/.idea/libraries/Maven__org_reflections_reflections_0_9_9_RC1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_rendersnake_rendersnake_1_8.xml b/.idea/libraries/Maven__org_rendersnake_rendersnake_1_8.xml
deleted file mode 100644
index 7251aaa..0000000
--- a/.idea/libraries/Maven__org_rendersnake_rendersnake_1_8.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_scala_lang_modules_scala_java8_compat_2_11_0_7_0.xml b/.idea/libraries/Maven__org_scala_lang_modules_scala_java8_compat_2_11_0_7_0.xml
deleted file mode 100644
index f4b289b..0000000
--- a/.idea/libraries/Maven__org_scala_lang_modules_scala_java8_compat_2_11_0_7_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_scala_lang_scala_library_2_11_8.xml b/.idea/libraries/Maven__org_scala_lang_scala_library_2_11_8.xml
deleted file mode 100644
index fc8460c..0000000
--- a/.idea/libraries/Maven__org_scala_lang_scala_library_2_11_8.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_13.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_13.xml
deleted file mode 100644
index 4fd913d..0000000
--- a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_13.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_21.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_21.xml
deleted file mode 100644
index 1b644dd..0000000
--- a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_21.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml
deleted file mode 100644
index 20e8163..0000000
--- a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_7.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_7.xml
deleted file mode 100644
index 1e67260..0000000
--- a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_7.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__redis_clients_jedis_2_8_1.xml b/.idea/libraries/Maven__redis_clients_jedis_2_8_1.xml
deleted file mode 100644
index f12195b..0000000
--- a/.idea/libraries/Maven__redis_clients_jedis_2_8_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__stax_stax_api_1_0_1.xml b/.idea/libraries/Maven__stax_stax_api_1_0_1.xml
deleted file mode 100644
index 0b13335..0000000
--- a/.idea/libraries/Maven__stax_stax_api_1_0_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__xml_apis_xml_apis_1_0_b2.xml b/.idea/libraries/Maven__xml_apis_xml_apis_1_0_b2.xml
deleted file mode 100644
index c36e717..0000000
--- a/.idea/libraries/Maven__xml_apis_xml_apis_1_0_b2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index cc1f0b7..4b661a5 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,15 +1,14 @@
+
-
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 272b874..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index dc408e4..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,7 +2,5 @@
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f35f267..c15c296 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,161 +1,158 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -171,97 +168,32 @@
- redis
- stemmi
+ mk
+ ObjectInputStream
+ InputStre
+ resultMap
hget
- AstNode
- ConstructorInvocation
- ClassCreationIns
- AnonymousClassDeclaration
- ClassDe
- ASTNod
- TO
- ASTNode
- ASTN
- met
- Exec
- Executors.
- shared
- retrain
- leaf
- reverse
- TreeU
- [(60@@[(59@@[(42@@)])])]
- [(60@@[(59@@[
- [(60@@[(59@@[(
- regex
- Pattern.com
- valid_id
- checkout
- time
- async
- Compare-EnhancedDiff-System
-
- $PROJECT_DIR$/../gumtree
- $MAVEN_REPOSITORY$/org/apache/commons/commons-text/1.3/commons-text-1.3.jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
@@ -284,19 +216,12 @@
-
-
-
-
-
-
-
-
-
+
+
@@ -305,6 +230,8 @@
+
+
@@ -316,27 +243,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -350,25 +260,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
@@ -379,23 +275,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -406,45 +289,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -453,73 +305,44 @@
-
- 1550924800456
+
+ 1567410812558
- 1550924800456
+ 1567410812558
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -536,505 +359,271 @@
file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
- 25
+ 29
file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
- 83
+ 50
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/cluster/CalculatePairs.java
- 26
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
+ 62
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/cluster/CalculatePairs.java
- 33
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
- 77
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
+ 74
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
- 80
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java
+ 56
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
+ 61
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
+ 95
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
+ 56
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
+ 81
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/EDiffHelper.java
+ 276
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
+ 107
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/AkkaTreeParser.java
+ 44
file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java
- 31
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java
- 84
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java
- 82
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/StoreEDiffInCache.java
- 37
+ 51
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/StoreEDiffInCache.java
- 94
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
+ 98
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
+ 64
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
+ 28
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/StoreEDiffInCache.java
- 104
-
-
-
file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
- 72
+ 95
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/StoreEDiffInCache.java
- 85
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
- 84
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/ImportPairs2DB.java
- 72
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/AkkaTreeLoader.java
- 34
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/AkkaTreeLoader.java
- 54
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/Compare.java
- 33
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/AkkaTreeParser.java
- 23
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/AkkaTreeLoader.java
- 116
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/Compare.java
- 47
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
- 140
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster.java
- 78
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster.java
- 114
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster.java
- 131
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster.java
- 184
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 119
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 11
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 18
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 22
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 50
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 89
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 59
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 101
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
- 75
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffParser.java
- 42
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 259
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/EDiffHelper.java
- 426
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 177
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 230
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 316
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 353
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 337
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 214
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 309
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 331
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
- 347
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
- 80
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 87
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 27
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 36
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
- 76
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/utils/EDiffHelper.java
- 646
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 204
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 170
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 198
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 233
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 74
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/AkkaTreeParser.java
- 92
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
- 62
-
-
-
-
-
-
-
-
- load.getAnyRef("max-pool-size-max")
+ String[] split = prefix.split("-");
+String s = null;//inner.get(prefix.replace("-","/") +"/"+dist2load);
+// Set<String> keys = outer.keys(split[0] + "/"+split[1]+"/" + dist2load);
+String key = split[0] + "/"+split[1]+"/" + dist2load;
JAVA
CODE_FRAGMENT
- load.getConfig()
+ actionSetRead.toString().equals(actionSet.toString())
JAVA
CODE_FRAGMENT
- load.getConfig("SimpleConfigObject")
+ actionSetRead.toString()
JAVA
CODE_FRAGMENT
- keyName.split("-")
+ actionSetRead.equals(actionSet)
JAVA
CODE_FRAGMENT
- Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
-m.match();
-
-
-ActionGenerator ag = new ActionGenerator(oldTree, newTree, m.getMappings());
-ag.generate();
-List<Action> actions = ag.getActions();
+ HierarchicalActionSet actionSetRead = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
JAVA
CODE_FRAGMENT
- m.match()
+ EDiffHelper.kryoSerialize(actionSet)
JAVA
CODE_FRAGMENT
- Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
+ s = outer.hget("dump",key);
JAVA
CODE_FRAGMENT
- m.match();
+ filenames.get(prefix + "-" + fn)
JAVA
CODE_FRAGMENT
- String.join(" ",res);
+ filenames[prefix + "-" + fn]
JAVA
CODE_FRAGMENT
-
-
- 1
- JAVA
- EXPRESSION
-
-
- "JDT"
- JAVA
- EXPRESSION
-
-
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1042,95 +631,90 @@ List<Action> actions = ag.getActions();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
-
+
+
@@ -1139,350 +723,166 @@ List<Action> actions = ag.getActions();
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No facets are configured
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
- client
-
-
-
-
-
-
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
- Maven: ch.qos.logback:logback-classic:1.1.2
+ 1.7
diff --git a/FixPatternMiner.iml b/FixPatternMiner.iml
deleted file mode 100644
index ccef92c..0000000
--- a/FixPatternMiner.iml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6f93ad0..5eb9b1c 100755
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
edu.lu.uni.serval
FixPatternMiner
- 0.0.1-SNAPSHOT
+ 1.0.0
jar
FixPatternMiner
@@ -25,11 +25,11 @@
1.2
-
- edu.lu.uni
- simple-utils
- 0.0.1-SNAPSHOT
-
+
+
+
+
+
@@ -150,6 +150,12 @@
compile
+
+ com.esotericsoftware
+ kryo
+ 4.0.2
+
+
@@ -178,7 +184,8 @@
- edu.lu.uni.serval.fixminer.akka.compare.CompareTrees
+
+ edu.lu.uni.serval.fixminer.Launcher
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java b/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
index 74579aa..80ccf6e 100755
--- a/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
+++ b/src/main/java/edu/lu/uni/serval/fixminer/Launcher.java
@@ -1,7 +1,8 @@
package edu.lu.uni.serval.fixminer;
-import edu.lu.uni.serval.fixminer.jobs.*;
-import edu.lu.uni.serval.utils.CallShell;
+import edu.lu.uni.serval.fixminer.akka.compare.CompareTrees;
+import edu.lu.uni.serval.fixminer.jobs.EnhancedASTDiff;
+import edu.lu.uni.serval.utils.ClusterToPattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -21,95 +22,89 @@ public class Launcher {
Properties appProps = new Properties();
-// String appConfigPath = "/Users/kui.liu/Downloads/app.properties";//args[0];
// String appConfigPath = "/Users/anilkoyuncu/bugStudy/release/code/app.properties";
String appConfigPath = args[0];
appProps.load(new FileInputStream(appConfigPath));
String portInner = appProps.getProperty("portInner","6380");
String numOfWorkers = appProps.getProperty("numOfWorkers", "10");
- String jobType = appProps.getProperty("jobType","ALL");
String portDumps = appProps.getProperty("portDumps","6399");
- String pythonPath = appProps.getProperty("pythonPath","/Users/anilkoyuncu/bugStudy/code/python");
- String datasetPath = appProps.getProperty("datasetPath","/Users/anilkoyuncu/bugStudy/dataset");
String pjName = appProps.getProperty("pjName","allDataset");
String actionType = appProps.getProperty("actionType","ALL");
- String threshold = appProps.getProperty("threshold","1");
- String cursor = appProps.getProperty("cursor","10000000");
- String chunk = appProps.getProperty("chunk","1.txt");
String eDiffTimeout = appProps.getProperty("eDiffTimeout","900");
- String isBig = appProps.getProperty("isBigPair","true");
String parallelism = appProps.getProperty("parallelism","FORKJOIN");
- boolean isBigPair = Boolean.parseBoolean(isBig);
+ String input = appProps.getProperty("inputPath","FORKJOIN");
+ String redisPath = appProps.getProperty("redisPath","FORKJOIN");
- String parameters = String.format("\nportInner %s " +
- "\nnumOfWorkers %s " +
- "\njobType %s \nport %s " +
- "\npythonPath %s \ndatasetPath %s" +
- "\npjName %s \nactionType %s \nthreshold %s \ncursor %s \neDiffTimeout %s \nisBigPair %s \nparallelism %s"
- , portInner, numOfWorkers, jobType, portDumps, pythonPath,datasetPath,pjName,actionType,threshold,cursor,eDiffTimeout,isBig,parallelism);
+ String parameter = args[2];
+ String jobType = args[1];
- log.info(parameters);
+// String parameters = String.format("\nportInner %s " +
+// "\nnumOfWorkers %s " +
+// "\njobType %s \nport %s " +
+// "\npythonPath %s \ndatasetPath %s" +
+// "\npjName %s \nactionType %s \nthreshold %s \ncursor %s \neDiffTimeout %s \nisBigPair %s \nparallelism %s"
+// , portInner, numOfWorkers, jobType, portDumps, pythonPath,datasetPath,pjName,actionType,threshold,cursor,eDiffTimeout,isBig,parallelism);
+//
+// log.info(parameters);
- mainLaunch(portInner, numOfWorkers, jobType, portDumps, pythonPath,datasetPath,pjName,actionType,threshold,cursor,chunk,eDiffTimeout,isBigPair,parallelism);
+ mainLaunch(portInner, numOfWorkers, jobType, portDumps, pjName,actionType,eDiffTimeout,parallelism,input,redisPath,parameter);
}
- public static void mainLaunch(String portInner, String numOfWorkers, String jobType, String portDumps, String pythonPath, String datasetPath, String pjName, String actionType, String threshold, String cursor, String chunk, String eDiffTimeout, boolean isBigPair, String parallelism){
+ public static void mainLaunch(String portInner, String numOfWorkers, String jobType, String portDumps, String pjName, String actionType, String eDiffTimeout, String parallelism,String input, String redisPath,String parameter){
String dbDir;
- String pairsPath;
String dumpsName;
String gumInput;
- String gumOutput;
- gumInput = datasetPath +"/"+pjName+"/";
- gumOutput = datasetPath + "/EnhancedASTDiff" + pjName;
- dbDir = datasetPath + "/redis";
- pairsPath = datasetPath + "/pairs";
dumpsName = "dumps-"+pjName+".rdb";
- int iCursor = Integer.valueOf(cursor);
-// jobType = "CACHE";
+
+ gumInput = input;
+ dbDir = redisPath;
+
try {
switch (jobType) {
- case "ENHANCEDASTDIFF":
- EnhancedASTDiff.main(gumInput, gumOutput, numOfWorkers, pjName, eDiffTimeout,actionType,parallelism,portDumps, dbDir, actionType+dumpsName);
- break;
- case "CACHE":
- StoreEDiffInCache.main(gumOutput, portDumps, dbDir, actionType+dumpsName);
- break;
- case "SI":
-// CalculatePairs.main(dbDir, actionType+dumpsName, portDumps, pairsPath+actionType, pjName+actionType,isBigPair,iCursor);
- ImportPairs2DB.main(pairsPath, portInner, dbDir,datasetPath,chunk);
- break;
- case "SIMI":
- AkkaTreeLoader.main(portInner, dbDir, "pairs.rdb" , portDumps, actionType+dumpsName,pairsPath,numOfWorkers,iCursor,chunk,eDiffTimeout,parallelism);
+ case "RICHEDITSCRIPT":
+ EnhancedASTDiff.main(gumInput, numOfWorkers, pjName, eDiffTimeout,parallelism,portDumps, dbDir, actionType+dumpsName);
break;
- case "LEVEL1":
- String indexFile = pairsPath+actionType + "/" +pjName+actionType+".index";
- level1(portInner, portDumps, pythonPath, datasetPath, pjName, actionType, threshold, dbDir, gumInput,iCursor,indexFile);
+ case "COMPARE":
+ String job;
+ String compareDBName;
+ switch (parameter){
+ case "L1":
+ job = "shape";
+ compareDBName = "clusterl0-gumInputALL.rdb";
+ break;
+ case "L2":
+ job = "action";
+ compareDBName = "clusterl1-gumInputALL.rdb";
+ break;
+ case "L3":
+ job = "token";
+ compareDBName = "clusterl2-gumInputALL.rdb";
+ break;
+ default:
+ throw new Error("unknown level please specify L1,L2,L3");
+ }
+
+
+ CompareTrees.main(redisPath, portInner,portDumps,actionType+dumpsName,compareDBName, job);
break;
- //CALC python abstractPatch.py to from cluster folder
- case "LEVEL2":
- level2(portDumps, pythonPath, datasetPath, pjName, actionType, threshold, dbDir, dumpsName, gumInput,iCursor);
- break;
- //CALC via python
- case "LEVEL3":
- level3(portDumps, pythonPath, datasetPath, pjName, actionType, threshold, dbDir, dumpsName, gumInput,iCursor);
- break;
- case "EXTRACTPATTERN":
- PatternExtractor.mainLaunch(portInner,numOfWorkers,jobType,portDumps,pythonPath,datasetPath,pjName,actionType,threshold);
- break;
- case "GETPATTERN":
- PatternExtractor.mainLaunch(portInner,numOfWorkers,jobType,portDumps,pythonPath,datasetPath,pjName,actionType,threshold);
+ case "PATTERN":
+ ClusterToPattern.main(portDumps,redisPath, actionType+dumpsName, parameter);
break;
+ default:
+ throw new Error("unknown Job");
+
}
} catch (Exception e) {
e.printStackTrace();
+
}
@@ -117,63 +112,6 @@ public class Launcher {
}
- private static void level1(String portInner, String port, String pythonPath, String datasetPath, String pjName, String actionType, String threshold, String dbDir, String gumInput,int cursor,String indexFile) throws Exception {
-
-
- TreeLoaderClusterL1.main(portInner, port, dbDir, "level1-"+pjName+ actionType+".rdb", dbDir ,pjName + actionType,cursor);
-
- CallShell cs1 =new CallShell();
- String db1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- String db11 = String.format(db1, dbDir,"level1-"+pjName+ actionType+".rdb" ,Integer.valueOf(port));
- cs1.runShell(db11, port);
- String runpy = "bash "+datasetPath + "/" + "launchPy.sh" +" %s %s %s %s %s %s %s";
- String formatRunPy = String.format(runpy,pythonPath +"/abstractPatch.py", gumInput, datasetPath + "/cluster"+pjName+ actionType, port, "matches" + pjName + actionType, threshold,indexFile);
-
- cs1.runShell(formatRunPy);
- String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
- stopServer = String.format(stopServer,Integer.valueOf(port));
- cs1.runShell(stopServer, port);
- }
-
- private static void level2(String port, String pythonPath, String datasetPath, String pjName, String actionType, String threshold, String dbDir, String dumpsName, String gumInput,int cursor) throws Exception {
- String stopServer;
-// MultiThreadTreeLoaderCluster.calculatePairsOfClusters(datasetPath + "/cluster"+pjName+ actionType, datasetPath,actionType);
-
- MultiThreadTreeLoaderCluster.mainCompare(port, datasetPath+"/pairsAction", datasetPath + "/redisSingleImport.sh", dbDir, "clusterl1-"+pjName+actionType+".rdb", actionType+dumpsName, "6380",actionType,cursor);
-
- CallShell cs3 =new CallShell();
- String db22 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- String db1b = String.format(db22, dbDir,"clusterl1-"+pjName+actionType+".rdb",Integer.valueOf(port));
- cs3.runShell(db1b, port);
- String runpy2 = "bash "+datasetPath + "/" + "launchPy.sh" +" %s %s %s %s %s %s %s";
- String formatRunPy1a = String.format(runpy2,pythonPath +"/abstractPatchCluster.py", gumInput, datasetPath + "/cluster"+pjName+ actionType, port, datasetPath + "/cluster-2l"+pjName+ actionType,threshold,"dummy");
-
- cs3.runShell(formatRunPy1a);
- String stopServer1a = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
- stopServer = String.format(stopServer1a,Integer.valueOf(port));
- cs3.runShell(stopServer, port);
- }
-
- private static void level3(String port, String pythonPath, String datasetPath, String pjName, String actionType, String threshold, String dbDir, String dumpsName, String gumInput,int cursor) throws Exception {
- String stopServer;
- MultiThreadTreeLoaderCluster3.calculatePairsOfClusters(datasetPath + "/cluster-2l"+pjName+ actionType, datasetPath,actionType);
-
- MultiThreadTreeLoaderCluster3.mainCompare("6300", datasetPath+"/pairs-2l"+actionType, datasetPath + "/redisSingleImport.sh", dbDir, "clusterl2-"+pjName+actionType+".rdb", actionType+dumpsName, "6301",actionType,cursor);
-
- CallShell cs5 =new CallShell();
- String dba = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- String dbaa = String.format(dba, dbDir,"clusterl2-"+pjName+actionType+".rdb",Integer.valueOf(port));
- cs5.runShell(dbaa, port);
- String runpya = "bash "+datasetPath + "/" + "launchPy.sh" +" %s %s %s %s %s %s %s";
- String formatRunPya = String.format(runpya,pythonPath +"/abstractPatchClusterLevel3.py", gumInput, datasetPath + "/cluster-3l"+pjName+ actionType, port, datasetPath + "/cluster-2l"+pjName+ actionType,threshold,"dummy");
-
- cs5.runShell(formatRunPya);
- String stopServera = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
- stopServer = String.format(stopServera,Integer.valueOf(port));
- cs5.runShell(stopServer, port);
- return;
- }
-
}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/TestTreeLoader.java b/src/main/java/edu/lu/uni/serval/fixminer/TestTreeLoader.java
deleted file mode 100755
index 5d519be..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/TestTreeLoader.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package edu.lu.uni.serval.fixminer;
-
-import com.github.gumtreediff.actions.ActionGenerator;
-import com.github.gumtreediff.actions.model.Action;
-import com.github.gumtreediff.matchers.Matcher;
-import com.github.gumtreediff.matchers.Matchers;
-import com.github.gumtreediff.tree.ITree;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Created by anilkoyuncu on 17/03/2018.
- */
-public class TestTreeLoader {
- public static void main(String[] args) {
-
-
-// String inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutput/ENTESB/ASTDumps";
-// String inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutput2/";
- String inputPath ="/Users/anil.koyuncu/projects/fixminer-all/enhancedASTDiff/python/data/EnhancedASTDiffgumInput-old/AssertStatement";
- File folder = new File(inputPath);
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List pjs = stream
- .filter(x -> !x.getName().startsWith("."))
- .collect(Collectors.toList());
-
- List fileToCompare = new ArrayList<>();
- for(File pj:pjs){
- File[] files = pj.listFiles(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return name.startsWith("ASTDumps");
- }
- });
- Collections.addAll(fileToCompare, files[0].listFiles());
-
- }
- System.out.println("a");
-// compareAll(fileToCompare);
- memoryFriendlyCompare(fileToCompare);
-
-
- }
-
-
- public static ITree getSimpliedTree(String fn) {
- ITree tree = null;
- try {
- FileInputStream fi = new FileInputStream(new File(fn));
- ObjectInputStream oi = new ObjectInputStream(fi);
- tree = (ITree) oi.readObject();
- oi.close();
- fi.close();
-
-
- } catch (FileNotFoundException e) {
- System.out.println("File not found");
- } catch (IOException e) {
- System.out.println("Error initializing stream");
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- tree.setLabel("");
- tree.setParent(null);
- List descendants = tree.getDescendants();
- for (ITree descendant : descendants) {
- descendant.setLabel("");
- }
-
- return tree;
-
- }
- public static void memoryFriendlyCompare(List folders){
- List treesFileNames = new ArrayList<>();
-// HashMap hmap = new HashMap();
-
- for (File target : folders) {
-// hmap.put(folders.indexOf(target), target.toString());
- treesFileNames.add(target.toString());
- }
-
- for (int i = 0; i < treesFileNames.size(); i++) {
- for (int j = i + 1; j < treesFileNames.size(); j++) {
- // compare list.get(i) and list.get(j)
- try {
- BufferedWriter writer = new BufferedWriter(new FileWriter("output2.txt", true));
- ITree oldTree = getSimpliedTree(treesFileNames.get(i));
-
- ITree newTree = getSimpliedTree(treesFileNames.get(j));
-
- Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
- m.match();
-
- ActionGenerator ag = new ActionGenerator(oldTree, newTree, m.getMappings());
- ag.generate();
- List actions = ag.getActions();
- writer.write(String.valueOf(i));
- writer.write("\t");
- writer.write(String.valueOf(j));
- writer.write("\t");
-
- writer.write(String.format("%1.2f", m.chawatheSimilarity(oldTree, newTree)));
- writer.write("\t");
- writer.write(String.format("%1.2f", m.diceSimilarity(oldTree, newTree)));
- writer.write("\t");
- writer.write(String.format("%1.2f", m.jaccardSimilarity(oldTree, newTree)));
- writer.write("\t");
- writer.write(String.valueOf(actions.size()));
- writer.write("\t");
- writer.write(treesFileNames.get(i));
- writer.write("\t");
- writer.write(treesFileNames.get(j));
- writer.write("\n");
-
- writer.close();
- } catch (FileNotFoundException e) {
- System.out.println("File not found");
- } catch (IOException e) {
- System.out.println("Error initializing stream");
-
- }
- }
- }
-
-
-
-
- }
-// public static void compareAll(List folders){
-// List trees = new ArrayList<>();
-// HashMap hmap = new HashMap();
-// for (File target : folders) {
-//
-// try {
-// FileInputStream fi = new FileInputStream(new File(target.toString()));
-// ObjectInputStream oi = new ObjectInputStream(fi);
-// ITree pr1 = (ITree) oi.readObject();
-// oi.close();
-// fi.close();
-// trees.add(pr1);
-// hmap.put(folders.indexOf(target), target.toString());
-//
-// } catch (FileNotFoundException e) {
-// System.out.println("File not found");
-// } catch (IOException e) {
-// System.out.println("Error initializing stream");
-// } catch (ClassNotFoundException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
-//
-// for (ITree tree : trees) {
-//// SimplifyTree simplifyTree = new SimplifyTree();
-//// simplifyTree.canonicalizeSourceCodeTree(tree);
-// tree.setLabel("");
-// tree.setParent(null);
-// List descendants = tree.getDescendants();
-// for (ITree descendant : descendants) {
-// descendant.setLabel("");
-// }
-//
-// }
-// System.out.println("a");
-//
-// try {
-//
-//
-//
-// for (int i = 0; i < trees.size(); i++) {
-// for (int j = i + 1; j < trees.size(); j++) {
-// // compare list.get(i) and list.get(j)
-// BufferedWriter writer = new BufferedWriter(new FileWriter("output.txt",true));
-// ITree oldTree = trees.get(i);
-//
-// ITree newTree = trees.get(j);
-//
-// Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
-// m.match();
-//
-// ActionGenerator ag = new ActionGenerator(oldTree, newTree, m.getMappings());
-// ag.generate();
-// List actions = ag.getActions();
-// writer.write(String.valueOf(i));
-// writer.write("\t");
-// writer.write(String.valueOf(j));
-// writer.write("\t");
-//
-// writer.write(String.format("%1.2f", m.chawatheSimilarity(oldTree, newTree)));
-// writer.write("\t");
-// writer.write(String.format("%1.2f", m.diceSimilarity(oldTree, newTree)));
-// writer.write("\t");
-// writer.write(String.format("%1.2f", m.jaccardSimilarity(oldTree, newTree)));
-// writer.write("\t");
-// writer.write(String.valueOf(actions.size()));
-// writer.write("\t");
-// writer.write(hmap.get(i));
-// writer.write("\t");
-// writer.write(hmap.get(j));
-// writer.write("\n");
-//
-// writer.close();
-// }
-// }
-//
-//
-// } catch (FileNotFoundException e) {
-// System.out.println("File not found");
-// } catch (IOException e) {
-// System.out.println("Error initializing stream");
-//
-// }
-//
-//
-//// if (actions.size() > 1) {
-//// Matcher m1 = Matchers.getInstance().getMatcher(actions.get(0).getNode(), actions.get(0).getNode());
-//// m1.match();
-//// Set mappingSet1 = m1.getMappingSet();
-////
-//// }
-// }
-
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/DocumentSimilarity.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/DocumentSimilarity.java
deleted file mode 100755
index 4b813f1..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/DocumentSimilarity.java
+++ /dev/null
@@ -1,601 +0,0 @@
-package edu.lu.uni.serval.fixminer.akka;
-
-//Import the Java utility classes
-
-import java.io.BufferedReader;
-
-import java.io.FileReader;
-
-import java.io.PrintWriter;
-
-import java.util.ArrayList;
-
-import java.util.HashMap;
-
-import java.util.HashSet;
-
-import java.util.Map;
-
-import java.util.Set;
-
-//Import the Apache Commons Maths library classes to handle the term-vectors from Apache Lucene
-
-import org.apache.commons.math3.linear.ArrayRealVector;
-
-import org.apache.commons.math3.linear.RealVector;
-
-//Import the Apache Lucene classes
-
-import org.apache.lucene.analysis.Analyzer;
-
-import org.apache.lucene.analysis.core.SimpleAnalyzer;
-
-import org.apache.lucene.document.Document;
-
-import org.apache.lucene.document.Field;
-
-import org.apache.lucene.document.FieldType;
-
-import org.apache.lucene.index.AtomicReader;
-
-import org.apache.lucene.index.DirectoryReader;
-
-import org.apache.lucene.index.DocsEnum;
-
-import org.apache.lucene.index.IndexReader;
-
-import org.apache.lucene.index.IndexWriter;
-
-import org.apache.lucene.index.IndexWriterConfig;
-
-import org.apache.lucene.index.MultiFields;
-
-import org.apache.lucene.index.Term;
-
-import org.apache.lucene.index.Terms;
-
-import org.apache.lucene.index.TermsEnum;
-
-import org.apache.lucene.search.similarities.DefaultSimilarity;
-
-import org.apache.lucene.search.similarities.TFIDFSimilarity;
-
-import org.apache.lucene.store.Directory;
-
-import org.apache.lucene.store.RAMDirectory;
-
-import org.apache.lucene.util.Bits;
-
-import org.apache.lucene.util.BytesRef;
-
-import org.apache.lucene.util.Version;
-
-
-
-import com.thoughtworks.xstream.core.util.Fields;
-
-
-
-//A class to find the similarity of all text documents referenced in a text file
-
-public class DocumentSimilarity {
-
- private static final String CONTENT = "Content"; /*the name of the field stored by Apache Lucene which includes the text from the
-
-text documents.*/
-
- private Set terms = new HashSet<>(); //changed state with new terms after each call to getTermFrequencies() method
-
-
-
- private ArrayList directoryIndex; //The Apache Lucene index for documents to mine for similarities
-
- /* Indexed, tokenized, stored. */
-
- public final FieldType TYPE_STORED = new FieldType(); //This is the field profiled by Apache Lucene to collect its term frequencies
-
- private HashMap termsCount; //stores the counts of all terms found in the corpus
-
- private ArrayList scannedDocs; //stores the IDs of docs already scanned and stored in termsCount
-
-
-
-
-
- DocumentSimilarity(String lookupFile) {
-
- //Initialise the field to profile in each document
-
- TYPE_STORED.setIndexed(true);
-
- TYPE_STORED.setTokenized(true);
-
- TYPE_STORED.setStored(true);
-
- TYPE_STORED.setStoreTermVectors(true);
-
- TYPE_STORED.setStoreTermVectorPositions(true);
-
- TYPE_STORED.freeze();
-
-
-
- termsCount = new HashMap();
-
- scannedDocs = new ArrayList();
-
-
-
- try {
-
- //initialise an in-memory (RAM-based) index of the documents in the input folder using Apache Lucene
-
- Directory directory = createIndex(lookupFile);
-
- IndexReader reader = DirectoryReader.open(directory);
-
-
-
- String outputFile = "C:/Users/default/test/docs_similarity.csv"; /* the output file where the document similarities will be stored */
-
- PrintWriter writer;
-
- writer = new PrintWriter(outputFile, "UTF-8");
-
- writer.println("doc1,doc2,similarity");
-
-
-
-
-
- //loop on the documents in the folder and compare them together
-
- for (int i=0; i f1 = getTermFrequencies(reader, i); //get the term frequencies profile of the first document
-
- RealVector v1 = toRealVector(f1); //convert term frequencies profile to a vector
-
- Map f2 = getTermFrequencies2(reader, j); //get the term frequencies profile of the second document
-
- RealVector v2 = toRealVector(f2); //convert term frequencies profile to a vector
-
- double sim = getCosineSimilarity(v1, v2); //compute the cosine similarity of the documents pair using their terms frequencies profiles
-
- writer.println(directoryIndex.get(i)+","+directoryIndex.get(j)+","+sim); //write the similarity to an output CSV file
-
- }
-
- terms = new HashSet<>();
-
- }
-
- reader.close();
-
- writer.close();
-
- } catch (Exception e) {
-
- e.printStackTrace();
-
- }
-
-
-
- writeTermsCount();
-
- }
-
-
-
-
-
- //A method to initialise an in-memory (RAM-based) index of the documents in the input file using Apache Lucene
-
- Directory createIndex(String lookupFile) {
-
- try {
-
- Directory directory = new RAMDirectory();
-
-
-
- /* Initialize the analyzer which profiles the text inside the documents. This analyser does all the pre-processing of the
-
- * text including stop-word removal, tokenization, etc. depending on the type of analyzer used.
-
- * Check the reference website for different types of analyzers: https://www.tutorialspoint.com/lucene/lucene_analysis.htm
-
- */
-
- Analyzer analyzer = new SimpleAnalyzer(Version.LUCENE_CURRENT); //create a new SimpleAnalyzer
-
- IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_CURRENT,
-
- analyzer);
-
- IndexWriter writer = new IndexWriter(directory, iwc); //write the index of the documents with their analysis in-memory
-
-
-
- int did=1; //documents are numbered by a document ID as 1,2,3...n in a lookup file of the documents to be indexed
-
- BufferedReader dsLookup;
-
- dsLookup = new BufferedReader(new FileReader(lookupFile));
-
- String ds; //The document number in each line
-
-
-
- ArrayList directoryIndex = new ArrayList();
-
-
-
- while ((ds = dsLookup.readLine()) != null) {
-
- //Set the document id to the string read from the line in lookup file
-
- try {
-
-
-
- String documentText = ""; //stores the text from the document
-
-
-
- FileReader fr = new FileReader(did+".txt");
-
- BufferedReader br = new BufferedReader(fr);
-
- String sCurrentLine;
-
- while ((sCurrentLine = br.readLine()) != null) {
-
- documentText += (sCurrentLine);
-
- }
-
-
-
- //add the document to the index
-
- addDocument(writer, documentText);
-
- directoryIndex.add(did);
-
- } catch (Exception e) {
-
- System.out.println("!!! Document "+did+" has an error and was skipped !!!");
-
- continue;
-
- }
-
- }
-
- writer.close();
-
- this.directoryIndex = directoryIndex;
-
- return directory;
-
- } catch (Exception e) {
-
- e.printStackTrace();
-
- }
-
- return null;
-
- }
-
-
-
-
-
- //a method to add a document to the index by writing its text as a "content" field in Apache Lucene
-
- void addDocument(IndexWriter writer, String content) {
-
- try {
-
- Document doc = new Document(); //create a new Apache Lucene document
-
- Field field = new Field(CONTENT, content, TYPE_STORED); //Add the field with the text content to the index
-
- doc.add(field);
-
- writer.addDocument(doc);
-
- } catch (Exception e) {
-
- e.printStackTrace();
-
- }
-
-
-
- }
-
-
-
-
- //a method to get the cosine similarity between two term-frequency vectors from a pair of documents
-
- public double getCosineSimilarity(RealVector v1, RealVector v2) {
-
- return (v1.dotProduct(v2)) / (v1.getNorm() * v2.getNorm());
-
- }
-
-
-
-
-
- //a method to get the term frequencies from a document
-
- Map getTermFrequencies(IndexReader reader, int docId) {
-
- try {
-
- Terms vector = reader.getTermVector(docId, CONTENT);
-
- TermsEnum termsEnum = null;
-
- termsEnum = vector.iterator(termsEnum);
-
- Map frequencies = new HashMap<>();
-
- BytesRef text = null;
-
- TFIDFSimilarity tfidfSim = new DefaultSimilarity();
-
- boolean scannedDoc = scannedDocs.contains(docId);
-
-
-
- while ((text = termsEnum.next()) != null) {
-
- String term = text.utf8ToString();
-
- org.apache.lucene.index.Fields fields = reader.getTermVectors(0);
-
- Term termInstance = new Term("Content", term);
-
- long indexDf = reader.docFreq(termInstance);
-
- int docCount = reader.numDocs();
-
-
-
- //increment the term count in the terms count lookup if doc not scanned before
-
- if(!scannedDoc) {
-
- if(termsCount.containsKey(termInstance.toString())) {
-
- Integer cnt = termsCount.get(termInstance.toString());
-
- cnt++;
-
- termsCount.replace(termInstance.toString(), cnt);
-
- } else {
-
- termsCount.put(termInstance.toString(), 1);
-
- }
-
- }
-
-
-
-
-
- DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(reader),null,0);
-
-
-
- //calculate the TF-IDF of the term, as compared to all documents in the corpus (the Apache Lucene Index)
-
- double tfidf = 0.0;
-
- while(docs.nextDoc() != DocsEnum.NO_MORE_DOCS) {
-
- tfidf = tfidfSim.tf(docs.freq()) * tfidfSim.idf(docCount, indexDf);
-
- }
-
-
-
-
-
- frequencies.put(term, tfidf);
-
- scannedDocs.add(docId);
-
- terms.add(term);
-
- }
-
- return frequencies;
-
- } catch (Exception e) {
-
- e.printStackTrace();
-
- }
-
- return null;
-
- }
-
-
-
- Map getTermFrequencies2(IndexReader reader, int docId) {
-
- try {
-
- Terms vector = reader.getTermVector(docId, CONTENT);
-
- TermsEnum termsEnum = null;
-
- termsEnum = vector.iterator(termsEnum);
-
- Map frequencies = new HashMap<>();
-
- BytesRef text = null;
-
- TFIDFSimilarity tfidfSim = new DefaultSimilarity();
-
- boolean scannedDoc = scannedDocs.contains(docId);
-
- int docCount = reader.numDocs();
-
-
-
- while ((text = termsEnum.next()) != null) {
-
- String term = text.utf8ToString();
-
- Term termInstance = new Term("Content", term);
-
- long indexDf = reader.docFreq(termInstance);
-
-
-
-
-
- //increment the term count in the terms count lookup if doc not scanned before
-
- if(!scannedDoc) {
-
- if(termsCount.containsKey(termInstance.toString())) {
-
- Integer cnt = termsCount.get(termInstance.toString());
-
- cnt++;
-
- termsCount.replace(termInstance.toString(), cnt);
-
- } else {
-
- termsCount.put(termInstance.toString(), 1);
-
- }
-
- }
-
-
-
- DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(reader),null,0);
-
- double tfidf = 0.0;
-
- while(docs.nextDoc() != DocsEnum.NO_MORE_DOCS) {
-
- tfidf = tfidfSim.tf(docs.freq()) * tfidfSim.idf(docCount, indexDf);
-
- }
-
-
-
-
-
- frequencies.put(term, tfidf);
-
- scannedDocs.add(docId);
-
-
-
- }
-
- return frequencies;
-
- } catch (Exception e) {
-
- e.printStackTrace();
-
- }
-
- return null;
-
- }
-
-
-
-
-
- //convert the term-frequencies extracted to a real vector
-
- RealVector toRealVector(Map map) {
-
- RealVector vector = new ArrayRealVector(terms.size());
-
- int i = 0;
-
- for (String term : terms) {
-
- double value = map.containsKey(term) ? map.get(term) : 0.0;
-
- vector.setEntry(i++, value);
-
- }
-
- return (RealVector) vector.mapDivide(vector.getL1Norm());
-
- }
-
-
-
-
- //Write the terms-frequencies from the documents to a CSV file
-
- private void writeTermsCount() {
-
- try {
-
- String outputFile = "C:/Users/default/test/document_terms_count.csv";
-
- PrintWriter writer;
-
- writer = new PrintWriter(outputFile, "UTF-8");
-
- writer.println("term,count");
-
-
-
- for (String key : termsCount.keySet()) {
-
- writer.println(key+","+termsCount.get(key));
-
- }
-
-
-
- writer.close();
-
-
-
- } catch (Exception e) {
-
- e.printStackTrace();
-
- }
-
- }
-
-
-
- //MAIN class to execute with the .txt-file lookup of the documents to index
-
- public static void main(String[] args) {
-
- new DocumentSimilarity("documents_lookup.txt");
-
- }
-
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/AkkaTreeParser.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/AkkaTreeParser.java
index 1d767fb..d00ffbb 100755
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/AkkaTreeParser.java
+++ b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/AkkaTreeParser.java
@@ -1,7 +1,5 @@
package edu.lu.uni.serval.fixminer.akka.compare;
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
@@ -9,7 +7,10 @@ import redis.clients.jedis.JedisPool;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
/**
* Created by anilkoyuncu on 12/09/2018.
@@ -18,69 +19,6 @@ public class AkkaTreeParser {
private static Logger log = LoggerFactory.getLogger(AkkaTreeParser.class);
-
- public static void akkaCompare(JedisPool innerPool, JedisPool outerPool, String numOfWorkers, int cursor, String eDiffTimeout, String parallelism){
-
- final List listOfPairs = getMessages(innerPool,cursor); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
-
-
- switch (parallelism){
- case "AKKA":
-// ActorSystem system = null;
-// ActorRef parsingActor = null;
-// final TreeMessage msg = new TreeMessage(0,listOfPairs, innerPool,outerPool,eDiffTimeout);
-// try {
-// log.info("Akka begins...");
-// system = ActorSystem.create("Compare-EnhancedDiff-System");
-//
-// parsingActor = system.actorOf(TreeActor.props(Integer.valueOf(numOfWorkers)), "mine-fix-pattern-actor");
-// parsingActor.tell(msg, ActorRef.noSender());
-// } catch (Exception e) {
-// system.shutdown();
-// e.printStackTrace();
-// }
- break;
- case "FORKJOIN":
- int counter = new Object() {
- int counter = 0;
-
- {
- listOfPairs.stream().
- parallel().
- peek(x -> counter++).
- forEach(m ->
- {
- Compare compare = new Compare();
- compare.coreCompare(m, innerPool, outerPool);
- if (counter % 10 == 0) {
- log.info("Finalized parsing " + counter + " files... remaing " + (listOfPairs.size() - counter));
- }
- }
- );
- }
- }.counter;
- log.info("Finished parsing {} files",counter);
- break;
- default:
- log.error("Unknown parallelism {}", parallelism);
- break;
- }
-
-
-
-
-
- }
- public static List getRMessages(JedisPool innerPool, int cursor){
- try (Jedis inner = innerPool.getResource()) {
- while (!inner.ping().equals("PONG")){
- log.info("wait");
- }
- List pairs = inner.srandmember("pairs", cursor);
- return pairs;
- }
- }
-
public static List getMessages(JedisPool innerPool, int cursor){
@@ -102,36 +40,40 @@ public class AkkaTreeParser {
int size = scan.getResult().size();
log.info("Scanned " + String.valueOf(size));
+
}
List result = scan.getResult();
log.info("Getting results");
return result;
-
-
-
-
-
}
- public static String getMessage(JedisPool innerPool){
+ public static HashMap filenames(JedisPool innerPool){
- ScanResult scan;
+ HashMap fileMap =new HashMap();
try (Jedis inner = innerPool.getResource()) {
while (!inner.ping().equals("PONG")){
log.info("wait");
}
- String myset = inner.spop("pairs");
- return myset;
+ inner.select(1);
+ Map filenames = inner.hgetAll("filenames");
+
+
+ for (Map.Entry stringStringEntry : filenames.entrySet().stream().collect(Collectors.toList())) {
+ fileMap.put(stringStringEntry.getKey(),stringStringEntry.getValue());
+ }
+
+
+
+
}
-
-
-
-
-
+ log.info("Getting results");
+ return fileMap;
}
+
+
}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/Compare.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/Compare.java
deleted file mode 100755
index 911d50b..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/Compare.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package edu.lu.uni.serval.fixminer.akka.compare;
-
-import com.github.gumtreediff.actions.ActionGenerator;
-import com.github.gumtreediff.actions.model.Action;
-import com.github.gumtreediff.matchers.Matcher;
-import com.github.gumtreediff.matchers.Matchers;
-import com.github.gumtreediff.tree.ITree;
-import edu.lu.uni.serval.utils.EDiffHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * Created by anilkoyuncu on 03/04/2018.
- */
-public class Compare {
-
- private Logger log = LoggerFactory.getLogger(Compare.class);
-
-
- public void coreCompare(String name, JedisPool innerPool, JedisPool outerPool) {
-
- Map resultMap;
- Jedis jedis = null;
- ITree oldTree = null;
- ITree newTree = null;
-
- try {
- jedis = innerPool.getResource();
-
- String[] split = name.split("_");
-
-
- String i = split[1];
- String j = split[2];
- String keyName = split[0];
-
-
- oldTree = EDiffHelper.getSimpliedTree(keyName,i,outerPool);
-
- newTree = EDiffHelper.getSimpliedTree(keyName,j,outerPool);
-
- Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
- m.match();
-
-
- ActionGenerator ag = new ActionGenerator(oldTree, newTree, m.getMappings());
- ag.generate();
- List actions = ag.getActions();
-
- double chawatheSimilarity1 = m.chawatheSimilarity(oldTree, newTree);
- String chawatheSimilarity = String.format("%1.2f", chawatheSimilarity1);
- double diceSimilarity1 = m.diceSimilarity(oldTree, newTree);
- String diceSimilarity = String.format("%1.2f", diceSimilarity1);
- double jaccardSimilarity1 = m.jaccardSimilarity(oldTree, newTree);
- String jaccardSimilarity = String.format("%1.2f", jaccardSimilarity1);
-
- String editDistance = String.valueOf(actions.size());
-
- String result = i + "," + j + "," + chawatheSimilarity + "," + diceSimilarity + "," + jaccardSimilarity + "," + editDistance;
-
-
- if (((Double) chawatheSimilarity1).equals(1.0) || ((Double) diceSimilarity1).equals(1.0)
- || ((Double) jaccardSimilarity1).equals(1.0) || actions.size() == 0) {
- String matchKey = keyName+"_" + (String.valueOf(i)) + "_" + String.valueOf(j);
- log.info("{} tagged to be similar" ,matchKey);
-
- jedis.select(1);
- jedis.set(matchKey, result);
-
- }
-
-
- jedis.select(0);
- jedis.del(keyName+"_" + (String.valueOf(i)) + "_" + String.valueOf(j));
-
-
-
- } catch (Exception e) {
-
- log.debug("{} not comparable", name);
-// e.printStackTrace();
-
-
- }finally {
- if (jedis != null) {
- jedis.close();
- }
- }
- }
-
-
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
index ab7fb7d..5d8af81 100755
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
+++ b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/CompareTrees.java
@@ -1,14 +1,6 @@
package edu.lu.uni.serval.fixminer.akka.compare;
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import com.github.gumtreediff.actions.ActionGenerator;
-import com.github.gumtreediff.actions.model.Action;
-import com.github.gumtreediff.matchers.Matcher;
-import com.github.gumtreediff.matchers.Matchers;
import com.github.gumtreediff.tree.ITree;
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
import edu.lu.uni.serval.fixminer.akka.ediff.HierarchicalActionSet;
import edu.lu.uni.serval.utils.CallShell;
import edu.lu.uni.serval.utils.EDiffHelper;
@@ -21,11 +13,8 @@ import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static edu.lu.uni.serval.fixminer.jobs.MultiThreadTreeLoaderCluster3.getNames;
/**
@@ -36,20 +25,20 @@ public class CompareTrees {
private static Logger log = LoggerFactory.getLogger(CompareTrees.class);
- public static void main(String[] args) throws Exception {
+ public static void main(String redisPath, String portInner, String portDumps, String dumpsName, String compareDBName, String job) throws Exception {
+ // shape /Users/anil.koyuncu/projects/test/fixminer-core/python/data/redis ALLdumps-gumInput.rdb clusterl0-gumInputALL.rdb /Users/anil.koyuncu/projects/test/fixminer-core/python/data/richEditScript
-
- String portInner = "6380";
- String port = "6399";
+// String portInner = "6380";
+ String port = portDumps; //"6399";
CallShell cs = new CallShell();
- String cmd = "bash "+args[1] + "/" + "startServer.sh" +" %s %s %s";
- cmd = String.format(cmd, args[1],args[2],Integer.valueOf(port));
+ String cmd = "bash "+redisPath + "/" + "startServer.sh" +" %s %s %s";
+ cmd = String.format(cmd, redisPath,dumpsName,Integer.valueOf(port));
log.info(cmd);
cs.runShell(cmd, port);
- String cmdInner = "bash "+args[1] + "/" + "startServer.sh" +" %s %s %s";
- cmdInner = String.format(cmdInner, args[1],args[3],Integer.valueOf(portInner));
+ String cmdInner = "bash "+redisPath + "/" + "startServer.sh" +" %s %s %s";
+ cmdInner = String.format(cmdInner, redisPath,compareDBName,Integer.valueOf(portInner));
log.info(cmdInner);
cs.runShell(cmdInner, portInner);
@@ -62,48 +51,17 @@ public class CompareTrees {
final JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), host,Integer.valueOf(port),20000000);
List listOfPairs = AkkaTreeParser.getMessages(innerPool,Integer.valueOf(numOfWorkers));
-
-// String pair = AkkaTreeParser.getMessage(innerPool);
+ HashMap filenames = AkkaTreeParser.filenames(innerPool);
-
-// ActorSystem system = null;
-// ActorRef parsingActor = null;
-// final TreeMessage msg = new TreeMessage(0,listOfPairs, innerPool,outerPool,timeout,args[0]);
-// try {
-// log.info("Akka begins...");
-// Config load = ConfigFactory.load();
-// system = ActorSystem.create("Compare-EnhancedDiff-System");
-//
-// parsingActor = system.actorOf(TreeActor.props(Integer.valueOf(numOfWorkers)), "mine-fix-pattern-actor");
-// parsingActor.tell(msg, ActorRef.noSender());
-// } catch (Exception e) {
-// system.shutdown();
-// e.printStackTrace();
-// }
-// try {
-// coreCompare(pair, args[0], innerPool, outerPool);
-// } catch (Exception e) {
-// try (Jedis inner = innerPool.getResource()) {
-//
-// inner.sadd("pairs",pair);
-//
-//
-// }
-// }
ArrayList samePairs = new ArrayList<>();
ArrayList errorPairs = new ArrayList<>();
- listOfPairs.stream().parallel().forEach(m->coreCompare(m, args[0],innerPool, outerPool,samePairs,errorPairs));
+ listOfPairs.stream().parallel().forEach(m->coreCompare(m, job,innerPool, samePairs,errorPairs,filenames,outerPool));
-// int size = samePairs.size();
try (Jedis jedis = innerPool.getResource()) {
-// jedis.select(2);
-// for (String samePair : samePairs) {
-// jedis.set(samePair,"1");
-// }
jedis.select(0);
jedis.flushDB();
@@ -114,34 +72,8 @@ public class CompareTrees {
}
log.info("End process");
-// listOfPairs.parallelStream().forEach(m->coreCompare(m, args[0],innerPool, outerPool));
-
-// for (String listOfPair : listOfPairs) {
-// coreCompare(listOfPair, args[0],innerPool, outerPool);
-// }
-
-
-// int counter = new Object() {
-// int counter = 0;
-//
-// {
-//
-// listOfPairs.parallelStream().
-// peek(x -> counter++).
-// forEach(m ->
-// {
-//// Compare compare = new Compare();
-// coreCompare(m, args[0],innerPool, outerPool);
-// if (counter % 1000 == 0) {
-// log.info("Finalized parsing " + counter + " files... remaing " + (listOfPairs.size() - counter));
-// }
-// }
-// );
-// }
-// }.counter;
-// coreCompare(args[0],args[1],args[2],args[3]);
}
- public static void coreCompare(String pairName, String treeType,JedisPool innerPool,JedisPool outerPool,ArrayList samePairs,ArrayList errorPairs ) {
+ public static void coreCompare(String pairName, String treeType,JedisPool innerPool,ArrayList samePairs,ArrayList errorPairs, HashMap filenames,JedisPool outerPool ) {
// if (samePairs.size() % 1000 == 0) {
// log.info("Same pairs size "+samePairs.size());
@@ -170,23 +102,24 @@ public class CompareTrees {
// return;
// }
// jedis.srem("pairs",matchKey);
-
+// JedisPool outerPool = null;
switch (treeType) {
case "shape":
- oldTree = EDiffHelper.getShapes(keyName, i, outerPool, innerPool);
- newTree = EDiffHelper.getShapes(keyName, j, outerPool, innerPool);
+ oldTree = EDiffHelper.getShapes(keyName, i, outerPool,filenames);
+ newTree = EDiffHelper.getShapes(keyName, j, outerPool,filenames);
break;
case "action":
- oldPair = EDiffHelper.getActions(keyName, i, outerPool, innerPool);
- newPair = EDiffHelper.getActions(keyName, j, outerPool, innerPool);
+
+ oldPair = EDiffHelper.getActions(keyName, i, outerPool, filenames);
+ newPair = EDiffHelper.getActions(keyName, j, outerPool, filenames);
oldTree = oldPair.getValue0();
newTree = newPair.getValue0();
break;
case "token":
- oldTree = EDiffHelper.getTokens(keyName, i, outerPool, innerPool);
- newTree = EDiffHelper.getTokens(keyName, j, outerPool, innerPool);
+ oldTree = EDiffHelper.getTokens(keyName, i, outerPool, filenames);
+ newTree = EDiffHelper.getTokens(keyName, j, outerPool, filenames);
String oldTokens = EDiffHelper.getNames2(oldTree);
String newTokens = EDiffHelper.getNames2(newTree);
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/RunnableCompare.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/RunnableCompare.java
deleted file mode 100755
index 40993fb..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/RunnableCompare.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package edu.lu.uni.serval.fixminer.akka.compare;
-
-import redis.clients.jedis.JedisPool;
-
-public class RunnableCompare implements Runnable {
-
- private String name;
- private JedisPool innerPool;
- private JedisPool outerPool;
- private CompareTrees comparer;
- private String type;
-
- public RunnableCompare(String name , JedisPool innerPool, JedisPool outerPool,String type) {
- this.name = name;
- this.innerPool = innerPool;
- this.outerPool = outerPool;
- this.type = type;
-
- }
-
- @Override
- public void run() {
-// comparer.coreCompare(name,type, innerPool, outerPool);
- }
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeActor.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeActor.java
deleted file mode 100755
index f2ae12c..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeActor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package edu.lu.uni.serval.fixminer.akka.compare;
-
-import akka.actor.ActorRef;
-import akka.actor.Props;
-import akka.actor.UntypedActor;
-import akka.japi.Creator;
-import akka.routing.BalancingPool;
-import akka.routing.RoundRobinPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.JedisPool;
-
-import java.util.List;
-
-public class TreeActor extends UntypedActor {
-
- private static Logger logger = LoggerFactory.getLogger(TreeActor.class);
-
- private ActorRef mineRouter;
- private final int numberOfWorkers;
- private int counter = 0;
-
-
- public TreeActor(int numberOfWorkers) {
- mineRouter = this.getContext().actorOf(new BalancingPool(numberOfWorkers)
- .props(TreeWorker.props()), "tree-router");
- this.numberOfWorkers = numberOfWorkers;
- }
-
- public static Props props(final int numberOfWorkers) {
-
- return Props.create(new Creator() {
-
- private static final long serialVersionUID = 9207427376110704705L;
-
- @Override
- public TreeActor create() throws Exception {
- return new TreeActor(numberOfWorkers);
- }
-
- });
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void onReceive(Object message) throws Exception {
- if (message instanceof TreeMessage) {
- List pairs = ((TreeMessage) message).getName();
- JedisPool innerPool = ((TreeMessage) message).getInnerPool();
- JedisPool outerPool = ((TreeMessage) message).getOuterPool();
- String type = ((TreeMessage) message).getType();
-
-
- int size = pairs.size();
- int average = size / numberOfWorkers;
- int reminder = size % numberOfWorkers;
- int counter = 0;
-
- for (int i = 0; i < numberOfWorkers; i ++) {
- int fromIndex = i * average + counter;
- if (counter < reminder) counter ++;
- int toIndex = (i + 1) * average + counter;
-
- List pairsOfWorkers = pairs.subList(fromIndex, toIndex);
- final TreeMessage workMsg = new TreeMessage(i + 1, pairsOfWorkers,innerPool,outerPool,((TreeMessage) message).getSECONDS_TO_WAIT(),type);
- mineRouter.tell(workMsg, getSelf());
- logger.info("Assign {} task to worker #" + (i + 1) + "...",pairsOfWorkers.size());
- }
- } else if ("STOP".equals(message.toString())) {
- counter ++;
- logger.info(counter + " workers finalized their work...");
- if (counter >= numberOfWorkers) {
- logger.info("All workers finalized their work...");
- this.getContext().stop(mineRouter);
- this.getContext().stop(getSelf());
- this.getContext().system().shutdown();
-
- }
- } else {
- unhandled(message);
- }
- }
-
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeMessage.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeMessage.java
deleted file mode 100755
index 335b2eb..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeMessage.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package edu.lu.uni.serval.fixminer.akka.compare;
-
-import edu.lu.uni.serval.fixminer.akka.BaseMessage;
-import redis.clients.jedis.JedisPool;
-
-import java.util.List;
-
-/**
- * Created by anilkoyuncu on 12/09/2018.
- */
-public class TreeMessage extends BaseMessage{
- private List name;
- private JedisPool innerPool;
- private JedisPool outerPool;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- private String type;
-
-
- public TreeMessage(int id, List name, JedisPool innerPool, JedisPool outerPool,String eDiffTimeout,String treeType) {
- super(id,new Long(eDiffTimeout));
-
- this.name = name;
- this.innerPool = innerPool;
- this.outerPool = outerPool;
- this.type = treeType;
- }
- public TreeMessage(int id, List name, JedisPool innerPool, JedisPool outerPool,Long eDiffTimeout,String treeType) {
- super(id,eDiffTimeout);
-
- this.name = name;
- this.innerPool = innerPool;
- this.outerPool = outerPool;
- this.type = treeType;
-
- }
-
- public List getName() {
- return name;
- }
-
- public void setName(List name) {
- this.name = name;
- }
-
- public JedisPool getInnerPool() {
- return innerPool;
- }
-
- public void setInnerPool(JedisPool innerPool) {
- this.innerPool = innerPool;
- }
-
- public JedisPool getOuterPool() {
- return outerPool;
- }
-
- public void setOuterPool(JedisPool outerPool) {
- this.outerPool = outerPool;
- }
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeWorker.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeWorker.java
deleted file mode 100755
index 32ebbac..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/compare/TreeWorker.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package edu.lu.uni.serval.fixminer.akka.compare;
-
-import akka.actor.Props;
-import akka.actor.UntypedActor;
-import akka.japi.Creator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.JedisPool;
-
-import java.util.List;
-import java.util.concurrent.*;
-
-public class TreeWorker extends UntypedActor {
- private static Logger log = LoggerFactory.getLogger(TreeWorker.class);
-
-
- public TreeWorker() {
-
- }
-
- public static Props props() {
- return Props.create(new Creator() {
-
- private static final long serialVersionUID = -7615153844097275009L;
-
- @Override
- public TreeWorker create() throws Exception {
- return new TreeWorker();
- }
-
- });
- }
-
-
-
- @Override
- public void onReceive(Object message) throws Exception {
- if(message instanceof TreeMessage) {
-
- TreeMessage msg = (TreeMessage) message;
- List files = msg.getName();
- JedisPool innerPool = msg.getInnerPool();
- JedisPool outerPool = msg.getOuterPool();
- String type = msg.getType();
-
- int id = msg.getId();
- int counter = 0;
-
- for (String name : files)
- {
-
-
-
-
- final ExecutorService executor = Executors.newFixedThreadPool(1);
-// // schedule the work
- final Future> future = executor.submit(new RunnableCompare(name, innerPool, outerPool,type));
- try {
-// wait for task to complete
- future.get(msg.getSECONDS_TO_WAIT(), TimeUnit.SECONDS);
- counter++;
- if (counter % 1000 == 0) {
- log.info("Worker #" + id +" finalized parsing " + counter + " pairs... remaing "+ (files.size() - counter));
- }
- } catch (TimeoutException e) {
- future.cancel(true);
- System.err.println("#Timeout: " + name);
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (ExecutionException e) {
- e.printStackTrace();
- } finally {
- executor.shutdownNow();
- }
- }
-
- log.info("Worker #" + id + " finalized the work...");
- this.getSender().tell("STOP", getSelf());
- }else{
- unhandled(message);
- }
- }
-
-
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/DefaultKryoContext.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/DefaultKryoContext.java
new file mode 100644
index 0000000..7941ab1
--- /dev/null
+++ b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/DefaultKryoContext.java
@@ -0,0 +1,84 @@
+package edu.lu.uni.serval.fixminer.akka.ediff;
+
+import java.io.ByteArrayOutputStream;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import com.esotericsoftware.kryo.pool.KryoFactory;
+import com.esotericsoftware.kryo.pool.KryoPool;
+import org.objenesis.strategy.SerializingInstantiatorStrategy;
+
+
+public class DefaultKryoContext implements KryoContext{
+
+ private static final int DEFAULT_BUFFER = 1024 * 100;
+
+ private KryoPool pool;
+
+ public static KryoContext newKryoContextFactory()
+ {
+ return new DefaultKryoContext();
+ }
+
+ private DefaultKryoContext()
+ {
+ KryoFactory factory = new KryoFactoryImpl();
+
+ pool = new KryoPool.Builder(factory).softReferences().build();
+ }
+
+ private static class KryoFactoryImpl implements KryoFactory
+ {
+ @Override
+ public Kryo create() {
+ Kryo kryo = new Kryo();
+ kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new SerializingInstantiatorStrategy()));
+ return kryo;
+ }
+ }
+
+
+ @Override
+ public byte[] serialze(Object obj)
+ {
+ return serialze(obj, DEFAULT_BUFFER);
+ }
+
+ @Override
+ public byte[] serialze(Object obj, int bufferSize)
+ {
+ ByteArrayOutputStream base = new ByteArrayOutputStream();
+ Output output = new Output(base, bufferSize);
+
+ Kryo kryo = pool.borrow();
+
+ kryo.writeObject(output, obj);
+
+ output.flush();
+ byte[] serialized = base.toByteArray();
+ output.close();
+
+// byte[] serialized = output.toBytes();
+
+ pool.release(kryo);
+
+ return serialized;
+ }
+
+ @Override
+ public Object deserialze(Class clazz, byte[] serialized)
+ {
+ Object obj;
+
+ Kryo kryo = pool.borrow();
+
+ Input input = new Input(serialized);
+ obj = kryo.readObject(input, clazz);
+
+ pool.release(kryo);
+
+ return obj;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java
index d73c643..cd30b79 100755
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java
+++ b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffHunkParser.java
@@ -1,16 +1,13 @@
package edu.lu.uni.serval.fixminer.akka.ediff;
-import com.github.gumtreediff.actions.model.Delete;
-import com.github.gumtreediff.actions.model.Insert;
-import com.github.gumtreediff.actions.model.Move;
-import com.github.gumtreediff.actions.model.Update;
import edu.lu.uni.serval.utils.EDiffHelper;
-import edu.lu.uni.serval.utils.FileHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
-import java.io.*;
-import java.util.ArrayList;
+import java.io.File;
+import java.io.FileOutputStream;
import java.util.List;
@@ -22,95 +19,41 @@ import java.util.List;
*
*/
public class EDiffHunkParser extends EDiffParser {
-
+ private static Logger logger = LoggerFactory.getLogger(EDiffHunkParser.class);
@Override
public void parseFixPatterns(File prevFile, File revFile, File diffentryFile, String project, JedisPool innerPool) {
List actionSets = parseChangedSourceCodeWithGumTree2(prevFile, revFile);
if (actionSets.size() != 0) {
-// String folder= null;
- boolean processActionSet = true;
-// switch (actionType){
-// case "ALL":
-// if(actionType.equals("ALL")){
-// folder = "/ALL/";
-// processActionSet = true;
-// }else if(actionType.equals("UPD") || actionType.equals("INS") || actionType.equals("DEL") || actionType.equals("MOV")|| actionType.equals("MIX")){
-// boolean isUPD = actionSets.stream().allMatch(p -> p.getAction() instanceof Update);
-// boolean isINS = actionSets.stream().allMatch(p -> p.getAction() instanceof Insert);
-// boolean isDEL = actionSets.stream().allMatch(p -> p.getAction() instanceof Delete);
-// boolean isMOV = actionSets.stream().allMatch(p -> p.getAction() instanceof Move);
-// if(isUPD){
-// folder = "/UPD/";
-// processActionSet = true;
-// }else if(isINS){
-// folder = "/INS/";
-// processActionSet = true;
-// }else if(isDEL){
-// folder = "/DEL/";
-// processActionSet = true;
-// }else if(isMOV){
-// folder = "/MOV/";
-// processActionSet = true;
-// }else{
-// folder = "/MIX/";
-// processActionSet = true;
-// }
-// }else{
-//
-//
-// processActionSet = false;
-// System.err.print(actionType + "not known");
-//
-// }
+ boolean processActionSet = true;
int hunkSet = 0;
if(processActionSet){
for (HierarchicalActionSet actionSet : actionSets) {
-
-
-
-
FileOutputStream f = null;
try {
String astNodeType = actionSet.getAstNodeType();
-// int size = actionSet.toString().split("\\n").length;
actionSet.toString();
int size = actionSet.getActionSize();
-// int size = actionSet.strList.size();
String datasetName = project;
String[] split1 = diffentryFile.getParent().split(datasetName);
String root = split1[0];
String pj = split1[1].split("/")[1];
-// File file = new File(root + "EnhancedASTDiff" + datasetName + "/"+astNodeType+"/"+String.valueOf(size)+"/");
-// file.mkdirs();
-// String hunkTreeFileName = root + "EnhancedASTDiff" + datasetName + "/"+astNodeType+"/"+String.valueOf(size)+"/" + pj +"_" + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
-// String hunkTreeFileName = root + "EnhancedASTDiff" + datasetName + "/" + pj + folder + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
-
-// f = new FileOutputStream(new File(hunkTreeFileName));
-// ObjectOutputStream o = new ObjectOutputStream(f);
-// o.writeObject(actionSet);
-//
-// o.close();
-// f.close();
-
-// String name = f.getName();
String key = astNodeType+"/"+String.valueOf(size)+"/" + pj +"_" + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
try (Jedis inner = innerPool.getResource()) {
- inner.set(key.getBytes(), EDiffHelper.toByteArray(actionSet));
+ inner.hset("dump".getBytes(),key.getBytes(),EDiffHelper.kryoSerialize(actionSet));
}
- } catch (FileNotFoundException e) {
- e.printStackTrace();
} catch (Exception e) {
+ logger.error("error",e);
e.printStackTrace();
}
hunkSet++;
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffMessage.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffMessage.java
index d19a365..a2c8697 100755
--- a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffMessage.java
+++ b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/EDiffMessage.java
@@ -10,10 +10,6 @@ public class EDiffMessage extends BaseMessage{
private List msgFiles;
-
-
- private String actionType;
-
public JedisPool getInnerPool() {
return innerPool;
}
@@ -31,25 +27,14 @@ public class EDiffMessage extends BaseMessage{
public EDiffMessage(int id, List msgFiles,String eDiffTimeout,JedisPool pool) {
super(id,new Long(eDiffTimeout));
this.msgFiles = msgFiles;
- this.actionType = actionType;
this.innerPool = pool;
}
public EDiffMessage(int id, List msgFiles,Long eDiffTimeout,JedisPool pool) {
super(id,eDiffTimeout);
this.msgFiles = msgFiles;
- this.actionType = actionType;
this.innerPool = pool;
}
- public String getActionType() {
- return actionType;
- }
-
- public void setActionType(String actionType) {
- this.actionType = actionType;
- }
-
-
public List getMsgFiles() {
return msgFiles;
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/KryoContext.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/KryoContext.java
new file mode 100644
index 0000000..d641ede
--- /dev/null
+++ b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/KryoContext.java
@@ -0,0 +1,10 @@
+package edu.lu.uni.serval.fixminer.akka.ediff;
+
+public interface KryoContext {
+
+ byte[] serialze(Object obj);
+
+ byte[] serialze(Object obj, int bufferSize);
+
+ Object deserialze(Class clazz, byte[] serialized);
+}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/AkkaTreeLoader.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/AkkaTreeLoader.java
deleted file mode 100755
index 915e4bc..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/AkkaTreeLoader.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import edu.lu.uni.serval.utils.CallShell;
-import edu.lu.uni.serval.utils.PoolBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static edu.lu.uni.serval.fixminer.akka.compare.AkkaTreeParser.akkaCompare;
-
-/**
- * Created by anilkoyuncu on 19/03/2018.
- */
-public class AkkaTreeLoader {
-
- private static Logger log = LoggerFactory.getLogger(AkkaTreeLoader.class);
-
-
- public static void main(String portInner, String dbDir, String chunkName, String port, String dumpsName, String pairsPath, String numOfWorkers, int cursor, String chunk, String eDiffTimeout, String parallelism) throws Exception {
-
-
- String parameters = String.format("\nportInner %s \nchunkName %s \ndbDir %s \ndumpsName %s",portInner,chunkName,dbDir,dumpsName);
- log.info(parameters);
-
-
- CallShell cs = new CallShell();
- String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- String cmd1 = String.format(cmd, dbDir,dumpsName,Integer.valueOf(port));
-//
- cs.runShell(cmd1,port);
- String cmdInner = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- String cmd2 = String.format(cmdInner, dbDir,chunkName,Integer.valueOf(portInner));
- log.info(cmd1);
- log.info(cmd2);
-//
- cs.runShell(cmd2, portInner);
- JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(port),20000000);
- JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
-
-
-
-// String pairsIndexFile = pairsPath + "/"+ chunkName;
- //0.txt.rdb
-// pairsIndexFile = pairsIndexFile.replace(chunk+".rdb",".index");
-
- File folder = new File(pairsPath);
- File[] rootsFolder = folder.listFiles();
-
- Stream stream = Arrays.stream(rootsFolder);
- List roots = stream
- .filter(x -> !x.getName().startsWith("."))
- .collect(Collectors.toList());
-
- for(File root:roots) {
-
- File[] files = root.listFiles();
- Stream fileStream = Arrays.stream(files);
- List pairsIndexFiles = fileStream
- .filter(x -> !x.getName().startsWith("."))
- .filter(x -> x.getName().endsWith(".index"))
- .collect(Collectors.toList());
- for (File pairsIndexFile : pairsIndexFiles) {
-
- Pattern pattern = Pattern.compile(",");
- String csvFile = pairsIndexFile.getPath();
- try {
- try (BufferedReader in = new BufferedReader(new FileReader(csvFile));) {
- Map namefreq = in
- .lines()
- .map(x -> pattern.split(x))
- .collect(HashMap::new, (map, x) ->
- map.put(root.getName()+"-"+pairsIndexFile.getName().split("\\.")[0]+"-"+x[0], x[1]),
- Map::putAll);
-
- Jedis inner = null;
- try {
- inner = outerPool.getResource();
-
- for (Map.Entry entry : namefreq.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
- inner.select(1);
- inner.set(key, value);
- }
-
-
- } finally {
- if (inner != null) {
- inner.close();
- }
- }
-
-
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
-
-
-
- akkaCompare(innerPool,outerPool,numOfWorkers,cursor,eDiffTimeout,parallelism);
-
-// String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
-// String stopServer2 = String.format(stopServer,Integer.valueOf(port));
-//
-// cs.runShell(stopServer2,port);
-//
-//
-// String stopServer1 = String.format(stopServer,Integer.valueOf(portInner));
-//
-// cs.runShell(stopServer1,portInner);
-
-
-
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-}
-
-
-
-
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/CalculatePairs.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/CalculatePairs.java
deleted file mode 100755
index 494857d..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/CalculatePairs.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import edu.lu.uni.serval.utils.CallShell;
-import edu.lu.uni.serval.utils.FileHelper;
-import edu.lu.uni.serval.utils.PoolBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-import redis.clients.jedis.ScanParams;
-import redis.clients.jedis.ScanResult;
-
-import java.io.*;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.util.List;
-
-
-/**
- * Created by anilkoyuncu on 05/04/2018.
- */
-public class CalculatePairs {
- private static Logger log = LoggerFactory.getLogger(CalculatePairs.class);
-
- public static void main(String dbDir,String chunkName,String port,String outputPath,String pjName,boolean isBigPair,int cursor) throws Exception {
-
-
- String parameters = String.format("\nport %s \nchunkName %s \ndbDir %s",port,chunkName,dbDir);
- log.info(parameters);
-
- CallShell cs =new CallShell();
- String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(port));
-
- cs.runShell(cmd, port);
- FileHelper.createDirectory(outputPath);
-
-
- JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(port),20000000);
-
- ScanResult scan;
- try (Jedis outer = outerPool.getResource()) {
- while (outer.ping()== "PONG"){
- log.info("wait");
- }
-
- ScanParams sc = new ScanParams();
- //150000000
- sc.count(cursor);
- sc.match("*");
-
- scan = outer.scan("0", sc);
- int size = scan.getResult().size();
- log.info("Scanning " + String.valueOf(size));
- }
- List result = scan.getResult();
-
-
-
-
- byte [] buf = new byte[0];
- String line = null;
- if(isBigPair) {
- bigPair(outputPath, pjName, result, buf, line);
- }else{
- smallPair(outputPath, pjName, result, buf, line);
- }
-
-// String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
-// String stopServer2 = String.format(stopServer,Integer.valueOf(port));
-//// loadRedis(stopServer2,serverWait);
-// cs.runShell(stopServer2,serverWait);
- log.info("Done pairs");
- }
-
- private static void smallPair(String outputPath, String pjName, List result, byte[] buf, String line) {
- try {
- FileOutputStream fos = new FileOutputStream(outputPath + "/" +pjName+".csv");
- DataOutputStream outStream = new DataOutputStream(new BufferedOutputStream(fos));
-
- FileOutputStream fosIndex = new FileOutputStream(outputPath + "/" +pjName+".index");
- DataOutputStream outStreamIndex = new DataOutputStream(new BufferedOutputStream(fosIndex));
-
- for (int i = 0; i < result.size(); i++) {
- line = String.valueOf(i) +"," + result.get(i)+"\n";
- outStreamIndex.write(line.getBytes());
-
- for (int j = i + 1; j < result.size(); j++) {
-
-
-
- line = String.valueOf(i) +"," + String.valueOf(j)+"\n"; // + "," + result.get(i) + "," + result.get(j)+"\n";
- outStream.write(line.getBytes());
-
- }
- }
- outStream.close();
- outStreamIndex.close();
-
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }catch (java.nio.BufferOverflowException e) {
- log.error(line);
- log.error(String.valueOf(buf.length));
- e.printStackTrace();
- }
- }
-
- private static void bigPair(String outputPath, String pjName, List result, byte[] buf, String line) {
- try {
-
- FileOutputStream fosIndex = new FileOutputStream(outputPath + "/" +pjName+".index");
- DataOutputStream outStreamIndex = new DataOutputStream(new BufferedOutputStream(fosIndex));
- int fileCounter = 0;
- FileChannel rwChannel = new RandomAccessFile(outputPath + "/" +pjName +String.valueOf(fileCounter)+".txt", "rw").getChannel();
- int maxSize = 500*1000000;
- ByteBuffer wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, maxSize);
-
-
- for (int i = 0; i < result.size(); i++) {
- line = String.valueOf(i) +"," + result.get(i)+"\n";
- outStreamIndex.write(line.getBytes());
- for (int j = i + 1; j < result.size(); j++) {
-
-
- line = String.valueOf(i) +"," + String.valueOf(j)+"\n"; // + "," + result.get(i) + "," + result.get(j)+"\n";
- buf = line.getBytes();
- if(wrBuf.remaining() > 500) {
- wrBuf.put(buf);
- }else{
- log.info("Next pair dump");
- fileCounter++;
- rwChannel = new RandomAccessFile(outputPath+"/" +pjName+String.valueOf(fileCounter)+".txt", "rw").getChannel();
- wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, maxSize);
- }
-
-
-
-
- }
- }
- outStreamIndex.close();
- rwChannel.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }catch (java.nio.BufferOverflowException e) {
- log.error(line);
- log.error(String.valueOf(buf.length));
- e.printStackTrace();
- }
- }
-
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
index 25bdd5e..fd097cb 100755
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
+++ b/src/main/java/edu/lu/uni/serval/fixminer/jobs/EnhancedASTDiff.java
@@ -24,10 +24,10 @@ public class EnhancedASTDiff {
private static Logger log = LoggerFactory.getLogger(EnhancedASTDiff.class);
- public static void main(String inputPath, String outputPath, String numOfWorkers, String project, String eDiffTimeout, String actionType, String parallelism, String portInner, String dbDir, String chunkName) throws Exception {
+ public static void main(String inputPath, String numOfWorkers, String project, String eDiffTimeout, String parallelism, String portInner, String dbDir, String chunkName) throws Exception {
- String parameters = String.format("\nInput path %s \nOutput path %s",inputPath,outputPath);
+ String parameters = String.format("\nInput path %s",inputPath);
log.info(parameters);
CallShell cs = new CallShell();
@@ -48,29 +48,15 @@ public class EnhancedASTDiff {
List allMessageFiles = new ArrayList<>();
for (File target : folders) {
- String pjName = target.getName();
-
List msgFiles = getMessageFiles(target.toString() + "/"); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
-// System.out.println(msgFiles.size());
+
if (msgFiles == null)
continue;
allMessageFiles.addAll(msgFiles);
- String GUM_TREE_OUTPUT = outputPath + "/" + pjName + "/";
-// a
-
-// if (actionType.equals("ALL")) {
-// FileHelper.createDirectory(GUM_TREE_OUTPUT + "/" + actionType);
-// } else {
-// FileHelper.createDirectory(GUM_TREE_OUTPUT + "/UPD");
-// FileHelper.createDirectory(GUM_TREE_OUTPUT + "/INS");
-// FileHelper.createDirectory(GUM_TREE_OUTPUT + "/DEL");
-// FileHelper.createDirectory(GUM_TREE_OUTPUT + "/MOV");
-// FileHelper.createDirectory(GUM_TREE_OUTPUT + "/MIX");
-// }
}
switch (parallelism){
@@ -101,9 +87,9 @@ public class EnhancedASTDiff {
forEach(m ->
{
EDiffHunkParser parser = new EDiffHunkParser();
- parser.parseFixPatterns(m.getPrevFile(),m.getRevFile(), m.getDiffEntryFile(),project,msg.getInnerPool());
+ parser.parseFixPatterns(m.getPrevFile(),m.getRevFile(), m.getDiffEntryFile(),project,innerPool);
if (counter % 10 == 0) {
- log.info("Finalized parsing " + counter + " files... remaing " + (allMessageFiles.size() - counter));
+ log.info("Finalized parsing " + counter + " files... remaining " + (allMessageFiles.size() - counter));
}
}
);
@@ -111,6 +97,8 @@ public class EnhancedASTDiff {
}.counter;
log.info("Finished parsing {} files",counter);
break;
+
+
default:
log.error("Unknown parallelism {}", parallelism);
break;
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/ImportPairs2DB.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/ImportPairs2DB.java
deleted file mode 100755
index 585d082..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/ImportPairs2DB.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import edu.lu.uni.serval.utils.CallShell;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-
-/**
- * Created by anilkoyuncu on 05/04/2018.
- */
-public class ImportPairs2DB {
- private static Logger log = LoggerFactory.getLogger(ImportPairs2DB.class);
-
- public static void main(String csvInputPath, String portInner, String dbDir, String datasetPath, String chunk) throws Exception {
-
-
- String parameters = String.format("\nInput path %s \nportInner %s \ndbDir %s",csvInputPath,portInner,dbDir);
- log.info(parameters);
-
- String[] splits = chunk.split("\\.");
- String chunkType = splits[splits.length-1];
- log.info("Chunk type {}",chunkType);
-
- File folder = new File(csvInputPath);
- File[] subFolders = folder.listFiles();
- Stream stream = Arrays.stream(subFolders);
- List roots = stream
-// .filter(x -> x.getName().endsWith(chunkType))
- .collect(Collectors.toList());
-
- Integer portInt = Integer.valueOf(portInner);
-
- String cmd = "bash " + dbDir + "/" + "startServer.sh" + " %s %s %s";
- cmd = String.format(cmd, dbDir,"pairs.rdb", portInt);
- log.info(cmd);
- CallShell cs = new CallShell();
- cs.runShell(cmd, portInner);
-
- for (File root : roots) {
-
- File[] files = root.listFiles();
- Stream fileStream = Arrays.stream(files);
- List pairs = fileStream
- .filter(x -> x.getName().endsWith(chunkType))
- .collect(Collectors.toList());
-
- for(File pj:pairs) {
-
-
-
- cmd = "bash " + datasetPath + "/redisSingleImport.sh" + " %s %s %s";
-
- cmd = String.format(cmd, pj.getPath(), portInt,root.getName()+"-"+pj.getName().split("\\.")[0]);
-
- log.info(cmd);
- cs.runShell(cmd,portInner);
-
-
- }
-
-
-
- }
-
- String stopServer = "bash " + dbDir + "/" + "stopServer.sh" + " %s";
- String stopServer2 = String.format(stopServer, portInt);
- cs.runShell(stopServer2, portInner);
-
-// portInt++;
- log.info(parameters);
- }
-
-
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster.java
deleted file mode 100755
index 84e487d..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster.java
+++ /dev/null
@@ -1,394 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import com.github.gumtreediff.actions.ActionGenerator;
-import com.github.gumtreediff.actions.model.Action;
-import com.github.gumtreediff.matchers.Matcher;
-import com.github.gumtreediff.matchers.Matchers;
-import com.github.gumtreediff.tree.ITree;
-import com.github.gumtreediff.tree.TreeContext;
-import edu.lu.uni.serval.fixminer.akka.ediff.HierarchicalActionSet;
-import edu.lu.uni.serval.utils.CallShell;
-import edu.lu.uni.serval.utils.EDiffHelper;
-import edu.lu.uni.serval.utils.FileHelper;
-import edu.lu.uni.serval.utils.PoolBuilder;
-import org.javatuples.Pair;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-import redis.clients.jedis.ScanParams;
-import redis.clients.jedis.ScanResult;
-
-import java.io.*;
-import java.util.*;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Created by anilkoyuncu on 19/03/2018.
- */
-public class MultiThreadTreeLoaderCluster {
-
- private static Logger log = LoggerFactory.getLogger(MultiThreadTreeLoaderCluster.class);
-
-
- public static void mainCompare(String port,String pairsCSVPath,String importScript,String dbDir,String chunkName,String dumpName,String portInner,String type,int cursor) throws Exception {
-
- CallShell cs = new CallShell();
- String cmd1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- cmd1 = String.format(cmd1, dbDir,chunkName,Integer.valueOf(portInner));
- cs.runShell(cmd1, port);
-
-
- String cmd2 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- cmd2 = String.format(cmd2, dbDir,dumpName,Integer.valueOf(port));
- cs.runShell(cmd2, port);
-
-
-
-// String cmd3;
-// cmd3 = "bash " + importScript +" %s %s";
-
-
- JedisPool jedisPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
-
- JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(port),20000000);
-
-
- File folder = new File(pairsCSVPath);
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List folders = stream
- .filter(x -> !x.getName().startsWith("."))
- .collect(Collectors.toList());
-
- for (File f:folders) {
-
-// if(f.getName().startsWith("cluster0")) {
- File[] files = f.listFiles();
- Stream fileStream = Arrays.stream(files);
-
- List pairs = fileStream
- .filter(x -> !x.getName().startsWith("."))
- .filter(x -> !x.getName().endsWith(".index"))
- .collect(Collectors.toList());
- for (File pair : pairs) {
-
-
- try (Jedis jedis = jedisPool.getResource()) {
- // do operations with jedis resource
- ScanParams sc = new ScanParams();
- sc.count(cursor);
- sc.match(f.getName()+"*");
-
- log.info("Scanning");
- ScanResult scan = jedis.scan("0", sc);
- int size = scan.getResult().size();
-
- if (size == 0) {
- String cmd3 = "bash " + importScript + " %s %s %s";
-
- cmd3 = String.format(cmd3, pair.getPath(), portInner,f.getName()+"-"+pair.getName().split("\\.")[0]);
-// String comd = String.format(cmd3, f.getPath(), portInner);
-// loadRedis(comd);
- log.info("Importing {} pairs for cluster {}", size, f.getName());
- cs.runShell(cmd3, portInner);
-
- scan = jedis.scan("0", sc);
- size = scan.getResult().size();
-
- }
- log.info("Scanned {} for cluster {}", String.valueOf(size), f.getName());
-
- Pattern pattern = Pattern.compile(",");
- String csvFile = pair.getPath();
- csvFile = csvFile.replace("txt","index");
- try (BufferedReader in = new BufferedReader(new FileReader(csvFile));) {
- Map namefreq = in
- .lines()
- .map(x -> pattern.split(x))
- .collect(HashMap::new, (map, x) ->
- map.put(f.getName()+"-"+pair.getName().split("\\.")[0]+"-"+x[0], x[1]),
- Map::putAll);
-
- for (Map.Entry entry : namefreq.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
- jedis.select(1);
- jedis.set(key, value);
- }
-
-
-
- }
-
-
-// String clusterName = f.getName().replaceAll("[^0-9]+", "");
-
-
- //76
-
- scan.getResult().parallelStream()
- .forEach(m -> coreCompare(m, jedisPool, f.getName(), outerPool, type));
-
-
- jedis.save();
-
- }
-// }
-
-
- }
- }
- String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
- String stopServer1 = String.format(stopServer,Integer.valueOf(portInner));
- cs.runShell(stopServer1, port);
-
- String stopServer2 = String.format(stopServer,Integer.valueOf(port));
- cs.runShell(stopServer2, port);
-
-
-
- }
-
-
-
- public static Pair getTree(String prefix,String firstValue, JedisPool outerPool,JedisPool innerPool){
-
-
- ITree tree = null;
- Jedis inner = null;
- Jedis outer = null;
-// String[] split2 = firstValue.split("/");
-//
-// String fullFileName = split2[split2.length-1];
-// String[] split = fullFileName.split(".txt_");
-// String pureFileName = split[0];
-// String[] splitPJ = split[1].split("_");
-// String project = splitPJ[1];
-// String actionSetPosition = splitPJ[0];
-
-
-
- try {
- inner = innerPool.getResource();
- inner.select(1);
- String dist2load = inner.get(prefix+"-"+firstValue);
- outer = outerPool.getResource();
- outer.select(0);
- String s = null;//inner.get(prefix.replace("-","/") +"/"+dist2load);
- Set keys = outer.keys(prefix.split("-")[0] + "/*/" + dist2load);
- if(keys.size() == 1) {
- s = (String) keys.toArray()[0];
- }else{
- throw new Error("cok key");
- }
-
-
-// String filename = project + "/"+type+"/" + pureFileName + ".txt_" + actionSetPosition;
- String si= outer.get(s);
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
-
-
- ITree parent = null;
- ITree children =null;
- TreeContext tc = new TreeContext();
- tree = EDiffHelper.getActionTree(actionSet, parent, children,tc);
- tree.setParent(null);
- tc.validate();
-
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally {
- if (inner != null) {
- inner.close();
- }
- if (outer != null) {
- outer.close();
- }
- }
- Pair pair = new Pair<>(tree,null);
- return pair;
-
-
-
-
-
-
- }
-
-
-
-
-
- private static void coreCompare(String name , JedisPool jedisPool,String clusterName,JedisPool outerPool,String type) {
-
-
- try (Jedis jedis = jedisPool.getResource()) {
-
-
- Map resultMap = jedis.hgetAll(name);
-
- resultMap.get("0");
-
-
- String[] split = name.split("_");
- String i = null;
- String j =null;
- try {
- i = split[1];
- j = split[2];
- }
- catch (Exception e){
- e.printStackTrace();
- }
-// String firstValue = resultMap.get("0");
-// String secondValue = resultMap.get("1");
-
-
- try {
- String keyName = split[0];
- Pair oldPair = getTree(keyName,i, outerPool,jedisPool);
- Pair newPair = getTree(keyName,j, outerPool,jedisPool);
-
- ITree oldTree = oldPair.getValue0();
- ITree newTree = newPair.getValue0();
-
-// String oldProject = oldPair.getValue1();
-// String newProject = newPair.getValue1();
-
-
-
- Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
- m.match();
-
-
- ActionGenerator ag = new ActionGenerator(oldTree, newTree, m.getMappings());
- ag.generate();
- List actions = ag.getActions();
-
- String resultKey = "result_" + (String.valueOf(i)) + "_" + String.valueOf(j);
- double chawatheSimilarity1 = m.chawatheSimilarity(oldTree, newTree);
- String chawatheSimilarity = String.format("%1.2f", chawatheSimilarity1);
- double diceSimilarity1 = m.diceSimilarity(oldTree, newTree);
- String diceSimilarity = String.format("%1.2f", diceSimilarity1);
- double jaccardSimilarity1 = m.jaccardSimilarity(oldTree, newTree);
- String jaccardSimilarity = String.format("%1.2f", jaccardSimilarity1);
-
- String editDistance = String.valueOf(actions.size());
-// jedis.select(1);
- String result = i+ "," + j + "," + chawatheSimilarity + "," + diceSimilarity + "," + jaccardSimilarity + "," + editDistance;
-// jedis.set(resultKey, result);
-
- String matchKey = keyName+"_" + (String.valueOf(i)) + "_" + String.valueOf(j);
- if (((Double) chawatheSimilarity1).equals(1.0) || ((Double) diceSimilarity1).equals(1.0)
- || ((Double) jaccardSimilarity1).equals(1.0) || actions.size() == 0) {
- jedis.select(2);
- jedis.set(matchKey, result);
- }
- jedis.select(0);
-
- jedis.del(matchKey);
-
-// log.info("Completed " + resultKey);
-
- }catch (Exception e){
- log.debug(e.toString() + " {}",(name));
- e.printStackTrace();
-
-
- }
-
-
-
-
- }
- }
-
-
-
- /*
- pairs of each cluster
- */
- public static void calculatePairsOfClusters(String inputPath, String outputPath,String type) {
- File folder = new File(inputPath);
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List pjs = stream
- .filter(x -> !x.getName().startsWith("."))
- .filter(x-> x.isDirectory())
- .collect(Collectors.toList());
-
- FileHelper.createDirectory(outputPath + "/pairs"+type);
- for (File pj : pjs) {
-
- File[] files = pj.listFiles();
- List fileList = Arrays.asList(files);
-
- readMessageFilesCluster(fileList, outputPath,inputPath,pj.getName(),type);
-
- }
-
- }
-
-
- private static void readMessageFilesCluster(List folders, String outputPath,String inputPath,String cluster,String type) {
-
- List treesFileNames = new ArrayList<>();
-
-
- for (File target : folders) {
-
- treesFileNames.add(target.toString());
- }
-
- log.info("Calculating pairs");
-// treesFileNames = treesFileNames.subList(0,100);
-
- String filename = "cluster" + cluster;
- byte [] buf = new byte[0];
- String line = null;
- try {
-
- FileOutputStream fos = new FileOutputStream(outputPath + "/pairs"+type+"/" +filename+".csv");
- DataOutputStream outStream = new DataOutputStream(new BufferedOutputStream(fos));
-
-
-
- for (int i = 0; i < treesFileNames.size(); i++) {
- for (int j = i + 1; j < treesFileNames.size(); j++) {
-
-
-
- line = String.valueOf(i) +"," + String.valueOf(j) + "," + treesFileNames.get(i).replace(inputPath,"") + "," + treesFileNames.get(j).replace(inputPath,"")+"\n";
- outStream.write(line.getBytes());
-
- }
- }
- outStream.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }catch (java.nio.BufferOverflowException e) {
- log.error(line);
- log.error(String.valueOf(buf.length));
- e.printStackTrace();
- }
-
- log.info("Done pairs of cluster {}",cluster);
- }
-
-
-
-
-// return msgFiles;
-}
-
-
-
-
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
deleted file mode 100755
index 10aa82f..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/MultiThreadTreeLoaderCluster3.java
+++ /dev/null
@@ -1,644 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import com.github.gumtreediff.tree.ITree;
-import com.github.gumtreediff.tree.TreeContext;
-import com.github.gumtreediff.tree.TreeUtils;
-import edu.lu.uni.serval.fixminer.akka.ediff.HierarchicalActionSet;
-import edu.lu.uni.serval.utils.CallShell;
-import edu.lu.uni.serval.utils.EDiffHelper;
-import edu.lu.uni.serval.utils.FileHelper;
-import edu.lu.uni.serval.utils.PoolBuilder;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.text.similarity.JaroWinklerDistance;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-import redis.clients.jedis.ScanParams;
-import redis.clients.jedis.ScanResult;
-
-import java.io.*;
-import java.util.*;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-
-
-/**
- * Created by anilkoyuncu on 19/03/2018.
- */
-public class MultiThreadTreeLoaderCluster3 {
-
-
- private static Logger log = LoggerFactory.getLogger(MultiThreadTreeLoaderCluster3.class);
-
-
- public static void mainCompare(String port,String pairsCSVPath,String importScript,String dbDir,String chunkName,String dumpName,String portInner,String type,int cursor) throws Exception {
-
- CallShell cs = new CallShell();
- String cmd1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- cmd1 = String.format(cmd1, dbDir,chunkName,Integer.valueOf(portInner));
- cs.runShell(cmd1, port);
-
- String cmd2 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- cmd2 = String.format(cmd2, dbDir,dumpName,Integer.valueOf(port));
- cs.runShell(cmd2, port);
-
- String cmd3;
- cmd3 = "bash " + importScript +" %s %s";
-
-
- JedisPool jedisPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
-
- JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(port),20000000);
-
-
-
- File folder = new File(pairsCSVPath);
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List folders = stream
- .filter(x -> !x.getName().startsWith("."))
- .collect(Collectors.toList());
-
- for (File f:folders){
- //36_0,119_0,4_0
-// if(f.getName().startsWith("cluster1_0")) {
-
-
- try (Jedis jedis = jedisPool.getResource()) {
- // do operations with jedis resource
- ScanParams sc = new ScanParams();
- sc.count(cursor);
- sc.match("pair_[0-9]*");
-
- log.info("Scanning");
- ScanResult scan = jedis.scan("0", sc);
- int size = scan.getResult().size();
-
- if (size == 0) {
- String comd = String.format(cmd3, f.getPath(), portInner);
- cs.runShell(comd,portInner);
-
-
- scan = jedis.scan("0", sc);
- size = scan.getResult().size();
-
- }
- log.info("Scanned " + String.valueOf(size));
-
-
- String clusterName = f.getName().split("\\.")[0].replace("cluster", "");
-
-
- scan.getResult().parallelStream()
- .forEach(m -> coreCompare(m, jedisPool, clusterName, outerPool,type));
-
-
- jedis.save();
-
- }
- }
-
- String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
- String stopServer1 = String.format(stopServer,Integer.valueOf(portInner));
- cs.runShell(stopServer1, port);
-
- String stopServer2 = String.format(stopServer,Integer.valueOf(port));
- cs.runShell(stopServer2, port);
-
-
-
- }
-
-
-
-
-
- public static ITree getTree(String firstValue, JedisPool outerPool,String type){
-// String gumTreeInput = "/Volumes/data/bugStudy_backup/dataset/GumTreeInputBug4/";
- String[] split2 = firstValue.split("/");
-
- String filename = split2[split2.length-1];
-// String filename = split2[3];
- String[] split1= filename.split(".txt_");
- String s = split1[0];
- String[] splitPJ = split1[1].split("_");
- String project = splitPJ[1];
- String actionSetPosition = splitPJ[0];
-
- Integer asp = Integer.valueOf(actionSetPosition);
-// if (asp > 1){
-// return null;
-// }
-
-
- ITree tree = null;
- Jedis inner = null;
-
-
-
-
- try {
- inner = outerPool.getResource();
- String fn = project + "/"+type+"/" + s + ".txt_" + actionSetPosition;
- String si= inner.get(fn);
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
-
-
- ITree parent = null;
- ITree children =null;
- TreeContext tc = new TreeContext();
- tree = EDiffHelper.getTokenTree(actionSet, parent, children,tc);
-// tree.setParent(null);
- tc.validate();
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally {
- if (inner != null) {
- inner.close();
- }
- }
-
- return tree;
-
-
- }
-
-
-
-
-
- public static List getNames(ITree oldTree, List oldTokens){
-
- List descendants = oldTree.getDescendants();
- descendants.add(0,oldTree);
- boolean upd=false;
-
- for (ITree oldDescendant : descendants) {
-
- boolean addToken = false;
- int type = oldDescendant.getType();
-
- String sType = String.valueOf(type);
-
- if((sType.equals("42") || oldDescendant.getChildren().size() ==0)||
- (sType.equals("32") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
- (sType.equals("59") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
- (sType.equals("43") && oldDescendant.getHeight() == 0 && oldDescendant.getChildren().size() == 0) ||
- (sType.equals("53") )|| //&& oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
- (sType.equals("7") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
- (sType.equals("41") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
- (sType.equals("40") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1)
- ){
-
-// int depth = oldDescendant.getChildren().size();
-
- String label = oldDescendant.getLabel();
-
-// if(sType.equals("32") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1){
-// log.info("");
-// }
-
-
- label = label.split("@AT@")[0];
- String[] split = label.split(" "+sType);
- String[] split2 = split[1].split("@");
- List m = new ArrayList();
- if(label.startsWith("UPD")){
- upd = true;
-
- String timeRegex = "UPD (AnonymousClassDeclaration|ArrayAccess|ArrayCreation|ArrayInitializer|ArrayType|AssertStatement|Assignment|Block|BooleanLiteral|BreakStatement|CastExpression|CatchClause|CharacterLiteral|ClassInstanceCreation|CompilationUnit|ConditionalExpression|ConstructorInvocation|ContinueStatement|DoStatement|EmptyStatement|ExpressionStatement|FieldAccess|FieldDeclaration|ForStatement|IfStatement|ImportDeclaration|InfixExpression|Initializer|Javadoc|LabeledStatement|MethodDeclaration|MethodInvocation|NullLiteral|NumberLiteral|PackageDeclaration|ParenthesizedExpression|PostfixExpression|PrefixExpression|PrimitiveType|QualifiedName|ReturnStatement|SimpleName|SimpleType|SingleVariableDeclaration|StringLiteral|SuperConstructorInvocation|SuperFieldAccess|SuperMethodInvocation|SwitchCase|SwitchStatement|SynchronizedStatement|ThisExpression|ThrowStatement|TryStatement|TypeDeclaration|TypeDeclarationStatement|TypeLiteral|VariableDeclarationExpression|VariableDeclarationFragment|VariableDeclarationStatement|WhileStatement|InstanceofExpression|LineComment|BlockComment|TagElement|TextElement|MemberRef|MethodRef|MethodRefParameter|EnhancedForStatement|EnumDeclaration|EnumConstantDeclaration|TypeParameter|ParameterizedType|QualifiedType|WildcardType|NormalAnnotation|MarkerAnnotation|SingleMemberAnnotation|MemberValuePair|AnnotationTypeDeclaration|AnnotationTypeMemberDeclaration|Modifier|UnionType|Dimension|LambdaExpression|IntersectionType|NameQualifiedType|CreationReference|ExpressionMethodReference|SuperMethodReference|TypeMethodReference)@@(.*)@TO@(.*)@AT@";
-// java.util.regex.Matcher matcher;
-// if(sType.equals("53")){
-// String timeRegex = ".*@@(ClassInstanceCreation:new [a-zA-Z0-9]+).*@TO@\\s(ClassInstanceCreation:new [a-zA-Z0-9]+).*";
-// Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
-// matcher= pattern.matcher(split[1]);
-// }else {
-// String timeRegex = "@@(.*)@TO@(.*)";
-// Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
-// matcher = pattern.matcher(split[1]);
-// }
- Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
- java.util.regex.Matcher matcher = pattern.matcher(label);
-
-
- if (matcher.matches()) {
- String group = matcher.group(2);
- String group1 = matcher.group(3);
-
- String hours = matcher.group(1);
- String to = matcher.group(2);
- if(sType.equals("31")){
-
- String commonPrefix = StringUtils.getCommonPrefix(hours.trim(), to.trim());
- if(commonPrefix.isEmpty()){
- log.info("PREFIX EMPTY");
- }else {
- String s = hours.trim().replace(commonPrefix, "");
- String s1 = to.trim().replace(commonPrefix, "");
- String[] split1 = s.split(",");
- String[] split3 = s1.split(",");
- Set set = new TreeSet<>();
- for (String s2 : split1) {
- if(!s2.isEmpty()) {
- set.add(s2.trim());
- }
- }
- for (String s2 : split3) {
- if(!s2.isEmpty()) {
- set.add(s2.trim());
- }
- }
-
- List list = set.stream().collect(Collectors.toList());
- m.addAll(list);
- addToken = true;
-
- }
- }else if(sType.equals("7")){//assignment
- m.add(hours.trim().split("=")[0]);
- m.add(to.trim().split("=")[0]);
- addToken = true;
-
- }else if(sType.equals("43") && oldDescendant.getParent() != null && oldDescendant.getParent().getParent() != null){// catch clause
- if(oldDescendant.getParent().getType() == 44 && oldDescendant.getParent().getParent().getType() == 12){
- m.add(hours.trim());
- m.add(to.trim());
- addToken = true;
- }
- }else if(sType.equals("59") && oldDescendant.getChildren().size()==1 && oldDescendant.getHeight()==1 ){
- if( oldDescendant.getChild(0).getType() == 34 || oldDescendant.getChild(0).getType() == 45) {
- m.add(hours.trim().split("=")[0]);
- m.add(to.trim().split("=")[0]);
- addToken = true;
- }
- }else if(sType.equals("42") && oldDescendant.getParent() != null && oldDescendant.getParent().getType() == 27 ){//infix varuable change
-
- m.add(hours.trim());
- m.add(to.trim());
- addToken = true;
- }else if(sType.equals("40") && oldDescendant.getChildren().size()==1 && oldDescendant.getHeight()==1 ){//qualified name
-
- m.add(hours.trim());
- m.add(to.trim());
- addToken = true;
-
- }else if(sType.equals("-1") && oldDescendant.getChildren().size()==0 && oldDescendant.getHeight()==0 ){//operator
- m.add(hours.trim());
- m.add(to.trim());
- addToken = true;
- }else if(sType.equals("83") && oldDescendant.getChildren().size()==0 && oldDescendant.getHeight()==0 ){//modifier
- m.add(hours.trim());
- m.add(to.trim());
- addToken = true;
- }else if(sType.equals("39") && oldDescendant.getChildren().size()==0 && oldDescendant.getHeight()==0 ){//primitive type
- m.add(hours.trim());
- m.add(to.trim());
- addToken = true;
- }else{
- m.add(hours.trim());
- m.add(to.trim());
- }
-
- }
- }else if(label.startsWith("INS") && upd == false){
- String timeRegex ="MOV (AnonymousClassDeclaration|ArrayAccess|ArrayCreation|ArrayInitializer|ArrayType|AssertStatement|Assignment|Block|BooleanLiteral|BreakStatement|CastExpression|CatchClause|CharacterLiteral|ClassInstanceCreation|CompilationUnit|ConditionalExpression|ConstructorInvocation|ContinueStatement|DoStatement|EmptyStatement|ExpressionStatement|FieldAccess|FieldDeclaration|ForStatement|IfStatement|ImportDeclaration|InfixExpression|Initializer|Javadoc|LabeledStatement|MethodDeclaration|MethodInvocation|NullLiteral|NumberLiteral|PackageDeclaration|ParenthesizedExpression|PostfixExpression|PrefixExpression|PrimitiveType|QualifiedName|ReturnStatement|SimpleName|SimpleType|SingleVariableDeclaration|StringLiteral|SuperConstructorInvocation|SuperFieldAccess|SuperMethodInvocation|SwitchCase|SwitchStatement|SynchronizedStatement|ThisExpression|ThrowStatement|TryStatement|TypeDeclaration|TypeDeclarationStatement|TypeLiteral|VariableDeclarationExpression|VariableDeclarationFragment|VariableDeclarationStatement|WhileStatement|InstanceofExpression|LineComment|BlockComment|TagElement|TextElement|MemberRef|MethodRef|MethodRefParameter|EnhancedForStatement|EnumDeclaration|EnumConstantDeclaration|TypeParameter|ParameterizedType|QualifiedType|WildcardType|NormalAnnotation|MarkerAnnotation|SingleMemberAnnotation|MemberValuePair|AnnotationTypeDeclaration|AnnotationTypeMemberDeclaration|Modifier|UnionType|Dimension|LambdaExpression|IntersectionType|NameQualifiedType|CreationReference|ExpressionMethodReference|SuperMethodReference|TypeMethodReference)@@(.*)@TO@ (AnonymousClassDeclaration|ArrayAccess|ArrayCreation|ArrayInitializer|ArrayType|AssertStatement|Assignment|Block|BooleanLiteral|BreakStatement|CastExpression|CatchClause|CharacterLiteral|ClassInstanceCreation|CompilationUnit|ConditionalExpression|ConstructorInvocation|ContinueStatement|DoStatement|EmptyStatement|ExpressionStatement|FieldAccess|FieldDeclaration|ForStatement|IfStatement|ImportDeclaration|InfixExpression|Initializer|Javadoc|LabeledStatement|MethodDeclaration|MethodInvocation|NullLiteral|NumberLiteral|PackageDeclaration|ParenthesizedExpression|PostfixExpression|PrefixExpression|PrimitiveType|QualifiedName|ReturnStatement|SimpleName|SimpleType|SingleVariableDeclaration|StringLiteral|SuperConstructorInvocation|SuperFieldAccess|SuperMethodInvocation|SwitchCase|SwitchStatement|SynchronizedStatement|ThisExpression|ThrowStatement|TryStatement|TypeDeclaration|TypeDeclarationStatement|TypeLiteral|VariableDeclarationExpression|VariableDeclarationFragment|VariableDeclarationStatement|WhileStatement|InstanceofExpression|LineComment|BlockComment|TagElement|TextElement|MemberRef|MethodRef|MethodRefParameter|EnhancedForStatement|EnumDeclaration|EnumConstantDeclaration|TypeParameter|ParameterizedType|QualifiedType|WildcardType|NormalAnnotation|MarkerAnnotation|SingleMemberAnnotation|MemberValuePair|AnnotationTypeDeclaration|AnnotationTypeMemberDeclaration|Modifier|UnionType|Dimension|LambdaExpression|IntersectionType|NameQualifiedType|CreationReference|ExpressionMethodReference|SuperMethodReference|TypeMethodReference)@@(.*)@AT@";
-//
-// String timeRegex = "@@(.*)@TO@(.*)";
- Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
- java.util.regex.Matcher matcher = pattern.matcher(label);
-
- if (matcher.matches()) {
- String group = matcher.group(2);
- String group1 = matcher.group(4);
-
- String hours = matcher.group(1);
- if (hours.startsWith("MethodName:")) {
- String methodName = hours.split(":")[1];
- oldTokens.add(methodName);
-// }else if(sType.equals("34")){
-// oldTokens.add("NumberLiteral");
- }else {
- oldTokens.add(hours.trim());
- }
- }
-
- }else if(label.startsWith("DEL") && upd == false){
- String timeRegex = "DEL (AnonymousClassDeclaration|ArrayAccess|ArrayCreation|ArrayInitializer|ArrayType|AssertStatement|Assignment|Block|BooleanLiteral|BreakStatement|CastExpression|CatchClause|CharacterLiteral|ClassInstanceCreation|CompilationUnit|ConditionalExpression|ConstructorInvocation|ContinueStatement|DoStatement|EmptyStatement|ExpressionStatement|FieldAccess|FieldDeclaration|ForStatement|IfStatement|ImportDeclaration|InfixExpression|Initializer|Javadoc|LabeledStatement|MethodDeclaration|MethodInvocation|NullLiteral|NumberLiteral|PackageDeclaration|ParenthesizedExpression|PostfixExpression|PrefixExpression|PrimitiveType|QualifiedName|ReturnStatement|SimpleName|SimpleType|SingleVariableDeclaration|StringLiteral|SuperConstructorInvocation|SuperFieldAccess|SuperMethodInvocation|SwitchCase|SwitchStatement|SynchronizedStatement|ThisExpression|ThrowStatement|TryStatement|TypeDeclaration|TypeDeclarationStatement|TypeLiteral|VariableDeclarationExpression|VariableDeclarationFragment|VariableDeclarationStatement|WhileStatement|InstanceofExpression|LineComment|BlockComment|TagElement|TextElement|MemberRef|MethodRef|MethodRefParameter|EnhancedForStatement|EnumDeclaration|EnumConstantDeclaration|TypeParameter|ParameterizedType|QualifiedType|WildcardType|NormalAnnotation|MarkerAnnotation|SingleMemberAnnotation|MemberValuePair|AnnotationTypeDeclaration|AnnotationTypeMemberDeclaration|Modifier|UnionType|Dimension|LambdaExpression|IntersectionType|NameQualifiedType|CreationReference|ExpressionMethodReference|SuperMethodReference|TypeMethodReference)@@(.*)@AT@";
-// String timeRegex = "@@(.*)";
- Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
- java.util.regex.Matcher matcher = pattern.matcher(label);
-
- if (matcher.matches()) {
- String group = matcher.group(2);
- String hours = matcher.group(1);
- if (hours.startsWith("MethodName:")){
- String methodName = hours.split(":")[1];
- oldTokens.add(methodName);
- }else {
- oldTokens.add(hours.trim());
- }
- }
- }else if(label.startsWith("MOV") && upd == false){
- String timeRegex ="MOV (AnonymousClassDeclaration|ArrayAccess|ArrayCreation|ArrayInitializer|ArrayType|AssertStatement|Assignment|Block|BooleanLiteral|BreakStatement|CastExpression|CatchClause|CharacterLiteral|ClassInstanceCreation|CompilationUnit|ConditionalExpression|ConstructorInvocation|ContinueStatement|DoStatement|EmptyStatement|ExpressionStatement|FieldAccess|FieldDeclaration|ForStatement|IfStatement|ImportDeclaration|InfixExpression|Initializer|Javadoc|LabeledStatement|MethodDeclaration|MethodInvocation|NullLiteral|NumberLiteral|PackageDeclaration|ParenthesizedExpression|PostfixExpression|PrefixExpression|PrimitiveType|QualifiedName|ReturnStatement|SimpleName|SimpleType|SingleVariableDeclaration|StringLiteral|SuperConstructorInvocation|SuperFieldAccess|SuperMethodInvocation|SwitchCase|SwitchStatement|SynchronizedStatement|ThisExpression|ThrowStatement|TryStatement|TypeDeclaration|TypeDeclarationStatement|TypeLiteral|VariableDeclarationExpression|VariableDeclarationFragment|VariableDeclarationStatement|WhileStatement|InstanceofExpression|LineComment|BlockComment|TagElement|TextElement|MemberRef|MethodRef|MethodRefParameter|EnhancedForStatement|EnumDeclaration|EnumConstantDeclaration|TypeParameter|ParameterizedType|QualifiedType|WildcardType|NormalAnnotation|MarkerAnnotation|SingleMemberAnnotation|MemberValuePair|AnnotationTypeDeclaration|AnnotationTypeMemberDeclaration|Modifier|UnionType|Dimension|LambdaExpression|IntersectionType|NameQualifiedType|CreationReference|ExpressionMethodReference|SuperMethodReference|TypeMethodReference)@@(.*)@TO@ (AnonymousClassDeclaration|ArrayAccess|ArrayCreation|ArrayInitializer|ArrayType|AssertStatement|Assignment|Block|BooleanLiteral|BreakStatement|CastExpression|CatchClause|CharacterLiteral|ClassInstanceCreation|CompilationUnit|ConditionalExpression|ConstructorInvocation|ContinueStatement|DoStatement|EmptyStatement|ExpressionStatement|FieldAccess|FieldDeclaration|ForStatement|IfStatement|ImportDeclaration|InfixExpression|Initializer|Javadoc|LabeledStatement|MethodDeclaration|MethodInvocation|NullLiteral|NumberLiteral|PackageDeclaration|ParenthesizedExpression|PostfixExpression|PrefixExpression|PrimitiveType|QualifiedName|ReturnStatement|SimpleName|SimpleType|SingleVariableDeclaration|StringLiteral|SuperConstructorInvocation|SuperFieldAccess|SuperMethodInvocation|SwitchCase|SwitchStatement|SynchronizedStatement|ThisExpression|ThrowStatement|TryStatement|TypeDeclaration|TypeDeclarationStatement|TypeLiteral|VariableDeclarationExpression|VariableDeclarationFragment|VariableDeclarationStatement|WhileStatement|InstanceofExpression|LineComment|BlockComment|TagElement|TextElement|MemberRef|MethodRef|MethodRefParameter|EnhancedForStatement|EnumDeclaration|EnumConstantDeclaration|TypeParameter|ParameterizedType|QualifiedType|WildcardType|NormalAnnotation|MarkerAnnotation|SingleMemberAnnotation|MemberValuePair|AnnotationTypeDeclaration|AnnotationTypeMemberDeclaration|Modifier|UnionType|Dimension|LambdaExpression|IntersectionType|NameQualifiedType|CreationReference|ExpressionMethodReference|SuperMethodReference|TypeMethodReference)@@(.*)@AT@";
-// String timeRegex = "@@(.*)@TO@(.*)";
- Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
- java.util.regex.Matcher matcher = pattern.matcher(label);
-
- if (matcher.matches()) {
- String group = matcher.group(2);
- String group1 = matcher.group(4);
-
- String hours = matcher.group(1);
- if (hours.startsWith("MethodName:")){
- String methodName = hours.split(":")[1];
- oldTokens.add(methodName);
- }else {
- oldTokens.add(hours.trim());
- }
- }
- }
- boolean alreadyAddParentMethodName = false;
- for (String s : m) {
- // if(s.isEmpty()){
- // continue;
- // }
- //TODO remove 44
- if(s.startsWith("SimpleName:") || s.startsWith("Name:")){
- String methodName = s.split(":")[1];
- oldTokens.add(methodName);
- }else if (s.startsWith("MethodName:")){
- String methodName = s.split(":")[1];
- ITree parent = oldDescendant.getParent();
-
-// if(parent!= null && parent.getType() == 32 && !alreadyAddParentMethodName){ //parent is method invocation statement
-// String parentLabel = parent.getLabel();
-// String[] pns = parentLabel.split("\\." + methodName);
-// if(pns.length > 1) {
-// String parentName = pns[0];
-// String[] parentNameSplit = parentName.split("@@");
-// if (parentNameSplit.length > 1) {
-// String parentMethodName = parentNameSplit[1];
-// String s1 = parentMethodName.split("@TO@")[0];
-// oldTokens.add(s1.trim());
-// alreadyAddParentMethodName = true;
-// }
-// }
-//
-// }
- oldTokens.add(methodName);
- }else if( sType.equals("59") || sType.equals("43")|| sType.equals("53") || sType.equals("7") || sType.equals("27") || sType.equals("83") || sType.equals("44") ||sType.equals("78") || sType.equals("41") || addToken){
-// if(sType.equals("27") || sType.equals("83") || sType.equals("44")){
-// String parentLabel = oldDescendant.getParent().getLabel();
-// List parentM = new ArrayList();
-// if(parentLabel.startsWith("UPD")) {
-// upd = true;
-// String timeRegex = "@@(.*)@TO@(.*)";
-// Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
-// java.util.regex.Matcher matcher = pattern.matcher(split[1]);
-//
-// if (matcher.matches()) {
-// String hours = matcher.group(1);
-// String to = matcher.group(2);
-// parentM.add(hours.trim());
-// parentM.add(to.trim());
-//
-// }
-// }
-//
-//
-// oldTokens.add(s);
-// }else
- if(sType.equals("53") || sType.equals("78") || addToken){//sType.equals("41") ||
-
- oldTokens.add(s);
-
-
- }
-// else {
-// String s1 = s.split("=")[0];
-// oldTokens.add(s1);
-// }
- }
-// else
-// if(oldTokens.size() < 2){
-// oldTokens.add(s);
-// }
-
- }
- }
- }
-
-// if (oldTokens.size() == 0 ) {// && (oldTree.getType() != 41 && oldTree.getType() != 21 && oldTree.getType() !=17 && oldTree.getType()!=60 && oldTree.getType() != 46)){
-// log.info("!???");
-// }
- return oldTokens;
- }
-
- private static void coreCompare(String name , JedisPool jedisPool,String clusterName,JedisPool outerPool,String type) {
-
-
- try (Jedis jedis = jedisPool.getResource()) {
-
-
- Map resultMap = jedis.hgetAll(name);
-
-
-
-
- String[] split = name.split("_");
- String i = null;
- String j =null;
- try {
- i = split[1];
- j = split[2];
- }
- catch (Exception e){
- e.printStackTrace();
- }
- String firstValue = resultMap.get("0");
- String secondValue = resultMap.get("1");
-
-
- try {
- ITree oldTree = getTree(firstValue,outerPool,type);
- ITree newTree = getTree(secondValue,outerPool,type);
-
- if(oldTree == null || newTree == null) {
- jedis.select(0);
- String pairKey = "pair_" + (String.valueOf(i)) + "_" + String.valueOf(j);
- jedis.del(pairKey);
- return;
- }
-
-
-
- List oldTokens = new ArrayList<>();
- List newTokens = new ArrayList<>();
-
-
-
-
- oldTokens = getNames(oldTree,oldTokens);
- newTokens = getNames(newTree,newTokens);
-
-
- CharSequence[] oldSequences = oldTokens.toArray(new CharSequence[oldTokens.size()]);
- CharSequence[] newSequences = newTokens.toArray(new CharSequence[newTokens.size()]);
- JaroWinklerDistance jwd = new JaroWinklerDistance();
-// LevenshteinDistance ld = new LevenshteinDistance();
-
- Double overallSimi = Double.valueOf(0);
- if(oldSequences.length > 0 && (oldSequences.length == newSequences.length)){
- for (int idx = 0; idx < newSequences.length; idx++) {
- Double simi = jwd.apply(newSequences[idx], oldSequences[idx]);
- overallSimi = simi + overallSimi;
- }
- overallSimi = overallSimi / oldSequences.length;
- }else{
- overallSimi = Double.valueOf(0);
-// if(oldSequences.length != 0) {
-// log.info("ERROR");
-// }
- }
-
- int retval = Double.compare(overallSimi, Double.valueOf(0.8));
- if(retval >= 0){
-
-
- String matchKey = "match-"+clusterName+"_" + (String.valueOf(i)) + "_" + String.valueOf(j);
- String result = firstValue + "," + secondValue + ","+String.join(",", oldTokens);
- jedis.select(1);
- jedis.set(matchKey, result);
- }
- jedis.select(0);
- String pairKey = "pair_" + (String.valueOf(i)) + "_" + String.valueOf(j);
- jedis.del(pairKey);
-
-
-
- }catch (Exception e){
- log.warn(e.toString() + " {}",(name));
-
-
- }
-
-
-
-
- }
- }
-
-
- /*
- pairs of each cluster
- */
- public static void calculatePairsOfClusters(String inputPath, String outputPath,String type) {
- File folder = new File(inputPath);
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List pjs = stream
- .filter(x -> !x.getName().startsWith("."))
- .filter(x->x.isDirectory())
- .collect(Collectors.toList());
-
- FileHelper.createDirectory(outputPath + "/pairs-2l"+type);
- log.info("Calculating pairs");
- for (File pj : pjs) {
- File[] files = pj.listFiles();
- List fileList = Arrays.asList(files);
- for (File cluster:fileList) {
- if (cluster.getName().startsWith(".")){
- continue;
- }
- File[] clusterFiles = cluster.listFiles();
- List clusterFilesL = Arrays.asList(clusterFiles);
-
- readMessageFilesCluster(clusterFilesL, outputPath, inputPath, pj.getName(), cluster.getName(),type);
-
-
-
-
- }
-
- }
-
- }
-
-
-
- private static void readMessageFilesCluster(List folders, String outputPath,String inputPath,String cluster, String subCluster,String type) {
-
- List treesFileNames = new ArrayList<>();
-
-
- for (File target : folders) {
-
- treesFileNames.add(target.toString());
- }
-
-
-// treesFileNames = treesFileNames.subList(0,100);
-
- String filename = "cluster" + cluster + "_" + subCluster;
- byte [] buf = new byte[0];
- String line = null;
- try {
-
-// FileChannel rwChannel = new RandomAccessFile(outputPath + "pairs-2l/" +filename+".txt", "rw").getChannel();
-// ByteBuffer wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, 1000*treesFileNames.size()*treesFileNames.size());
-// int fileCounter = 0;
-
- FileOutputStream fos = new FileOutputStream(outputPath + "/pairs-2l"+type+"/" +filename+".csv");
- DataOutputStream outStream = new DataOutputStream(new BufferedOutputStream(fos));
-
-
-
- for (int i = 0; i < treesFileNames.size(); i++) {
- for (int j = i + 1; j < treesFileNames.size(); j++) {
-
-
-
- line = String.valueOf(i) +"," + String.valueOf(j) + "," + treesFileNames.get(i).replace(inputPath,"") + "," + treesFileNames.get(j).replace(inputPath,"")+"\n";
- outStream.write(line.getBytes());
-// buf = line.getBytes();
-// if(wrBuf.remaining() > 500) {
-// wrBuf.put(buf);
-// }else{
-// log.info("Next pair dump");
-// fileCounter++;
-// rwChannel = new RandomAccessFile(outputPath+"pairs/" +filename+String.valueOf(fileCounter)+".txt", "rw").getChannel();
-// wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, Integer.MAX_VALUE);
-// }
-
-
-
-
- }
- }
- outStream.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }catch (java.nio.BufferOverflowException e) {
- log.error(line);
- log.error(String.valueOf(buf.length));
- e.printStackTrace();
- }
-
- log.info("Done pairs of {}",filename);
- }
-
-
-
-}
-
-
-
-
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/PatternExtractor.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/PatternExtractor.java
deleted file mode 100755
index 7c7d3bc..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/PatternExtractor.java
+++ /dev/null
@@ -1,379 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import edu.lu.uni.serval.fixminer.akka.ediff.HierarchicalActionSet;
-import edu.lu.uni.serval.utils.Checker;
-import edu.lu.uni.serval.utils.EDiffHelper;
-import edu.lu.uni.serval.utils.PoolBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-
-import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-
-/**
- * Created by anilkoyuncu on 02/08/2018.
- */
-public class PatternExtractor {
- private static Logger log = LoggerFactory.getLogger(PatternExtractor.class);
-
-
- public static void mainLaunch(String portInner,String numOfWorkers,String jobType,String port, String pythonPath, String datasetPath, String pjName, String actionType,String threshold) {
-
-
- String dbDir;
- String pairsPath;
- String dumpsName;
- String gumInput;
- String gumOutput;
-
- gumInput = datasetPath + "/" + pjName + "/";
- gumOutput = datasetPath + "/EnhancedASTDiff" + pjName;
- dbDir = datasetPath + "/redis";
- pairsPath = datasetPath + "/pairsImport" + pjName;
- dumpsName = "dumps-" + pjName + ".rdb";
-
- try {
-
-
-
- String IDLIST_PATH =pythonPath + "/defects4jpatterns.txt";
-
- List fixes = readIdList(IDLIST_PATH);
-
- switch (jobType) {
- case "EXTRACTPATTERN":
- loadDB(gumOutput, portInner, dbDir, actionType+dumpsName,actionType,fixes);
- break;
- case "GETPATTERN":
- getPattern(fixes,actionType);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
-
- public static void loadDB(String inputPath,String portInner,String dbDir,String chunkName,String operation,List fixes) throws Exception {
-
-
- JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(6399),20000000);
-
-
-
- String clusterPath = "/Users/anilkoyuncu/bugStudy/release/code/clusterallDataset"+operation+"/";
- String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps"+operation+"/";
- File patternsF = new File(clusterPath);
- File[] listOfPatterns = patternsF.listFiles();
- Stream patterns = Arrays.stream(listOfPatterns);
- List patternsL = patterns
- .filter(x -> !x.getName().startsWith("."))
-// .filter(x-> x.getName().endsWith(".git"))
- .collect(Collectors.toList());
-
-
- for (File pattern:patternsL) {
- File folder = new File(clusterPath + pattern.getName());
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List patches = stream
- .filter(x -> !x.getName().startsWith("."))
-// .filter(x-> x.getName().endsWith(".git"))
- .collect(Collectors.toList());
-
- for (File patch : patches) {
- String fn = patch.getName();
- String[] split = fn.split("_");
- String project = split[split.length -1];
- List list = new ArrayList(Arrays.asList(split));
- list.remove(list.size() - 1);
- String joinFN = String.join("_", list);
- fn = project + "/" + operation + "/" + joinFN;
- String saveFN = pattern.getName() + "_"+ project + "_" + operation + "_" + joinFN;
- Jedis inner = null;
- String s = null;
- try {
- inner = outerPool.getResource();
- s = inner.get(fn);
- if (s != null) {
-
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(s);
-
-
- BufferedWriter writer = new BufferedWriter(new FileWriter(savePath+saveFN));
- writer.write(EDiffHelper.toString(actionSet));
-
- writer.close();
-
-
-
-
-
- }else{
- log.error(fn);
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (inner != null) {
- inner.close();
- }
- }
-
-
-
-
-
-
- }
-
- }
-
-
-
-
-
- }
-
- public static void getPattern(List fixes,String operation){
-
- String clusterPath = "/Users/anilkoyuncu/bugStudy/release/dataset/output/clusterallDatasetUPD/";
-// String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps/";
- String savePath = "/Volumes/anil.koyuncu/dumps/";
-
- File patternsF = new File(clusterPath);
- File[] listOfPatterns = patternsF.listFiles();
- Stream patterns = Arrays.stream(listOfPatterns);
- List patternsL = patterns
- .filter(x -> !x.getName().startsWith("."))
-// .filter(x -> !x.getName().endsWith(".git"))
- .collect(Collectors.toList());
-
- for (File pattern:patternsL) {
- File folder = new File(clusterPath + pattern.getName());
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List patches = stream
- .filter(x -> !x.getName().startsWith("."))
- .filter(x -> !x.getName().endsWith(".git"))
- .collect(Collectors.toList());
-
- for (File patch : patches) {
- String fn = patch.getName();
- String[] split = fn.split("_");
- String project = split[split.length - 1];
- List list = new ArrayList(Arrays.asList(split));
- list.remove(list.size() - 1);
- String joinFN = String.join("_", list);
- fn = project + "/" + operation + "/" + joinFN;
- String saveFN = pattern.getName() + "_" + project + "_" + operation + "_" + joinFN;
- try{
- String content = new String(Files.readAllBytes(Paths.get(savePath + saveFN)));
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(content);
-
- int astType = actionSet.getNode().getType();
- if (Checker.isStatement(astType) || astType == 23 //FieldDeclaration
- || astType == 31 //MethodDeclaration
- || astType == 55) {//TypeDeclaration
- System.out.println(actionSet);
-// ITree actionTree = MultiThreadTreeLoader.getActionTree(actionSet, null, null);
-// ITree simpliedTree = getSimpliedTree(actionSet);
-// System.out.println(new TreeToString().toString(simpliedTree));
-// System.out.println(new TreeToString().toString(actionTree));
- System.out.println("======");
- }
-
-//
-// ITree simpliedTree = getSimpliedTree(actionSet);
-// simpliedTree.toString();
-// ITree simpliedTree = getSimpliedTree(actionSet);
-//
-// List oldTokens = new ArrayList<>();
-// List newTokens = new ArrayList<>();
-// if(secondValue.startsWith("/2/")){
-// log.info("newss");
-// }
-// // 41 return statement
-// oldTokens = getNames(actionSet.getNode(),oldTokens);
-//
-// simpliedTree.toString();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
- System.out.println("============");
- }
- }
-
-// public static ITree getSimpliedTree(HierarchicalActionSet actionSet) {
-//
-// ITree tree = null;
-// Jedis inner = null;
-// try {
-//
-// ITree parent = null;
-// ITree children = null;
-// TreeContext tc = new TreeContext();
-// tree = getASTTree(actionSet, parent, children, tc);
-//// tree.setParent(null);
-// tc.validate();
-//
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// return tree;
-// }
-
-
-
-
-
-
- public static List readIdList(String fileName) {
- try {
- BufferedReader reader = new BufferedReader(new FileReader(new File(fileName)));
-
- // n = Rownum ; m = Colnum
- List fixCommits = new ArrayList();
- String line = reader.readLine();
-
- int i = 0, j = 0;
- while (line != null) {
- String strArray[] = line.split("\t");
-
- if (!line.trim().isEmpty()) {
-
-// GitTravellerDefects4J.FixCommit test = new GitTravellerDefects4J.FixCommit(strArray[1],strArray[0]);
- fixCommits.add(strArray[0]);
-// for (String s : strArray) {
-// if (!s.trim().isEmpty()) {
-// FixCommit test = new FixCommit("","");
-// array[i][j++] = s;
-// }
-// }
- line = reader.readLine();
-// i++;
-// j = 0;
- }
- }
- reader.close();
- return fixCommits;
- } catch (IOException ex) {
- System.out.println("Problems..");
- }
- return null;
- }
-
-
-
- public static class ProjectLiteral {
-
-
- private String name;
- private String file;
- private String packageName;
- private String className;
- private String extend;
- private String[] StringLit;
- private String[] NumLit;
- private String[] memberReference;
- private String[] methodInvocation;
-
-
-
-
-
-// pj, file, p['packageName'], p['className'],
-// p['extends'], p['StringLiteral'], p['NumberLiteral']
- ProjectLiteral(){}
-
- ProjectLiteral(String name, String file,String packageName, String className,String extend, String sLit, String nLit, String mr ,String mi) {
- this.name = name;
- this.file = file;
- this.packageName = packageName;
- this.className = className;
- this.extend = extend;
- this.StringLit = sLit.split(";");
- this.NumLit = nLit.split(";");
- this.memberReference = mr.split(";");
- this.methodInvocation = nLit.split(";");
-
-
- }
-// projectLiterals.stream().filter(x->x.className.equals("XYTitleAnnotation")).collect(Collectors.toList())
-
-
- }
-
-
- public static void main(String[] args) throws IOException {
- List projectLiterals = readProjectCSV("/Users/anilkoyuncu/bugStudy/code/python/chart.csv");
- System.out.print("");
- }
-
- public static List readProjectCSV(String fileName) {
- try {
- BufferedReader reader = new BufferedReader(new FileReader(new File(fileName)));
-
- // n = Rownum ; m = Colnum
- List fixCommits = new ArrayList();
- String line = reader.readLine();
-
- int i = 0, j = 0;
- while (line != null) {
- String strArray[] = line.split("\t");
-
- if (!line.trim().isEmpty()) {
- log.info(String.valueOf(strArray.length));
- ProjectLiteral a = new ProjectLiteral();
- if (strArray.length == 10) {
- a = new ProjectLiteral(strArray[1], strArray[2], strArray[3], strArray[4], strArray[5], strArray[6], strArray[7],strArray[8],strArray[9]);
- }else if (strArray.length == 9) {
- a = new ProjectLiteral(strArray[1], strArray[2], strArray[3], strArray[4], strArray[5], strArray[6], strArray[7],strArray[8],"");
- }else if (strArray.length == 8) {
- a = new ProjectLiteral(strArray[1], strArray[2], strArray[3], strArray[4], strArray[5], strArray[6], strArray[7],"","");
- }else if(strArray.length == 7){
- a = new ProjectLiteral(strArray[1], strArray[2], strArray[3], strArray[4], strArray[5], strArray[6], "","","");
- }else if(strArray.length == 6){
- a = new ProjectLiteral(strArray[1], strArray[2], strArray[3], strArray[4], strArray[5], "", "","","");
-
- }else if(strArray.length == 5){
- a = new ProjectLiteral(strArray[1], strArray[2], strArray[3], strArray[4], "", "", "","","");
- }else if(strArray.length == 4){
- a = new ProjectLiteral(strArray[1], strArray[2], strArray[3], "", "", "", "","","");
- }
- else{
- log.error("error");
- }
-
-// GitTravellerDefects4J.FixCommit test = new GitTravellerDefects4J.FixCommit(strArray[1],strArray[0]);
- fixCommits.add(a);
-// for (String s : strArray) {
-// if (!s.trim().isEmpty()) {
-// FixCommit test = new FixCommit("","");
-// array[i][j++] = s;
-// }
-// }
- line = reader.readLine();
-// i++;
-// j = 0;
- }
- }
- reader.close();
- return fixCommits;
- } catch (IOException ex) {
- System.out.println("Problems..");
- }
- return null;
- }
-}
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/StoreEDiffInCache.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/StoreEDiffInCache.java
deleted file mode 100755
index ccd523a..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/StoreEDiffInCache.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import edu.lu.uni.serval.fixminer.akka.ediff.HierarchicalActionSet;
-import edu.lu.uni.serval.utils.CallShell;
-import edu.lu.uni.serval.utils.EDiffHelper;
-import edu.lu.uni.serval.utils.PoolBuilder;
-import org.redisson.Redisson;
-import org.redisson.api.RedissonClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-
-/**
- * Created by anilkoyuncu on 03/04/2018.
- */
-public class StoreEDiffInCache {
-
- private static Logger log = LoggerFactory.getLogger(StoreEDiffInCache.class);
-
-
- public static void main(String inputPath,String portInner,String dbDir,String chunkName) throws Exception {
-
- String parameters = String.format("\nInput path %s \nportInner %s \nchunkName %s \ndbDir %s \noperation %s",inputPath,portInner,chunkName,dbDir);
- log.info(parameters);
- CallShell cs = new CallShell();
- String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
- cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(portInner));
-
- cs.runShell(cmd, portInner);
-
- File folder = new File(inputPath);
- File[] subFolders = folder.listFiles();
- Stream stream = Arrays.stream(subFolders);
- List roots = stream
- .filter(x -> !x.getName().startsWith("."))
- .collect(Collectors.toList());
- List workList = new ArrayList();
- File[] dumps;
- for (File root : roots) {
- String pjName = root.getName();
- File[] sizes = root.listFiles();
- Stream sizesStream = Arrays.stream(sizes);
- List sizeFolders = sizesStream
- .filter(x -> !x.getName().startsWith("."))
- .collect(Collectors.toList());
-
- for (File sf:sizeFolders){
- File[] files = sf.listFiles();
- int length = files.length;
- if (length == 1)
- continue;
-
- Stream fileStream = Arrays.stream(files);
- List fs;
- // if (operation.equals("ALLOP")){
- // fs= fileStream
- // .filter(x -> x.getName().startsWith("UPD") ||
- // x.getName().startsWith("INS") ||
- // x.getName().startsWith("DEL") ||
- // x.getName().startsWith("MOV"))
- // .collect(Collectors.toList());
- // File[] files1 = fs.get(0).listFiles();
- // File[] files2 = fs.get(1).listFiles();
- // File[] files3 = fs.get(2).listFiles();
- // File[] files4 = fs.get(3).listFiles();
- // dumps = Stream.of(files1, files2, files3,files4).flatMap(Stream::of).toArray(File[]::new);
- // }else{
-// fs = fileStream
-// .filter(x -> x.getName().startsWith(operation))
-// .collect(Collectors.toList());
-// dumps = fs.get(0).listFiles();
- // }
-
-
- for (File f : files) {
- String name = f.getName();
-
- String key = pjName + "/"+ sf.getName()+"/" + name;
- String result = key +","+f.getPath();
- workList.add(result);
- }
-
- }
-
- }
- log.info(String.valueOf(workList.size()));
-
- JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
-
- workList.stream().parallel()
- .forEach(m -> storeCore(innerPool, m.split(",")[1],m.split(",")[0]));
-
- log.info(parameters);
-
- String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
- String stopServer2 = String.format(stopServer,Integer.valueOf(portInner));
-
- cs.runShell(stopServer2, portInner);
- }
-
-
-
- public static void storeCore(JedisPool innerPool,String path,String key){
- try {
-
-
-
-
-
- HierarchicalActionSet actionSet = null;
-
- try {
- FileInputStream fi = new FileInputStream(new File(path));
- ObjectInputStream oi = new ObjectInputStream(fi);
- actionSet = (HierarchicalActionSet) oi.readObject();
- oi.close();
- fi.close();
-
-
- } catch (FileNotFoundException e) {
- log.error("File not found {}" , path);
- e.printStackTrace();
- } catch (IOException e) {
- log.error("Error initializing stream {}", path);
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- try (Jedis inner = innerPool.getResource()) {
-
- inner.set(key.getBytes(), EDiffHelper.toByteArray(actionSet));
- }
-
-
- } catch (FileNotFoundException e) {
- log.error("File not found");
- e.printStackTrace();
- } catch (IOException e) {
- log.error("Error initializing stream");
- e.printStackTrace();
- }
- }
-
-
-
-
-
- }
diff --git a/src/main/java/edu/lu/uni/serval/fixminer/jobs/TreeLoaderClusterL1.java b/src/main/java/edu/lu/uni/serval/fixminer/jobs/TreeLoaderClusterL1.java
deleted file mode 100755
index 3c0818f..0000000
--- a/src/main/java/edu/lu/uni/serval/fixminer/jobs/TreeLoaderClusterL1.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package edu.lu.uni.serval.fixminer.jobs;
-
-import edu.lu.uni.serval.utils.CallShell;
-import edu.lu.uni.serval.utils.PoolBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-import redis.clients.jedis.ScanParams;
-import redis.clients.jedis.ScanResult;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Created by anilkoyuncu on 19/03/2018.
- */
-public class TreeLoaderClusterL1 {
-
- private static Logger log = LoggerFactory.getLogger(TreeLoaderClusterL1.class);
-
- public static void main(String portInner,String port,String inputPath,String level1DB,String level1Path,String innerTypePrefix,int cursor) throws Exception {
-
-
-
- String parameters = String.format("\nInput path %s \nportInner %s \nport %s",inputPath,portInner,port);
- log.info(parameters);
-
- String cmd = "bash "+inputPath + "/" + "startServer.sh" +" %s %s %s";
- cmd = String.format(cmd, inputPath,level1DB,Integer.valueOf(port));
-
- CallShell cs = new CallShell();
- cs.runShell(cmd, port);
- JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(port),20000000);
-
-
- File chunks = new File(level1Path);
- File[] listFiles = chunks.listFiles();
- Stream stream = Arrays.stream(listFiles);
- List dbs = stream
- .filter(x -> x.getName().endsWith(".rdb"))
- .filter(x-> x.getName().startsWith(innerTypePrefix))
- .collect(Collectors.toList());
- for (File db : dbs) {
- String cmdInner = "bash "+inputPath + "/" + "startServer.sh" +" %s %s %s";
- cmdInner = String.format(cmdInner, inputPath,db.getName(),Integer.valueOf(portInner));
-
- cs.runShell(cmdInner, port);
- JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
-
- Jedis inner = null;
-
- try {
- inner = innerPool.getResource();
-
- inner.select(1);
- ScanParams sc = new ScanParams();
- //150000000
- sc.count(cursor);
- sc.match("match_[0-9]*");
-
- ScanResult scan; scan = inner.scan("0", sc);
- int size = scan.getResult().size();
- log.info("Scanning " + String.valueOf(size));
-
- List result = scan.getResult();
-
- for (String key : result) {
- String value = inner.get(key);
- Jedis outer = null;
- try {
- outer = outerPool.getResource();
- outer.set(key,value);
- } catch (Exception e) {
- log.error(e.toString() + " {}", (key));
-
-
- }finally {
- if (outer != null) {
- outer.close();
- }
- }
-
-
- }
-
-
- } catch (Exception e) {
- log.error(e.toString() + " {}", (db.getName()));
-
-
- }finally {
- if (inner != null) {
- inner.close();
- }
- innerPool.close();
- }
-
- String stopServer = "bash "+inputPath + "/" + "stopServer.sh" +" %s";
- stopServer = String.format(stopServer,Integer.valueOf(portInner));
-
- cs.runShell(stopServer, port);
- }
-
- String stopServer1 = "bash "+inputPath + "/" + "stopServer.sh" +" %s";
- stopServer1 = String.format(stopServer1,Integer.valueOf(port));
-
- cs.runShell(stopServer1, port);
-
-
-
-
- }
-
-
-
-}
-
-
-
-
diff --git a/src/main/java/edu/lu/uni/serval/utils/CallShell.java b/src/main/java/edu/lu/uni/serval/utils/CallShell.java
index 6b70789..6721ef4 100755
--- a/src/main/java/edu/lu/uni/serval/utils/CallShell.java
+++ b/src/main/java/edu/lu/uni/serval/utils/CallShell.java
@@ -32,14 +32,15 @@ public class CallShell {
public static void runShell(String command, String port) throws Exception {
- log.info(command);
+ log.trace(command);
Process process = Runtime.getRuntime().exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String s;
while ((s = reader.readLine()) != null) {
- System.out.println("Script output: " + s);
+// System.out.println("Script output: " + s);
+ log.trace("Script output: " + s);
}
// Thread.sleep(Integer.valueOf(serverWait));
@@ -72,7 +73,8 @@ try{
s = reader.readLine();
if(s !=null && s.equals("PONG")){
- System.out.println(s);
+// System.out.println(s);
+ log.trace(s);
}else{
String e;
diff --git a/src/main/java/edu/lu/uni/serval/utils/Checker.java b/src/main/java/edu/lu/uni/serval/utils/Checker.java
deleted file mode 100755
index 89752fa..0000000
--- a/src/main/java/edu/lu/uni/serval/utils/Checker.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package edu.lu.uni.serval.utils;
-
-public class Checker {
-
- public static boolean containsBodyBlock(String statementType) {
- if ("EnhancedForStatement".equals(statementType) || "ForStatement".equals(statementType)
- || "DoStatement".equals(statementType) || "WhileStatement".equals(statementType)
- || "LabeledStatement".equals(statementType) || "SynchronizedStatement".equals(statementType)
- || "IfStatement".equals(statementType) || "TryStatement".equals(statementType) || "SwitchStatement".equals(statementType)) {
- return true;
- }
- return false;
- }
-
- public static boolean isExpressionType(String astNode) {
- if (astNode.equals("ArrayAccess") || astNode.equals("ArrayCreation") ||
- astNode.equals("ArrayInitializer") || astNode.equals("Assignment") || astNode.equals("CastExpression") ||
- astNode.equals("ClassInstanceCreation") || astNode.equals("ConditionalExpression") || astNode.equals("CreationReference") ||
- astNode.equals("ExpressionMethodReference") || astNode.equals("FieldAccess") || astNode.equals("InfixExpression") ||
- astNode.equals("InstanceofExpression") || astNode.equals("LambdaExpression") || astNode.equals("MethodInvocation") ||
- astNode.equals("MethodReference") || astNode.equals("ParenthesizedExpression") || astNode.equals("PostfixExpression") ||
- astNode.equals("PrefixExpression") || astNode.equals("SuperFieldAccess") || astNode.equals("SuperMethodInvocation") ||
- astNode.equals("SuperMethodReference") || astNode.equals("TypeLiteral") || astNode.equals("TypeMethodReference")
- || astNode.equals("VariableDeclarationExpression") ) {
- return true;
- }
- return false;
- }
-
- public static boolean withBlockStatement(int type) {
- if (type == 19) return true; // DoStatement
- if (type == 24) return true; // ForStatement
- if (type == 25) return true; // IfStatement
- if (type == 30) return true; // LabeledStatement
- if (type == 50) return true; // SwitchStatement
- if (type == 51) return true; // SynchronizedStatement
- if (type == 54) return true; // TryStatement
- if (type == 61) return true; // WhileStatement
- if (type == 70) return true; // EnhancedForStatement
- return false;
- }
-
- public static boolean isStatement(int type) {
- if (type == 6) return true; // AssertStatement
- if (type == 10) return true; // BreakStatement
- if (type == 17) return true; // ConstructorInvocation
- if (type == 18) return true; // ContinueStatement
- if (type == 21) return true; // ExpressionStatement
- if (type == 41) return true; // ReturnStatement
- if (type == 46) return true; // SuperConstructorInvocation
- if (type == 49) return true; // SwitchCase
- if (type == 53) return true; // ThrowStatement
- if (type == 56) return true; // TypeDeclarationStatement
- if (type == 60) return true; // VariableDeclarationStatement
- return withBlockStatement(type);
- }
-
- public static boolean isStatement2(int type) {
- if (type == 8) return true; // block
- if (type == 12) return true; // CatchClause
- return isStatement(type);
- }
-}
diff --git a/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java b/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
index 4b095a4..52aea0f 100755
--- a/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
+++ b/src/main/java/edu/lu/uni/serval/utils/ClusterToPattern.java
@@ -1,143 +1,51 @@
package edu.lu.uni.serval.utils;
-import com.github.gumtreediff.tree.ITree;
-import com.github.gumtreediff.tree.TreeContext;
import edu.lu.uni.serval.fixminer.akka.ediff.HierarchicalActionSet;
-import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
-import java.io.*;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
public class ClusterToPattern {
+ private static Logger log = LoggerFactory.getLogger(ClusterToPattern.class);
- public static void main(String[] args) throws IOException, ClassNotFoundException {
- String shapesFolder = "/Users/anil.koyuncu/projects/fixminer-all/enhancedASTDiff/python/data/shapes";
+ public static void main(String port,String redisPath, String dumpsName, String parameter) throws Exception {
- String port = "6399";
-// JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(port),20000000);
- Jedis jedis = new Jedis("127.0.0.1",Integer.valueOf(port),20000000);
-// writeTofFile(shapesFolder, outerPool);
-
-// File file = new File(shapesFolder);
-//
-//
-// File[] files = file.listFiles();
-// ArrayList strings = new ArrayList<>();
-// List folders = Arrays.stream(files).filter(x -> x.isDirectory())
-// .collect(Collectors.toList());
-// for (File target : folders) {
-// File[] files2 = target.listFiles();
-// for (File file1 : files2) {
-// File[] files1 = file1.listFiles();
-// strings.add(((File)files1[0]).listFiles()[0].getName());
-//// System.out.println();
-//
-// }
-//
-//// Collection files1 = FileUtils.listFiles(target, null, true);
-//
-// }
-//
-// for (String string : strings) {
-// export("*"+string,jedis);
-// }
-
-// String export = export("VariableDeclarationStatement"+"/*/camel_8f0c15_ab3e17_camel-core#src#main#java#org#apache#camel#component#bean#BeanInfo.txt_0", jedis);
- String export = export(args[0], jedis);
+ CallShell cs = new CallShell();
+ String cmd = "bash "+redisPath + "/" + "startServer.sh" +" %s %s %s";
+ cmd = String.format(cmd, redisPath,dumpsName,Integer.valueOf(port));
+ log.trace(cmd);
+ cs.runShell(cmd, port);
+ String host = "localhost";//args[5];
+ final JedisPool outerPool = new JedisPool(PoolBuilder.getPoolConfig(), host,Integer.valueOf(port),20000000);
+ String export = export(parameter, outerPool);
System.out.println(export);
}
- private static String export(String filename,Jedis outer) throws IOException, ClassNotFoundException {
-
-// String key = shape.getName() + "/*/" + file.getName();
-// Jedis outer = outerPool.getResource();
- String s = null;//inner.get(prefix.replace("-","/") +"/"+dist2load);
- Set keys = outer.keys(filename);
- if (keys.size() == 1) {
- s = (String) keys.toArray()[0];
- } else {
- throw new Error("cok key");
- }
-
- byte[] si = outer.get(s.getBytes());
-// HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromByteArray(si);
-// ITree tree = null;
-// ITree parent = null;
-// ITree children =null;
-// TreeContext tc = new TreeContext();
-// tree = EDiffHelper.getASTTree(actionSet, parent, children,tc);
-// tree.setParent(null);
-// tc.validate();
-//
-// String s2 = tree.toStaticHashString();
-// try(FileWriter fw = new FileWriter("myfile.txt", true);
-// BufferedWriter bw = new BufferedWriter(fw);
-// PrintWriter out = new PrintWriter(bw))
-// {
-// out.println(s2);
-// //more code
-// } catch (IOException e) {
-// //exception handling left as an exercise for the reader
-// }
-
- String s1 = actionSet.toString();
- outer.close();
- return s1;
- }
-
-
- private static void writeTofFile(String shapesFolder, JedisPool outerPool) throws IOException, ClassNotFoundException {
- File folder = new File(shapesFolder);
-
- File[] listOfFiles = folder.listFiles();
- Stream stream = Arrays.stream(listOfFiles);
- List shapes = stream
- .filter(x -> !x.getName().startsWith("."))
- .filter(x -> !x.getName().endsWith(".pickle"))
- .collect(Collectors.toList());
- for(File shape:shapes){
- File[] clusters = shape.listFiles();
- Stream fileStream = Arrays.stream(clusters);
- List fileList = fileStream.filter(x -> !x.getName().startsWith("."))
- .collect(Collectors.toList());
- for(File cluster:fileList){
- File[] files = cluster.listFiles();
-// for (File f:files) {
-// File file = f.listFiles()[0];
- File file = files[0];
- String key = shape.getName() + "/*/" + file.getName();
- Jedis outer = outerPool.getResource();
- String s = null;//inner.get(prefix.replace("-","/") +"/"+dist2load);
- Set keys = outer.keys(key);
- if (keys.size() == 1) {
- s = (String) keys.toArray()[0];
- } else {
- throw new Error("cok key");
- }
-
- String si = outer.get(s);
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
-
-
- String s1 = actionSet.toString();
-// File saveFile = new File(folder.getParent() + "/actionPatterns/" + shape.getName() + "/" + cluster.getName() +"/"+f.getName()+ ".pattern");
- File saveFile = new File(folder.getParent() + "/shapePatterns/" + shape.getName() + "/" + cluster.getName() + ".pattern");
- saveFile.getParentFile().mkdirs();
- BufferedWriter writer = new BufferedWriter(new FileWriter(saveFile));
- writer.write(s1);
-
- writer.close();
-// }
-
+ private static String export(String filename,JedisPool outerPool){
+ try (Jedis outer = outerPool.getResource()) {
+ while (!outer.ping().equals("PONG")) {
+ log.info("wait");
}
-
+ byte[] s = outer.hget("dump".getBytes(), filename.getBytes());
+ HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
+ if (actionSet == null){
+ throw new Error(filename +" not found");
+ }
+ String s1 = actionSet.toString();
+// outer.close();
+ return s1;
}
+
+
+
+
+
+
}
+
+
}
diff --git a/src/main/java/edu/lu/uni/serval/utils/EDiffHelper.java b/src/main/java/edu/lu/uni/serval/utils/EDiffHelper.java
index df95124..03b63aa 100755
--- a/src/main/java/edu/lu/uni/serval/utils/EDiffHelper.java
+++ b/src/main/java/edu/lu/uni/serval/utils/EDiffHelper.java
@@ -4,12 +4,14 @@ import com.github.gumtreediff.actions.model.*;
import com.github.gumtreediff.tree.ITree;
import com.github.gumtreediff.tree.TreeContext;
import com.github.gumtreediff.tree.TreeUtils;
+import edu.lu.uni.serval.fixminer.akka.ediff.DefaultKryoContext;
import edu.lu.uni.serval.fixminer.akka.ediff.HierarchicalActionSet;
+import edu.lu.uni.serval.fixminer.akka.ediff.KryoContext;
+import org.javatuples.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
-import org.javatuples.Pair;
import java.io.*;
import java.util.*;
@@ -61,6 +63,17 @@ public class EDiffHelper {
return baos.toByteArray();
}
+
+ public static byte[] kryoSerialize(Serializable o ){
+ KryoContext kryoContext = DefaultKryoContext.newKryoContextFactory();
+ return kryoContext.serialze(o);
+ }
+
+ public static Object kryoDeseerialize(byte[] data ){
+ KryoContext kryoContext = DefaultKryoContext.newKryoContextFactory();
+ return kryoContext.deserialze(HierarchicalActionSet.class,data);
+ }
+
public static ITree getTokenTree(HierarchicalActionSet actionSet, ITree parent, ITree children,TreeContext tc){
int newType = 0;
@@ -245,25 +258,21 @@ public class EDiffHelper {
}
- public static ITree getShapes(String prefix, String fn, JedisPool outerPool,JedisPool innerPool) {
+ public static ITree getShapes(String prefix, String fn, JedisPool outerPool, HashMap filenames) {
ITree tree = null;
-// Jedis inner = null;
-// Jedis outer = null;
- try (Jedis inner = innerPool.getResource(); Jedis outer = outerPool.getResource()) {
-// inner = innerPool.getResource();
+
+ try (Jedis outer = outerPool.getResource()) {
try {
- while (!inner.ping().equals("PONG")) {
+ while (!outer.ping().equals("PONG")) {
log.info("wait");
}
- inner.select(1);
- String dist2load = inner.get(prefix + "-" + fn);
+ String dist2load = filenames.get(prefix + "-" + fn);
-// outer = outerPool.getResource();
- outer.select(0);
String key = prefix.replace("-", "/") + "/" + dist2load;
- byte[] s = outer.get(key.getBytes());
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromByteArray(s);
+
+ byte[] s = outer.hget("dump".getBytes(), key.getBytes());
+ HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
ITree parent = null;
ITree children = null;
@@ -272,70 +281,10 @@ public class EDiffHelper {
//tree.setParent(null);
tc.validate();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
-// finally {
-// if (inner != null) {
-// inner.close();
-// }
-// if (outer != null) {
-// outer.close();
-// }
-// }
- return tree;
-
- }
-
-
- public static ITree getTargets(String prefix, String fn, JedisPool outerPool,JedisPool innerPool) {
-
- ITree tree = null;
-// Jedis inner = null;
-// Jedis outer = null;
- try {
- String dist2load = null;
- String si = null;
- try(Jedis inner = innerPool.getResource()){
- inner.select(1);
- dist2load = inner.get(prefix+"-"+fn);
-
- }
-// while (!inner.ping().equals("PONG")){
-// log.info("wait");
-// }
- try(Jedis outer = outerPool.getResource()){
- outer.select(0);
- String s = null;
- Set keys = outer.keys(prefix.split("-")[0] + "/*/" + dist2load);
- if (keys.size() == 1) {
- s = (String) keys.toArray()[0];
- } else {
- throw new Error("cok key");
- }
- si = outer.get(s);
-
- }
-
-
-// String filename = project + "/"+type+"/" + pureFileName + ".txt_" + actionSetPosition;
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
-
- ITree parent = null;
- ITree children =null;
- TreeContext tc = new TreeContext();
- tree = EDiffHelper.getTargetTree(actionSet, parent, children,tc);
- //tree.setParent(null);
- tc.validate();
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
return tree;
}
@@ -344,35 +293,7 @@ public class EDiffHelper {
public static ITree getTargets(HierarchicalActionSet actionSet) {
ITree tree = null;
-// Jedis inner = null;
-// Jedis outer = null;
try {
-// String dist2load = null;
-// String si = null;
-// try(Jedis inner = innerPool.getResource()){
-// inner.select(1);
-// dist2load = inner.get(prefix+"-"+fn);
-//
-// }
-//// while (!inner.ping().equals("PONG")){
-//// log.info("wait");
-//// }
-// try(Jedis outer = outerPool.getResource()){
-// outer.select(0);
-// String s = null;
-// Set keys = outer.keys(prefix.split("-")[0] + "/*/" + dist2load);
-// if (keys.size() == 1) {
-// s = (String) keys.toArray()[0];
-// } else {
-// throw new Error("cok key");
-// }
-// si = outer.get(s);
-//
-// }
-//
-//
-//// String filename = project + "/"+type+"/" + pureFileName + ".txt_" + actionSetPosition;
-// HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
ITree parent = null;
ITree children =null;
@@ -383,69 +304,47 @@ public class EDiffHelper {
} catch (Exception e) {
e.printStackTrace();
}
-//
-// } catch (IOException e) {
-// e.printStackTrace();
-// } catch (ClassNotFoundException e) {
-// e.printStackTrace();
-// }
return tree;
}
- public static Pair getActions(String prefix,String firstValue, JedisPool outerPool,JedisPool innerPool) {
+ public static Pair getActions(String prefix, String fn, JedisPool outerPool, HashMap filenames) {
ITree tree = null;
-// Jedis inner = null;
-// Jedis outer = null;
HierarchicalActionSet actionSet = null;
- try {
- String dist2load = null;
- byte[] si = null;
- try (Jedis inner = innerPool.getResource();Jedis outer = outerPool.getResource()){
+ try (Jedis outer = outerPool.getResource()) {
+ try {
+ while (!outer.ping().equals("PONG")) {
+ log.info("wait");
+ }
- inner.select(1);
- dist2load = inner.get(prefix + "-" + firstValue);
- outer.select(0);
+ String dist2load = filenames.get(prefix + "-" + fn);
+
String[] split = prefix.split("-");
- String s = null;//inner.get(prefix.replace("-","/") +"/"+dist2load);
-// Set keys = outer.keys(split[0] + "/"+split[1]+"/" + dist2load);
String key = split[0] + "/"+split[1]+"/" + dist2load;
-// if (keys.size() == 1) {
-// s = (String) keys.toArray()[0];
-// } else {
-// throw new Error("cok key");
-// }
- si = outer.get(key.getBytes());
-// String key = prefix.replace("-", "/") + "/" + dist2load;
-// byte[] s = outer.get(key.getBytes());
- actionSet = (HierarchicalActionSet) EDiffHelper.fromByteArray(si);
+ byte[] s = outer.hget("dump".getBytes(), key.getBytes());
+ actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
-// String filename = project + "/"+type+"/" + pureFileName + ".txt_" + actionSetPosition;
-// actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
+
+ ITree parent = null;
+ ITree children = null;
+ TreeContext tc = new TreeContext();
+ tree = EDiffHelper.getActionTree(actionSet, parent, children, tc);
+ //tree.setParent(null);
+ tc.validate();
+ }catch (Exception e) {
+ e.printStackTrace();
}
-
- ITree parent = null;
- ITree children = null;
- TreeContext tc = new TreeContext();
- tree = EDiffHelper.getActionTree(actionSet, parent, children, tc);
- //tree.setParent(null);
- tc.validate();
-
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
}
+
Pair pair = new Pair<>(tree,actionSet);
return pair;
-// return tree;
+
}
public static void getLeaves(ITree tc){
@@ -461,64 +360,39 @@ public class EDiffHelper {
}
}
- public static ITree getTokens(String prefix,String firstValue, JedisPool outerPool,JedisPool innerPool) {
+ public static ITree getTokens(String prefix, String fn, JedisPool outerPool, HashMap filenames) {
ITree tree = null;
-// Jedis inner = null;
-// Jedis outer = null;
- try{
- try (Jedis inner = innerPool.getResource();Jedis outer = outerPool.getResource()) {
-// inner = innerPool.getResource();
- inner.select(1);
- String dist2load = inner.get(prefix + "-" + firstValue);
-// outer = outerPool.getResource();
- outer.select(0);
-// String s = null;//inner.get(prefix.replace("-","/") +"/"+dist2load);
-// Set keys = outer.keys(prefix.split("-")[0] + "/*/" + dist2load);
-// if (keys.size() == 1) {
-// s = (String) keys.toArray()[0];
-// } else {
-// throw new Error("cok key");
-// }
+ HierarchicalActionSet actionSet = null;
+ try (Jedis outer = outerPool.getResource()) {
+ try {
+ while (!outer.ping().equals("PONG")) {
+ log.info("wait");
+ }
+ String dist2load = filenames.get(prefix + "-" + fn);
+ String[] split = prefix.split("-");
+ String key = split[0] + "/"+split[1]+"/" + dist2load;
-// String filename = project + "/"+type+"/" + pureFileName + ".txt_" + actionSetPosition;
- String[] split = prefix.split("-");
-// String s = null;//inner.get(prefix.replace("-","/") +"/"+dist2load);
-// Set keys = outer.keys(split[0] + "/"+split[1]+"/" + dist2load);
- String key = split[0] + "/"+split[1]+"/" + dist2load;
- byte[] si = outer.get(key.getBytes());
-// HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromString(si);
- HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.fromByteArray(si);
+ byte[] s = outer.hget("dump".getBytes(), key.getBytes());
+ actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
-
- ITree parent = null;
- ITree children = null;
- TreeContext tc = new TreeContext();
- tree = EDiffHelper.getTokenTree(actionSet, parent, children, tc);
- tree.setParent(null);
- tc.validate();
+ ITree parent = null;
+ ITree children = null;
+ TreeContext tc = new TreeContext();
+ tree = EDiffHelper.getTokenTree(actionSet, parent, children, tc);
+ tree.setParent(null);
+ tc.validate();
// getLeaves(tree);
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
-
-// finally {
-// if (inner != null) {
-// inner.close();
-// }
-// if (outer != null) {
-// outer.close();
-// }
-
-
return tree;
}