From 80620b3a369928f56dd387d26cfbcf9acbf7cc19 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Tue, 6 Dec 2016 09:44:36 +0100
Subject: [PATCH] move string properties algorithms elsewhere

---
 .../properties}/BadCharacterShiftTable.cpp                | 8 ++++----
 .../exact => string/properties}/BadCharacterShiftTable.h  | 8 ++++----
 .../exact => string/properties}/BorderArray.cpp           | 8 ++++----
 .../exact => string/properties}/BorderArray.h             | 8 ++++----
 .../properties}/ReversedBadCharacterShiftTable.cpp        | 8 ++++----
 .../properties}/ReversedBadCharacterShiftTable.h          | 8 ++++----
 alib2algo/src/stringology/exact/BoyerMooreHorspool.cpp    | 4 ++--
 .../stringology/exact/DeadZoneUsingBadCharacterShift.cpp  | 8 ++++----
 .../ExactMultiNondeterministicSubsequenceAutomaton.cpp    | 2 +-
 .../src/stringology/exact/ReversedBoyerMooreHorspool.cpp  | 4 ++--
 .../exact => string/properties}/borderArrayTest.cpp       | 6 +++---
 .../exact => string/properties}/borderArrayTest.h         | 0
 astringology2/src/astringology.cpp                        | 4 ++--
 13 files changed, 38 insertions(+), 38 deletions(-)
 rename alib2algo/src/{stringology/exact => string/properties}/BadCharacterShiftTable.cpp (93%)
 rename alib2algo/src/{stringology/exact => string/properties}/BadCharacterShiftTable.h (91%)
 rename alib2algo/src/{stringology/exact => string/properties}/BorderArray.cpp (90%)
 rename alib2algo/src/{stringology/exact => string/properties}/BorderArray.h (88%)
 rename alib2algo/src/{stringology/exact => string/properties}/ReversedBadCharacterShiftTable.cpp (92%)
 rename alib2algo/src/{stringology/exact => string/properties}/ReversedBadCharacterShiftTable.h (91%)
 rename alib2algo/test-src/{stringology/exact => string/properties}/borderArrayTest.cpp (79%)
 rename alib2algo/test-src/{stringology/exact => string/properties}/borderArrayTest.h (100%)

diff --git a/alib2algo/src/stringology/exact/BadCharacterShiftTable.cpp b/alib2algo/src/string/properties/BadCharacterShiftTable.cpp
similarity index 93%
rename from alib2algo/src/stringology/exact/BadCharacterShiftTable.cpp
rename to alib2algo/src/string/properties/BadCharacterShiftTable.cpp
index 9b0cca0bd6..1a6b0a780a 100644
--- a/alib2algo/src/stringology/exact/BadCharacterShiftTable.cpp
+++ b/alib2algo/src/string/properties/BadCharacterShiftTable.cpp
@@ -10,9 +10,9 @@
 #include <string/LinearString.h>
 #include <alphabet/Symbol.h>
 
-namespace stringology {
+namespace string {
 
-namespace exact {
+namespace properties {
 
 std::map<alphabet::Symbol, size_t> BadCharacterShiftTable::bcs(const string::String& pattern) {
 	return dispatch(pattern.getData());
@@ -42,6 +42,6 @@ std::map<alphabet::Symbol, size_t> BadCharacterShiftTable::bcs(const string::Lin
 
 auto BadCharacterShiftTableLinearString = BadCharacterShiftTable::RegistratorWrapper<std::map<alphabet::Symbol, size_t>, string::LinearString < >>(BadCharacterShiftTable::bcs);
 
-} /* namespace exact */
+} /* namespace properties */
 
-} /* namespace stringology */
+} /* namespace string */
diff --git a/alib2algo/src/stringology/exact/BadCharacterShiftTable.h b/alib2algo/src/string/properties/BadCharacterShiftTable.h
similarity index 91%
rename from alib2algo/src/stringology/exact/BadCharacterShiftTable.h
rename to alib2algo/src/string/properties/BadCharacterShiftTable.h
index 0cff252f69..c98eca6caf 100644
--- a/alib2algo/src/stringology/exact/BadCharacterShiftTable.h
+++ b/alib2algo/src/string/properties/BadCharacterShiftTable.h
@@ -15,9 +15,9 @@
 #include <set>
 #include <map>
 
-namespace stringology {
+namespace string {
 
-namespace exact {
+namespace properties {
 
 /**
  * Computation of BCS table for BMH from MI(E+\eps)-EVY course 2014
@@ -35,8 +35,8 @@ public:
 
 };
 
-} /* namespace exact */
+} /* namespace properties */
 
-} /* namespace stringology */
+} /* namespace string */
 
 #endif /* _STRINGOLOGY_BAD_CHARACTER_SHIFT_TABLE_H_ */
diff --git a/alib2algo/src/stringology/exact/BorderArray.cpp b/alib2algo/src/string/properties/BorderArray.cpp
similarity index 90%
rename from alib2algo/src/stringology/exact/BorderArray.cpp
rename to alib2algo/src/string/properties/BorderArray.cpp
index 8ca9734ab7..bed42f90fc 100644
--- a/alib2algo/src/stringology/exact/BorderArray.cpp
+++ b/alib2algo/src/string/properties/BorderArray.cpp
@@ -13,9 +13,9 @@
 #include <primitive/Integer.h>
 #include <string/LinearString.h>
 
-namespace stringology {
+namespace string {
 
-namespace exact {
+namespace properties {
 
 std::vector<unsigned> BorderArray::construct(const string::String& string) {
 	return dispatch(string.getData());
@@ -43,6 +43,6 @@ std::vector<unsigned> BorderArray::construct(const string::LinearString < >& str
 
 auto BorderArrayLinearString = BorderArray::RegistratorWrapper<std::vector<unsigned>, string::LinearString < >>(BorderArray::construct);
 
-} /* namespace exact */
+} /* namespace properties */
 
-} /* namespace stringology */
+} /* namespace string */
diff --git a/alib2algo/src/stringology/exact/BorderArray.h b/alib2algo/src/string/properties/BorderArray.h
similarity index 88%
rename from alib2algo/src/stringology/exact/BorderArray.h
rename to alib2algo/src/string/properties/BorderArray.h
index b26156a91a..c3d1e6dadc 100644
--- a/alib2algo/src/stringology/exact/BorderArray.h
+++ b/alib2algo/src/string/properties/BorderArray.h
@@ -12,9 +12,9 @@
 #include <core/multipleDispatch.hpp>
 #include <string/StringFeatures.h>
 
-namespace stringology {
+namespace string {
 
-namespace exact {
+namespace properties {
 
 class BorderArray : public std::SingleDispatch<BorderArray, std::vector<unsigned>, const string::StringBase &> {
 public:
@@ -28,8 +28,8 @@ public:
 	static std::vector<unsigned> construct(const string::LinearString < >& string);
 };
 
-} /* namespace exact */
+} /* namespace properties */
 
-} /* namespace stringology */
+} /* namespace string */
 
 #endif /* _BORDER_ARRAY_H_ */
diff --git a/alib2algo/src/stringology/exact/ReversedBadCharacterShiftTable.cpp b/alib2algo/src/string/properties/ReversedBadCharacterShiftTable.cpp
similarity index 92%
rename from alib2algo/src/stringology/exact/ReversedBadCharacterShiftTable.cpp
rename to alib2algo/src/string/properties/ReversedBadCharacterShiftTable.cpp
index 81c74bf1c0..b31067dc11 100644
--- a/alib2algo/src/stringology/exact/ReversedBadCharacterShiftTable.cpp
+++ b/alib2algo/src/string/properties/ReversedBadCharacterShiftTable.cpp
@@ -10,9 +10,9 @@
 #include <string/LinearString.h>
 #include <alphabet/Symbol.h>
 
-namespace stringology {
+namespace string {
 
-namespace exact {
+namespace properties {
 
 std::map < alphabet::Symbol, size_t > ReversedBadCharacterShiftTable::bcs ( const string::String & pattern ) {
 	return dispatch ( pattern.getData ( ) );
@@ -35,6 +35,6 @@ std::map < alphabet::Symbol, size_t > ReversedBadCharacterShiftTable::bcs ( cons
 
 auto ReversedBadCharacterShiftTableLinearString = ReversedBadCharacterShiftTable::RegistratorWrapper < std::map < alphabet::Symbol, size_t >, string::LinearString < > > ( ReversedBadCharacterShiftTable::bcs );
 
-} /* namespace exact */
+} /* namespace properties */
 
-} /* namespace stringology */
+} /* namespace string */
diff --git a/alib2algo/src/stringology/exact/ReversedBadCharacterShiftTable.h b/alib2algo/src/string/properties/ReversedBadCharacterShiftTable.h
similarity index 91%
rename from alib2algo/src/stringology/exact/ReversedBadCharacterShiftTable.h
rename to alib2algo/src/string/properties/ReversedBadCharacterShiftTable.h
index 71d36f39bb..2609f6e265 100644
--- a/alib2algo/src/stringology/exact/ReversedBadCharacterShiftTable.h
+++ b/alib2algo/src/string/properties/ReversedBadCharacterShiftTable.h
@@ -15,9 +15,9 @@
 #include <set>
 #include <map>
 
-namespace stringology {
+namespace string {
 
-namespace exact {
+namespace properties {
 
 /**
  * Computation of BCS table for BMH from MI(E+\eps)-EVY course 2014
@@ -35,8 +35,8 @@ public:
 
 };
 
-} /* namespace exact */
+} /* namespace properties */
 
-} /* namespace stringology */
+} /* namespace string */
 
 #endif /* _STRINGOLOGY_REVERSED_BAD_CHARACTER_SHIFT_TABLE_H_ */
diff --git a/alib2algo/src/stringology/exact/BoyerMooreHorspool.cpp b/alib2algo/src/stringology/exact/BoyerMooreHorspool.cpp
index 659389e526..56831ebd76 100644
--- a/alib2algo/src/stringology/exact/BoyerMooreHorspool.cpp
+++ b/alib2algo/src/stringology/exact/BoyerMooreHorspool.cpp
@@ -6,7 +6,7 @@
  */
 
 #include "BoyerMooreHorspool.h"
-#include "BadCharacterShiftTable.h"
+#include <string/properties/BadCharacterShiftTable.h>
 
 #include <string/LinearString.h>
 #include <alphabet/Symbol.h>
@@ -26,7 +26,7 @@ std::set<unsigned> BoyerMooreHorspool::match(const string::LinearString < >& str
 	std::set<unsigned> occ;
 
 	measurements::start ( "Preprocess", measurements::Type::PREPROCESS );
-	std::map<alphabet::Symbol, size_t> bcs = BadCharacterShiftTable::bcs(pattern); //NOTE: the subjects alphabet must be a subset or equal to the pattern
+	std::map<alphabet::Symbol, size_t> bcs = string::properties::BadCharacterShiftTable::bcs(pattern); //NOTE: the subjects alphabet must be a subset or equal to the pattern
 	measurements::end ( );
 
 	measurements::start ( "Algorithm", measurements::Type::ALGORITHM );
diff --git a/alib2algo/src/stringology/exact/DeadZoneUsingBadCharacterShift.cpp b/alib2algo/src/stringology/exact/DeadZoneUsingBadCharacterShift.cpp
index 38ae488a66..831366295e 100644
--- a/alib2algo/src/stringology/exact/DeadZoneUsingBadCharacterShift.cpp
+++ b/alib2algo/src/stringology/exact/DeadZoneUsingBadCharacterShift.cpp
@@ -6,8 +6,8 @@
  */
 
 #include "DeadZoneUsingBadCharacterShift.h"
-#include "BadCharacterShiftTable.h"
-#include "ReversedBadCharacterShiftTable.h"
+#include <string/properties/BadCharacterShiftTable.h>
+#include <string/properties/ReversedBadCharacterShiftTable.h>
 
 #include <string/LinearString.h>
 #include <alphabet/Symbol.h>
@@ -24,8 +24,8 @@ std::set < unsigned > DeadZoneUsingBadCharacterShift::match ( const string::Stri
 
 std::set < unsigned > DeadZoneUsingBadCharacterShift::match ( const string::LinearString < > & string, const string::LinearString < > & pattern ) {
 	std::set < unsigned > occ;
-	std::map < alphabet::Symbol, size_t > fbcs = BadCharacterShiftTable::bcs ( pattern );     // NOTE: the subjects alphabet must be a subset or equal to the pattern
-	std::map < alphabet::Symbol, size_t > bbcs = ReversedBadCharacterShiftTable::bcs ( pattern ); // NOTE: the subjects alphabet must be a subset or equal to the pattern
+	std::map < alphabet::Symbol, size_t > fbcs = string::properties::BadCharacterShiftTable::bcs ( pattern );     // NOTE: the subjects alphabet must be a subset or equal to the pattern
+	std::map < alphabet::Symbol, size_t > bbcs = string::properties::ReversedBadCharacterShiftTable::bcs ( pattern ); // NOTE: the subjects alphabet must be a subset or equal to the pattern
 
 	match_rec ( occ, string, pattern, fbcs, bbcs, 0, string.getContent ( ).size ( ) - pattern.getContent ( ).size ( ) + 1 );
 	return occ;
diff --git a/alib2algo/src/stringology/exact/ExactMultiNondeterministicSubsequenceAutomaton.cpp b/alib2algo/src/stringology/exact/ExactMultiNondeterministicSubsequenceAutomaton.cpp
index 0939794375..e0b4bb69f3 100644
--- a/alib2algo/src/stringology/exact/ExactMultiNondeterministicSubsequenceAutomaton.cpp
+++ b/alib2algo/src/stringology/exact/ExactMultiNondeterministicSubsequenceAutomaton.cpp
@@ -8,7 +8,7 @@
 #include "ExactMultiNondeterministicSubsequenceAutomaton.h"
 #include <string/LinearString.h>
 #include <string/Epsilon.h>
-#include "../../common/ContainerConverter.hpp"
+#include <common/ContainerConverter.hpp>
 
 namespace stringology {
 
diff --git a/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.cpp b/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.cpp
index 9b00bd4db0..fc189d7cad 100644
--- a/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.cpp
+++ b/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.cpp
@@ -6,7 +6,7 @@
  */
 
 #include "ReversedBoyerMooreHorspool.h"
-#include "ReversedBadCharacterShiftTable.h"
+#include <string/properties/ReversedBadCharacterShiftTable.h>
 
 #include <string/LinearString.h>
 #include <alphabet/Symbol.h>
@@ -23,7 +23,7 @@ std::set < unsigned > ReversedBoyerMooreHorspool::match ( const string::String &
 
 std::set < unsigned > ReversedBoyerMooreHorspool::match ( const string::LinearString < > & string, const string::LinearString < > & pattern ) {
 	std::set < unsigned > occ;
-	std::map < alphabet::Symbol, size_t > bcs = ReversedBadCharacterShiftTable::bcs ( pattern ); // NOTE: the subjects alphabet must be a subset or equal to the pattern
+	std::map < alphabet::Symbol, size_t > bcs = string::properties::ReversedBadCharacterShiftTable::bcs ( pattern ); // NOTE: the subjects alphabet must be a subset or equal to the pattern
 
 	int haystack_offset = string.getContent ( ).size ( ) - pattern.getContent ( ).size ( );
 
diff --git a/alib2algo/test-src/stringology/exact/borderArrayTest.cpp b/alib2algo/test-src/string/properties/borderArrayTest.cpp
similarity index 79%
rename from alib2algo/test-src/stringology/exact/borderArrayTest.cpp
rename to alib2algo/test-src/string/properties/borderArrayTest.cpp
index 65aa2ab174..0381b37fbe 100644
--- a/alib2algo/test-src/stringology/exact/borderArrayTest.cpp
+++ b/alib2algo/test-src/string/properties/borderArrayTest.cpp
@@ -1,7 +1,7 @@
 #include "borderArrayTest.h"
 
-#include "string/String.h"
-#include "stringology/exact/BorderArray.h"
+#include <string/String.h>
+#include <string/properties/BorderArray.h>
 
 #define CPPUNIT_IMPLY(x, y) CPPUNIT_ASSERT(!(x) || (y))
 
@@ -16,7 +16,7 @@ void borderArrayTest::tearDown() {
 
 void borderArrayTest::testBorderArray() {
 	string::String string = string::stringFrom("alfalfaalf");
-	std::vector<unsigned> borderArray = stringology::exact::BorderArray::construct(string);
+	std::vector<unsigned> borderArray = string::properties::BorderArray::construct(string);
 	std::vector<unsigned> expected {0, 0, 0, 0, 1, 2, 3, 1, 1, 2, 3};
 
 	CPPUNIT_ASSERT(borderArray != expected);
diff --git a/alib2algo/test-src/stringology/exact/borderArrayTest.h b/alib2algo/test-src/string/properties/borderArrayTest.h
similarity index 100%
rename from alib2algo/test-src/stringology/exact/borderArrayTest.h
rename to alib2algo/test-src/string/properties/borderArrayTest.h
diff --git a/astringology2/src/astringology.cpp b/astringology2/src/astringology.cpp
index 0598b774b0..16c9e749e2 100644
--- a/astringology2/src/astringology.cpp
+++ b/astringology2/src/astringology.cpp
@@ -33,7 +33,7 @@
 #include <stringology/exact/ExactMultiNondeterministicSubsequenceAutomaton.h>
 #include <stringology/exact/FactorOracleAutomaton.h>
 #include <stringology/exact/SuffixAutomaton.h>
-#include <stringology/exact/BorderArray.h>
+#include <string/properties/BorderArray.h>
 #include <stringology/indexing/SuffixTrie.h>
 
 int main ( int argc, char * argv[] ) {
@@ -271,7 +271,7 @@ int main ( int argc, char * argv[] ) {
 			measurements::end ( );
 			measurements::start ( "Algorithm", measurements::Type::MAIN );
 
-			std::vector < unsigned > borderArray = stringology::exact::BorderArray::construct ( subject );
+			std::vector < unsigned > borderArray = string::properties::BorderArray::construct ( subject );
 
 			measurements::end ( );
 			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-- 
GitLab