From 3bfa9d28bb9a12900b705f63963afaef42f54422 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Thu, 7 Sep 2017 22:03:14 +0200
Subject: [PATCH] use cli in aarbology binary

---
 aarbology2/makefile.conf                      |   6 +-
 aarbology2/src/aarbology.cpp                  | 365 ++++++------------
 .../src/arbology/exact/BoyerMooreHorspool.cpp |  10 +-
 .../src/arbology/exact/BoyerMooreHorspool.h   |   8 +-
 ...neUsingBadCharacterShiftAndBorderArray.cpp |  12 +-
 .../ExactNonlinearTreePatternAutomaton.cpp    |   6 +-
 .../ExactNonlinearTreePatternAutomaton.h      |   8 +-
 .../src/arbology/exact/ExactPatternMatch.cpp  |  18 +-
 .../src/arbology/exact/ExactPatternMatch.h    |   8 +-
 .../exact/ExactPatternMatchingAutomaton.cpp   |  16 +-
 .../arbology/exact/ExactSubtreeAutomaton.cpp  |   8 +-
 .../arbology/exact/ExactSubtreeAutomaton.h    |   5 +-
 .../src/arbology/exact/ExactSubtreeMatch.cpp  |  12 +-
 .../src/arbology/exact/ExactSubtreeMatch.h    |   8 +-
 .../exact/ExactSubtreeMatchingAutomaton.cpp   |  10 +-
 .../exact/ExactSubtreeMatchingAutomaton.h     |   6 +-
 .../exact/ExactTreePatternAutomaton.cpp       |   6 +-
 .../exact/ExactTreePatternAutomaton.h         |   9 +-
 .../src/arbology/exact/KnuthMorrisPratt.cpp   |  12 +-
 .../exact/ReversedBoyerMooreHorspool.cpp      |  16 +-
 .../exact/ReversedBoyerMooreHorspool.h        |   8 +-
 ...CompressedBitParallelIndexConstruction.cpp |   8 +-
 .../CompressedBitParallelIndexConstruction.h  |   6 +-
 .../FullAndLinearIndexConstruction.cpp        |   7 +-
 .../indexing/FullAndLinearIndexConstruction.h |   6 +-
 ...CompressedBitParallelIndexConstruction.cpp |   6 +-
 ...arCompressedBitParallelIndexConstruction.h |   6 +-
 ...onlinearFullAndLinearIndexConstruction.cpp |   7 +-
 .../NonlinearFullAndLinearIndexConstruction.h |   6 +-
 .../arbology/transform/BeginToEndIndex.cpp    |   8 +-
 .../src/arbology/transform/BeginToEndIndex.h  |   8 +-
 alib2algo/src/tree/NormalizeTreeLabels.cpp    |   7 +-
 alib2algo/src/tree/NormalizeTreeLabels.h      |   9 +-
 .../properties/BadCharacterShiftTable.cpp     |  11 +-
 .../tree/properties/BadCharacterShiftTable.h  |   7 +-
 .../tree/properties/ExactSubtreeRepeats.cpp   |   7 +-
 .../src/tree/properties/ExactSubtreeRepeats.h |  10 +-
 .../properties/ExactSubtreeRepeatsNaive.cpp   |  13 +-
 .../properties/ExactSubtreeRepeatsNaive.h     |  10 +-
 .../src/common/PrimitiveRegistrator2.cpp      |   9 +
 40 files changed, 201 insertions(+), 507 deletions(-)

diff --git a/aarbology2/makefile.conf b/aarbology2/makefile.conf
index 69645d51e2..831715705f 100644
--- a/aarbology2/makefile.conf
+++ b/aarbology2/makefile.conf
@@ -1,4 +1,4 @@
 EXECUTABLE:=aarbology2
-LINK_PATHS=../alib2elgo/ ../alib2algo/ ../alib2data/ ../alib2common/ ../alib2std/
-LINK_LIBRARIES=alib2elgo alib2algo alib2data alib2common alib2std xml2
-INCLUDE_PATHS=\$$(SOURCES_BASE_DIR)/../../alib2elgo/src/ \$$(SOURCES_BASE_DIR)/../../alib2algo/src/ \$$(SOURCES_BASE_DIR)/../../alib2data/src/ \$$(SOURCES_BASE_DIR)/../../alib2common/src/ \$$(SOURCES_BASE_DIR)/../../alib2std/src/ /usr/include/libxml2/
+LINK_PATHS=../alib2cli/ ../alib2elgo/ ../alib2algo/ ../alib2data/ ../alib2common/ ../alib2std/
+LINK_LIBRARIES=alib2cli alib2elgo alib2algo alib2data alib2common alib2std xml2
+INCLUDE_PATHS=\$$(SOURCES_BASE_DIR)/../../alib2cli/src/ \$$(SOURCES_BASE_DIR)/../../alib2common/src/ \$$(SOURCES_BASE_DIR)/../../alib2std/src/ /usr/include/libxml2/
diff --git a/aarbology2/src/aarbology.cpp b/aarbology2/src/aarbology.cpp
index cb0daa0d30..1ee609ca39 100644
--- a/aarbology2/src/aarbology.cpp
+++ b/aarbology2/src/aarbology.cpp
@@ -8,35 +8,10 @@
 #include <tclap/CmdLine.h>
 #include <global/GlobalData.h>
 #include <measure>
-#include <vector>
-#include <sax/FromXMLParserHelper.h>
 
-#include <factory/XmlDataFactory.hpp>
 #include <exception/CommonException.h>
-#include <tree/Tree.h>
-#include <tree/RankedTreeWrapper.h>
-#include <container/Container.h>
-#include <container/ObjectsSet.h>
-
-#include <arbology/exact/ExactSubtreeMatch.h>
-#include <arbology/exact/ExactPatternMatch.h>
-#include <arbology/exact/BoyerMooreHorspool.h>
-#include <arbology/exact/ReversedBoyerMooreHorspool.h>
-#include <arbology/exact/KnuthMorrisPratt.h>
-#include <arbology/exact/DeadZoneUsingBadCharacterShiftAndBorderArray.h>
-#include <arbology/exact/ExactSubtreeMatchingAutomaton.h>
-#include <arbology/exact/ExactPatternMatchingAutomaton.h>
-#include <arbology/exact/ExactSubtreeAutomaton.h>
-#include <arbology/exact/ExactTreePatternAutomaton.h>
-#include <arbology/exact/ExactNonlinearTreePatternAutomaton.h>
-#include <tree/properties/ExactSubtreeRepeatsNaive.h>
-#include <tree/properties/ExactSubtreeRepeats.h>
-#include <tree/NormalizeTreeLabels.h>
-#include <arbology/transform/BeginToEndIndex.h>
-#include <arbology/indexing/CompressedBitParallelIndexConstruction.h>
-#include <arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.h>
-#include <arbology/indexing/FullAndLinearIndexConstruction.h>
-#include <arbology/indexing/NonlinearFullAndLinearIndexConstruction.h>
+#include <lexer/Lexer.h>
+#include <parser/Parser.h>
 
 int main ( int argc, char * argv[] ) {
 	try {
@@ -99,261 +74,147 @@ int main ( int argc, char * argv[] ) {
 		if(measure.isSet())
 			common::GlobalData::measure = true;
 
+		cli::Environment environment;
+		environment.setBinding ( "stdout", "-" );
+
 		measurements::start ( "Overal", measurements::Type::OVERALL );
 		measurements::start ( "Input read", measurements::Type::AUXILIARY );
 
-		if ( algorithm.getValue ( ) == "exactSubtreeMatch" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			ext::set < unsigned > res = arbology::exact::ExactSubtreeMatch::match ( subject, pattern );
-			if( ends.isSet ( ) )
-				res = arbology::transform::BeginToEndIndex::transform(subject, res);
+		if ( algorithm.getValue ( ) == "exactSubtreeMatch"
+		  || algorithm.getValue ( ) == "exactPatternMatch"
+		  || algorithm.getValue ( ) == "boyerMooreHorspool"
+		  || algorithm.getValue ( ) == "reversedBoyerMooreHorspool"
+		  || algorithm.getValue ( ) == "knuthMorrisPratt"
+		  || algorithm.getValue ( ) == "deadZoneUsingBadCharacterShiftAndBorderArray"
+		  || algorithm.getValue ( ) == "exactSubtreeAutomaton"
+		  || algorithm.getValue ( ) == "exactTreePatternAutomaton"
+		  || algorithm.getValue ( ) == "exactNonlinearTreePatternAutomaton"
+		  || algorithm.getValue ( ) == "exactSubtreeRepeatsNaive"
+		  || algorithm.getValue ( ) == "normalizeTreeLabels"
+		  || algorithm.getValue ( ) == "exactSubtreeRepeats"
+		  || algorithm.getValue ( ) == "compressedBitParallelIndex"
+		  || algorithm.getValue ( ) == "nonlinearCompressedBitParallelIndex"
+		  || algorithm.getValue ( ) == "fullAndLinearIndex"
+		  || algorithm.getValue ( ) == "nonlinearFullAndLinearIndex" ) {
+			std::string input;
+			if ( subjectInput.getValue ( ).size ( ) == 0 )
+				input = "-";
+			else if ( subjectInput.getValue ( ).size ( ) == 1 )
+				input = * subjectInput.getValue ( ).begin ( );
+			else
+				throw exception::CommonException("Multiple parameters when single required.");
+
+			environment.setBinding ( "inputSubject", input );
+			cli::Parser parser ( cli::Lexer ( "execute <#inputSubject > $subject" ) );
+			parser.parse ( )->run ( environment );
+		}
 
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
+		if ( algorithm.getValue ( ) == "exactSubtreeMatch"
+		  || algorithm.getValue ( ) == "exactPatternMatch"
+		  || algorithm.getValue ( ) == "boyerMooreHorspool"
+		  || algorithm.getValue ( ) == "reversedBoyerMooreHorspool"
+		  || algorithm.getValue ( ) == "knuthMorrisPratt"
+		  || algorithm.getValue ( ) == "deadZoneUsingBadCharacterShiftAndBorderArray"
+		  || algorithm.getValue ( ) == "exactSubtreeMatchingAutomaton"
+		  || algorithm.getValue ( ) == "exactPatternMatchingAutomaton"
+		  || algorithm.getValue ( ) == "badCharacterShiftTable" ) {
+			std::string input;
+			if ( patternInput.getValue ( ).size ( ) == 0 )
+				input = "-";
+			else if ( patternInput.getValue ( ).size ( ) == 1 )
+				input = * patternInput.getValue ( ).begin ( );
+			else
+				throw exception::CommonException("Multiple parameters when single required.");
+
+			environment.setBinding ( "inputPattern", input );
+			cli::Parser parser ( cli::Lexer ( "execute <#inputPattern > $pattern" ) );
+			parser.parse ( )->run ( environment );
+		}
 
-			alib::XmlDataFactory::toStdout ( res );
-		} else if ( algorithm.getValue ( ) == "exactPatternMatch" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
+		if ( algorithm.getValue ( ) == "exactTreePatternAutomaton"
+		  || algorithm.getValue ( ) == "exactNonlinearTreePatternAutomaton" ) {
+			std::string input;
+			if ( ! subtreeWildcardInput.isSet ( ) )
+				input = "-";
+			else
+				input = subtreeWildcardInput.getValue ( );
+
+			environment.setBinding ( "inputSubtreeWildcard", input );
+			cli::Parser parser ( cli::Lexer ( "execute <:type ranked_symbol #inputSubtreeWildcard > $subtreeWildcard" ) );
+			parser.parse ( )->run ( environment );
+		}
 
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
+		if ( algorithm.getValue ( ) == "exactNonlinearTreePatternAutomaton" ) {
+			std::string input;
+			if ( ! nonlinearVariablesInput.isSet ( ) )
+				input = "-";
+			else
+				input = nonlinearVariablesInput.getValue ( );
 
-			ext::set < unsigned > res = arbology::exact::ExactPatternMatch::match ( subject, pattern );
-			if( ends.isSet ( ) )
-				res = arbology::transform::BeginToEndIndex::transform(subject, res);
+			environment.setBinding ( "inputNonlinearVariables", input );
+			cli::Parser parser ( cli::Lexer ( "execute <{:type ranked_symbol}#inputNonlinearVariables > $nonlinearVariables" ) );
+			parser.parse ( )->run ( environment );
+		}
 
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
+		measurements::end ( );
+		measurements::start ( "Algorithm", measurements::Type::MAIN );
 
-			alib::XmlDataFactory::toStdout ( res );
+		std::string cliCommand;
+		if ( algorithm.getValue ( ) == "exactSubtreeMatch" ) {
+			cliCommand = "execute arbology::exact::ExactSubtreeMatch $subject $pattern > $output";
+		} else if ( algorithm.getValue ( ) == "exactPatternMatch" ) {
+			cliCommand = "execute arbology::exact::ExactPatternMatch $subject $pattern > $output";
 		} else if ( algorithm.getValue ( ) == "boyerMooreHorspool" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			ext::set < unsigned > res = arbology::exact::BoyerMooreHorspool::match ( subject, pattern );
-			if( ends.isSet ( ) )
-				res = arbology::transform::BeginToEndIndex::transform(subject, res);
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::BoyerMooreHorspool $subject $pattern > $output";
 		} else if ( algorithm.getValue ( ) == "reversedBoyerMooreHorspool" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			ext::set < unsigned > res = arbology::exact::ReversedBoyerMooreHorspool::match ( subject, pattern );
-			if( ends.isSet ( ) )
-				res = arbology::transform::BeginToEndIndex::transform(subject, res);
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::ReversedBoyerMooreHorspool $subject $pattern > $output";
 		} else if ( algorithm.getValue ( ) == "knuthMorrisPratt" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			ext::set < unsigned > res = arbology::exact::KnuthMorrisPratt::match ( subject, pattern );
-			if( ends.isSet ( ) )
-				res = arbology::transform::BeginToEndIndex::transform(subject, res);
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::KnuthMorrisPratt $subject $pattern > $output";
 		} else if ( algorithm.getValue ( ) == "deadZoneUsingBadCharacterShiftAndBorderArray" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			ext::set < unsigned > res = arbology::exact::DeadZoneUsingBadCharacterShiftAndBorderArray::match ( subject, pattern );
-			if( ends.isSet ( ) )
-				res = arbology::transform::BeginToEndIndex::transform(subject, res);
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::DeadZoneUsingBadCharacterShiftAndBorderArray $subject $pattern > $output";
 		} else if ( algorithm.getValue ( ) == "exactSubtreeMatchingAutomaton" ) {
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			automaton::Automaton res = arbology::exact::ExactSubtreeMatchingAutomaton::construct ( pattern );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::ExactSubtreeMatchingAutomaton $pattern > $output";
 		} else if ( algorithm.getValue ( ) == "exactPatternMatchingAutomaton" ) {
-			tree::Tree pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			automaton::Automaton res = arbology::exact::ExactPatternMatchingAutomaton::construct ( pattern );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::ExactPatternMatchingAutomaton $pattern > $output";
 		} else if ( algorithm.getValue ( ) == "exactSubtreeAutomaton" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			automaton::Automaton res = arbology::exact::ExactSubtreeAutomaton::construct ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::ExactSubtreeAutomaton $subject > $output";
 		} else if ( algorithm.getValue ( ) == "exactTreePatternAutomaton" ) {
-			tree::RankedTreeWrapper subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			common::ranked_symbol < DefaultSymbolType, DefaultRankType > subtreeWildcard = alib::XmlDataFactory::fromTokens ( sax::FromXMLParserHelper::parseInput(subtreeWildcardInput) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			automaton::Automaton res = arbology::exact::ExactTreePatternAutomaton::construct ( subject, subtreeWildcard );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::ExactTreePatternAutomaton $subject $subtreeWildcard > $output";
 		} else if ( algorithm.getValue ( ) == "exactNonlinearTreePatternAutomaton" ) {
-			tree::RankedTreeWrapper subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-			common::ranked_symbol < DefaultSymbolType, DefaultRankType > subtreeWildcard = alib::XmlDataFactory::fromTokens ( sax::FromXMLParserHelper::parseInput(subtreeWildcardInput) );
-			ext::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > nonlinearVariables = alib::XmlDataFactory::fromTokens ( sax::FromXMLParserHelper::parseInput(nonlinearVariablesInput) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			automaton::Automaton res = arbology::exact::ExactNonlinearTreePatternAutomaton::construct ( subject, subtreeWildcard, nonlinearVariables );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute arbology::exact::ExactNonlinearTreePatternAutomaton $subject $subtreeWildcard $nonlinearVariables > $output";
 		} else if ( algorithm.getValue ( ) == "exactSubtreeRepeatsNaive" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			tree::Tree res = tree::properties::ExactSubtreeRepeatsNaive::repeats ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute tree::properties::ExactSubtreeRepeatsNaive $subject > $output";
 		} else if ( algorithm.getValue ( ) == "normalizeTreeLabels" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			tree::Tree res = tree::NormalizeTreeLabels::normalize ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute tree::NormalizeTreeLabels $subject > $output";
 		} else if ( algorithm.getValue ( ) == "exactSubtreeRepeats" ) {
-			tree::Tree subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			tree::Tree res = tree::properties::ExactSubtreeRepeats::repeats ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( res );
+			cliCommand = "execute tree::properties::ExactSubtreeRepeats $subject > $output";
 		} else if ( algorithm.getValue ( ) == "compressedBitParallelIndex" ) {
-			tree::RankedTreeWrapper subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			indexes::arbology::CompressedBitParallelTreeIndex < > compressedBitParallelIndex = arbology::indexing::CompressedBitParallelIndexConstruction::construct ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( compressedBitParallelIndex );
+			cliCommand = "execute arbology::indexing::CompressedBitParallelIndexConstruction $subject > $output";
 		} else if ( algorithm.getValue ( ) == "nonlinearCompressedBitParallelIndex" ) {
-			tree::RankedTreeWrapper subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			indexes::arbology::NonlinearCompressedBitParallelTreeIndex < > nonlinearCompressedBitParallelIndex = arbology::indexing::NonlinearCompressedBitParallelIndexConstruction::construct ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( nonlinearCompressedBitParallelIndex );
+			cliCommand = "execute arbology::indexing::NonlinearCompressedBitParallelIndexConstruction $subject > $output";
 		} else if ( algorithm.getValue ( ) == "fullAndLinearIndex" ) {
-			tree::RankedTreeWrapper subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			indexes::arbology::FullAndLinearIndex < > fullAndLinearIndex = arbology::indexing::FullAndLinearIndexConstruction::construct ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( fullAndLinearIndex );
+			cliCommand = "execute arbology::indexing::FullAndLinearIndexConstruction $subject > $output";
 		} else if ( algorithm.getValue ( ) == "nonlinearFullAndLinearIndex" ) {
-			tree::RankedTreeWrapper subject = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, subjectInput).front ( ) ) );
-
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
-
-			indexes::arbology::NonlinearFullAndLinearIndex < > nonlinearFullAndLinearIndex = arbology::indexing::NonlinearFullAndLinearIndexConstruction::construct ( subject );
-
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
-
-			alib::XmlDataFactory::toStdout ( nonlinearFullAndLinearIndex );
+			cliCommand = "execute arbology::indexing::NonlinearFullAndLinearIndexConstruction $subject > $output";
 		} else if ( algorithm.getValue ( ) == "badCharacterShiftTable" ) {
-			tree::RankedTreeWrapper pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) );
+			cliCommand = "execute tree::properties::BadCharacterShiftTable $pattern > $output";
+		} else {
+			throw exception::CommonException ( "Invalid algorithm" );
+		}
 
-			measurements::end ( );
-			measurements::start ( "Algorithm", measurements::Type::MAIN );
+		cli::Parser parser = cli::Parser ( cli::Lexer ( cliCommand ) );
+		parser.parse ( )->run ( environment );
 
-			ext::map < common::ranked_symbol < DefaultSymbolType, DefaultRankType >, size_t > bcs = tree::properties::BadCharacterShiftTable::bcs ( pattern );
+		if( ends.isSet ( ) ) {
+			parser = cli::Parser ( cli::Lexer ( "execute arbology::transform::BeginToEndIndex $subject $output > $output" ) );
+			parser.parse ( )->run ( environment );
+		}
 
-			measurements::end ( );
-			measurements::start ( "Output write", measurements::Type::AUXILIARY );
+		measurements::end ( );
+		measurements::start ( "Output write", measurements::Type::AUXILIARY );
 
-			alib::XmlDataFactory::toStdout ( bcs );
-		} else {
-			throw exception::CommonException ( "Invalid algorithm" );
-		}
+		parser = cli::Parser ( cli::Lexer ( "execute $output >#stdout" ) );
+		parser.parse ( )->run ( environment );
 
 		measurements::end ( );
 		measurements::end ( );
diff --git a/alib2algo/src/arbology/exact/BoyerMooreHorspool.cpp b/alib2algo/src/arbology/exact/BoyerMooreHorspool.cpp
index 51ae8e5fd1..e6fef8c530 100644
--- a/alib2algo/src/arbology/exact/BoyerMooreHorspool.cpp
+++ b/alib2algo/src/arbology/exact/BoyerMooreHorspool.cpp
@@ -12,13 +12,9 @@ namespace arbology {
 
 namespace exact {
 
-ext::set < unsigned > BoyerMooreHorspool::match ( const tree::Tree & subject, const tree::Tree & pattern ) {
-	return dispatch ( subject.getData ( ), pattern.getData ( ) );
-}
-
-auto BoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarTree = registration::OverloadRegister < BoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarTree < > > ( BoyerMooreHorspool::match );
-auto BoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarPattern = registration::OverloadRegister < BoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarPattern < > > ( BoyerMooreHorspool::match );
-auto BoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarNonlinearPattern = registration::OverloadRegister < BoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarNonlinearPattern < > > ( BoyerMooreHorspool::match );
+auto BoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarTree = registration::AbstractRegister < BoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarTree < > & > ( BoyerMooreHorspool::match );
+auto BoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarPattern = registration::AbstractRegister < BoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarPattern < > & > ( BoyerMooreHorspool::match );
+auto BoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarNonlinearPattern = registration::AbstractRegister < BoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarNonlinearPattern < > & > ( BoyerMooreHorspool::match );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/BoyerMooreHorspool.h b/alib2algo/src/arbology/exact/BoyerMooreHorspool.h
index a5f0aac272..b8cd4e886a 100644
--- a/alib2algo/src/arbology/exact/BoyerMooreHorspool.h
+++ b/alib2algo/src/arbology/exact/BoyerMooreHorspool.h
@@ -11,14 +11,10 @@
 #include <set>
 #include <map>
 
-#include <core/multipleDispatch.hpp>
-#include <tree/TreeFeatures.h>
-
 #include <tree/properties/BadCharacterShiftTable.h>
 #include <tree/properties/SubtreeJumpTable.h>
 #include <tree/properties/ExactSubtreeRepeatsNaive.h>
 
-#include <tree/Tree.h>
 #include <tree/ranked/PrefixRankedBarTree.h>
 #include <tree/ranked/PrefixRankedBarPattern.h>
 #include <tree/ranked/PrefixRankedBarNonlinearPattern.h>
@@ -32,14 +28,12 @@ namespace exact {
  * Implementation of BMH for MI(E+\eps)-EVY course 2014
  * To get rid of zeros in BCS table we ignore last haystack character
  */
-class BoyerMooreHorspool : public alib::DoubleDispatch < BoyerMooreHorspool, ext::set < unsigned >, const tree::TreeBase &, const tree::TreeBase & > {
+class BoyerMooreHorspool {
 public:
 	/**
 	 * Search for pattern in linear string.
 	 * @return set set of occurences
 	 */
-	static ext::set < unsigned > match ( const tree::Tree & subject, const tree::Tree & pattern );
-
 	template < class SymbolType, class RankType >
 	static ext::set < unsigned > match ( const tree::PrefixRankedBarTree < SymbolType, RankType > & subject, const tree::PrefixRankedBarTree < SymbolType, RankType > & pattern );
 	template < class SymbolType, class RankType >
diff --git a/alib2algo/src/arbology/exact/DeadZoneUsingBadCharacterShiftAndBorderArray.cpp b/alib2algo/src/arbology/exact/DeadZoneUsingBadCharacterShiftAndBorderArray.cpp
index 9919598804..a2c283f9eb 100644
--- a/alib2algo/src/arbology/exact/DeadZoneUsingBadCharacterShiftAndBorderArray.cpp
+++ b/alib2algo/src/arbology/exact/DeadZoneUsingBadCharacterShiftAndBorderArray.cpp
@@ -12,14 +12,10 @@ namespace arbology {
 
 namespace exact {
 
-ext::set < unsigned > DeadZoneUsingBadCharacterShiftAndBorderArray::match ( const tree::Tree & subject, const tree::Tree & pattern ) {
-	return dispatch ( subject.getData ( ), pattern.getData ( ) );
-}
-
-auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedBarTreePrefixRankedBarTree = registration::OverloadRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarTree < > > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
-auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedBarTreePrefixRankedBarPattern = registration::OverloadRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarPattern < > > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
-auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedTreePrefixRankedTree = registration::OverloadRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedTree < > > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
-auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedTreePrefixRankedPattern = registration::OverloadRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedPattern < > > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
+auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedBarTreePrefixRankedBarTree = registration::AbstractRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarTree < > & > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
+auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedBarTreePrefixRankedBarPattern = registration::AbstractRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarPattern < > & > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
+auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedTreePrefixRankedTree = registration::AbstractRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedTree < > & > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
+auto DeadZoneUsingBadCharacterShiftAndBorderArrayPrefixRankedTreePrefixRankedPattern = registration::AbstractRegister < DeadZoneUsingBadCharacterShiftAndBorderArray, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedPattern < > & > ( DeadZoneUsingBadCharacterShiftAndBorderArray::match );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp
index 4430015eb4..039bf423ae 100644
--- a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp
+++ b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp
@@ -12,11 +12,7 @@ namespace arbology {
 
 namespace exact {
 
-automaton::Automaton ExactNonlinearTreePatternAutomaton::construct ( const tree::RankedTreeWrapper & tree, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > & subtreeWildcard, const ext::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > & nonlinearVariables ) {
-	return dispatch ( tree.getData ( ), subtreeWildcard, nonlinearVariables );
-}
-
-auto ExactNonlinearTreePatternAutomatonPrefixRankedTree = registration::OverloadRegister < ExactNonlinearTreePatternAutomaton, automaton::InputDrivenNPDA < common::ranked_symbol < DefaultSymbolType, DefaultRankType >, char, ext::pair < unsigned, unsigned > >, tree::PrefixRankedTree < > > ( ExactNonlinearTreePatternAutomaton::construct );
+auto ExactNonlinearTreePatternAutomatonPrefixRankedTree = registration::AbstractRegister < ExactNonlinearTreePatternAutomaton, automaton::InputDrivenNPDA < common::ranked_symbol < DefaultSymbolType, DefaultRankType >, char, ext::pair < unsigned, unsigned > >, const tree::PrefixRankedTree < > &, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > &, const ext::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > & > ( ExactNonlinearTreePatternAutomaton::construct );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h
index 92c81515d6..b7e4ee7215 100644
--- a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h
+++ b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.h
@@ -12,13 +12,9 @@
 #include <primitive/Character.h>
 #include <container/ObjectsPair.h>
 
-#include <tree/RankedTreeWrapper.h>
-#include <core/multipleDispatch.hpp>
-#include <alphabet/Symbol.h>
 #include <alphabet/RankedSymbol.h>
 
 #include <tree/ranked/PrefixRankedTree.h>
-#include <automaton/Automaton.h>
 #include <automaton/PDA/InputDrivenNPDA.h>
 
 #include <tree/properties/ExactSubtreeRepeatsNaive.h>
@@ -30,7 +26,7 @@ namespace arbology {
 
 namespace exact {
 
-class ExactNonlinearTreePatternAutomaton : public alib::SingleDispatch < ExactNonlinearTreePatternAutomaton, automaton::Automaton, const tree::RankedTreeBase &, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > &, const ext::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > & > {
+class ExactNonlinearTreePatternAutomaton {
 	template < class SymbolType, class RankType >
 	static automaton::InputDrivenNPDA < common::ranked_symbol < SymbolType, RankType >, char, ext::pair < unsigned, unsigned > > constructInternal ( const tree::PrefixRankedTree < SymbolType, RankType > & tree, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const common::ranked_symbol < SymbolType, RankType > & currentNonlinearVariable, const ext::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables );
 
@@ -42,8 +38,6 @@ public:
 	 * Performs conversion.
 	 * @return left regular grammar equivalent to source automaton.
 	 */
-	static automaton::Automaton construct ( const tree::RankedTreeWrapper & tree, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > & subtreeWildcard, const ext::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > & nonlinearVariables );
-
 	template < class SymbolType, class RankType >
 	static automaton::InputDrivenNPDA < common::ranked_symbol < SymbolType, RankType >, char, ext::pair < unsigned, unsigned > > construct ( const tree::PrefixRankedTree < SymbolType, RankType > & tree, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const ext::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables );
 };
diff --git a/alib2algo/src/arbology/exact/ExactPatternMatch.cpp b/alib2algo/src/arbology/exact/ExactPatternMatch.cpp
index ddec2e76f4..6e4c9573b1 100644
--- a/alib2algo/src/arbology/exact/ExactPatternMatch.cpp
+++ b/alib2algo/src/arbology/exact/ExactPatternMatch.cpp
@@ -12,17 +12,13 @@ namespace arbology {
 
 namespace exact {
 
-ext::set < unsigned > ExactPatternMatch::match ( const tree::Tree & subject, const tree::Tree & pattern ) {
-	return dispatch ( subject.getData ( ), pattern.getData ( ) );
-}
-
-auto ExactPatternMatchUnrankedPattern = registration::OverloadRegister < ExactPatternMatch, ext::set < unsigned >, tree::UnrankedTree < >, tree::UnrankedPattern < > > ( ExactPatternMatch::match );
-auto ExactPatternMatchRankedPattern = registration::OverloadRegister < ExactPatternMatch, ext::set < unsigned >, tree::RankedTree < >, tree::RankedPattern < > > ( ExactPatternMatch::match );
-auto ExactPatternMatchRankedNonlinearPattern = registration::OverloadRegister < ExactPatternMatch, ext::set < unsigned >, tree::RankedTree < >, tree::RankedNonlinearPattern < > > ( ExactPatternMatch::match );
-auto ExactPatternMatchPrefixRankedPattern = registration::OverloadRegister < ExactPatternMatch, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedPattern < > > ( ExactPatternMatch::match );
-auto ExactPatternMatchPrefixRankedNonlinearPattern = registration::OverloadRegister < ExactPatternMatch, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedNonlinearPattern < > > ( ExactPatternMatch::match );
-auto ExactPatternMatchPrefixRankedBarPattern = registration::OverloadRegister < ExactPatternMatch, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarPattern < > > ( ExactPatternMatch::match );
-auto ExactPatternMatchPrefixRankedBarNonlinearPattern = registration::OverloadRegister < ExactPatternMatch, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarNonlinearPattern < > > ( ExactPatternMatch::match );
+auto ExactPatternMatchUnrankedPattern = registration::AbstractRegister < ExactPatternMatch, ext::set < unsigned >, const tree::UnrankedTree < > &, const tree::UnrankedPattern < > & > ( ExactPatternMatch::match );
+auto ExactPatternMatchRankedPattern = registration::AbstractRegister < ExactPatternMatch, ext::set < unsigned >, const tree::RankedTree < > &, const tree::RankedPattern < > & > ( ExactPatternMatch::match );
+auto ExactPatternMatchRankedNonlinearPattern = registration::AbstractRegister < ExactPatternMatch, ext::set < unsigned >, const tree::RankedTree < > &, const tree::RankedNonlinearPattern < > & > ( ExactPatternMatch::match );
+auto ExactPatternMatchPrefixRankedPattern = registration::AbstractRegister < ExactPatternMatch, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedPattern < > & > ( ExactPatternMatch::match );
+auto ExactPatternMatchPrefixRankedNonlinearPattern = registration::AbstractRegister < ExactPatternMatch, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedNonlinearPattern < > & > ( ExactPatternMatch::match );
+auto ExactPatternMatchPrefixRankedBarPattern = registration::AbstractRegister < ExactPatternMatch, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarPattern < > & > ( ExactPatternMatch::match );
+auto ExactPatternMatchPrefixRankedBarNonlinearPattern = registration::AbstractRegister < ExactPatternMatch, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarNonlinearPattern < > & > ( ExactPatternMatch::match );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactPatternMatch.h b/alib2algo/src/arbology/exact/ExactPatternMatch.h
index 8682774b7d..3474bf44ab 100644
--- a/alib2algo/src/arbology/exact/ExactPatternMatch.h
+++ b/alib2algo/src/arbology/exact/ExactPatternMatch.h
@@ -13,10 +13,6 @@
 #include <deque>
 #include <foreach>
 
-#include <core/multipleDispatch.hpp>
-
-#include <tree/Tree.h>
-#include <tree/TreeFeatures.h>
 #include <alphabet/RankedSymbol.h>
 
 #include <tree/ranked/RankedTree.h>
@@ -38,14 +34,12 @@ namespace arbology {
 
 namespace exact {
 
-class ExactPatternMatch : public alib::DoubleDispatch < ExactPatternMatch, ext::set < unsigned >, const tree::TreeBase &, const tree::TreeBase & > {
+class ExactPatternMatch {
 public:
 	/**
 	 * Performs conversion.
 	 * @return left regular grammar equivalent to source automaton.
 	 */
-	static ext::set < unsigned > match ( const tree::Tree & subject, const tree::Tree & pattern );
-
 	template < class SymbolType >
 	static ext::set < unsigned > match ( const tree::UnrankedTree < SymbolType > & subject, const tree::UnrankedPattern < SymbolType > & pattern );
 
diff --git a/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp b/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp
index 0ef6ac957f..7ee2f79d7e 100644
--- a/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp
+++ b/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp
@@ -31,15 +31,11 @@ namespace arbology {
 
 namespace exact {
 
-automaton::Automaton ExactPatternMatchingAutomaton::construct ( const tree::Tree & pattern ) {
-	return dispatch ( pattern.getData ( ) );
-}
-
 automaton::InputDrivenNPDA < > ExactPatternMatchingAutomaton::construct ( const tree::PrefixRankedTree < > & pattern ) {
 	return ExactSubtreeMatchingAutomaton::construct ( pattern );
 }
 
-auto ExactPatternMatchingAutomatonPrefixRankedTree = registration::OverloadRegister < ExactPatternMatchingAutomaton, automaton::InputDrivenNPDA < >, tree::PrefixRankedTree < > > ( ExactPatternMatchingAutomaton::construct );
+auto ExactPatternMatchingAutomatonPrefixRankedTree = registration::AbstractRegister < ExactPatternMatchingAutomaton, automaton::InputDrivenNPDA < >, const tree::PrefixRankedTree < > & > ( ExactPatternMatchingAutomaton::construct );
 
 ext::vector < DefaultSymbolType > computeRHS ( const tree::PrefixRankedPattern < > & pattern, const ext::vector < int > & patternSubtreeJumpTable, int i ) {
 	const ext::vector < common::ranked_symbol < > > & content = pattern.getContent ( );
@@ -115,13 +111,13 @@ automaton::NPDA < > ExactPatternMatchingAutomaton::construct ( const tree::Prefi
 	return res;
 }
 
-auto ExactPatternMatchingAutomatonPrefixRankedPattern = registration::OverloadRegister < ExactPatternMatchingAutomaton, automaton::NPDA < >, tree::PrefixRankedPattern < > > ( ExactPatternMatchingAutomaton::construct );
+auto ExactPatternMatchingAutomatonPrefixRankedPattern = registration::AbstractRegister < ExactPatternMatchingAutomaton, automaton::NPDA < >, const tree::PrefixRankedPattern < > & > ( ExactPatternMatchingAutomaton::construct );
 
 automaton::InputDrivenNPDA < > ExactPatternMatchingAutomaton::construct ( const tree::PrefixRankedBarTree < > & pattern ) {
 	return ExactSubtreeMatchingAutomaton::construct ( pattern );
 }
 
-auto ExactPatternMatchingAutomatonPrefixRankedBarTree = registration::OverloadRegister < ExactPatternMatchingAutomaton, automaton::InputDrivenNPDA < >, tree::PrefixRankedBarTree < > > ( ExactPatternMatchingAutomaton::construct );
+auto ExactPatternMatchingAutomatonPrefixRankedBarTree = registration::AbstractRegister < ExactPatternMatchingAutomaton, automaton::InputDrivenNPDA < >, const tree::PrefixRankedBarTree < > & > ( ExactPatternMatchingAutomaton::construct );
 
 automaton::VisiblyPushdownNPDA < > ExactPatternMatchingAutomaton::construct ( const tree::PrefixRankedBarPattern < > & pattern ) {
 	automaton::VisiblyPushdownNPDA < > res ( alphabet::BottomOfTheStackSymbol::instance < DefaultSymbolType > ( ) );
@@ -188,13 +184,13 @@ automaton::VisiblyPushdownNPDA < > ExactPatternMatchingAutomaton::construct ( co
 	return res;
 }
 
-auto ExactPatternMatchingAutomatonPrefixRankedBarPattern = registration::OverloadRegister < ExactPatternMatchingAutomaton, automaton::VisiblyPushdownNPDA < >, tree::PrefixRankedBarPattern < > > ( ExactPatternMatchingAutomaton::construct );
+auto ExactPatternMatchingAutomatonPrefixRankedBarPattern = registration::AbstractRegister < ExactPatternMatchingAutomaton, automaton::VisiblyPushdownNPDA < >, const tree::PrefixRankedBarPattern < > & > ( ExactPatternMatchingAutomaton::construct );
 
 automaton::NFTA < > ExactPatternMatchingAutomaton::construct ( const tree::RankedTree < > & pattern ) {
 	return ExactSubtreeMatchingAutomaton::construct ( pattern );
 }
 
-auto ExactPatternMatchingAutomatonRankedTree = registration::OverloadRegister < ExactPatternMatchingAutomaton, automaton::NFTA < >, tree::RankedTree < > > ( ExactPatternMatchingAutomaton::construct );
+auto ExactPatternMatchingAutomatonRankedTree = registration::AbstractRegister < ExactPatternMatchingAutomaton, automaton::NFTA < >, const tree::RankedTree < > & > ( ExactPatternMatchingAutomaton::construct );
 
 DefaultStateType constructRecursivePattern ( const ext::tree < common::ranked_symbol < > > & node, automaton::NFTA < > & res, const common::ranked_symbol < > & subtreeWildcard, const DefaultStateType & loopState, int & nextState ) {
 	if ( node.getData ( ) == subtreeWildcard ) {
@@ -253,7 +249,7 @@ automaton::NFTA < > ExactPatternMatchingAutomaton::construct ( const tree::Ranke
 	return res;
 }
 
-auto ExactPatternMatchingAutomatonRankedPattern = registration::OverloadRegister < ExactPatternMatchingAutomaton, automaton::NFTA < >, tree::RankedPattern < > > ( ExactPatternMatchingAutomaton::construct );
+auto ExactPatternMatchingAutomatonRankedPattern = registration::AbstractRegister < ExactPatternMatchingAutomaton, automaton::NFTA < >, const tree::RankedPattern < > & > ( ExactPatternMatchingAutomaton::construct );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp b/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp
index f74c9aa471..19497bb4eb 100644
--- a/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp
+++ b/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp
@@ -6,9 +6,7 @@
  */
 
 #include "ExactSubtreeAutomaton.h"
-#include <tree/Tree.h>
 #include <tree/ranked/PrefixRankedTree.h>
-#include <automaton/Automaton.h>
 #include <automaton/PDA/InputDrivenNPDA.h>
 #include <alphabet/RankedSymbol.h>
 
@@ -19,10 +17,6 @@ namespace arbology {
 
 namespace exact {
 
-automaton::Automaton ExactSubtreeAutomaton::construct ( const tree::Tree & text ) {
-	return dispatch ( text.getData ( ) );
-}
-
 automaton::InputDrivenNPDA < > ExactSubtreeAutomaton::construct ( const tree::PrefixRankedTree < > & tree ) {
 	DefaultSymbolType S = DefaultSymbolType ( 'S' );
 	automaton::InputDrivenNPDA < > res ( DefaultStateType ( 0 ), S );
@@ -47,7 +41,7 @@ automaton::InputDrivenNPDA < > ExactSubtreeAutomaton::construct ( const tree::Pr
 	return res;
 }
 
-auto ExactSubtreeAutomatonPrefixRankedTree = registration::OverloadRegister < ExactSubtreeAutomaton, automaton::InputDrivenNPDA < >, tree::PrefixRankedTree < > > ( ExactSubtreeAutomaton::construct );
+auto ExactSubtreeAutomatonPrefixRankedTree = registration::AbstractRegister < ExactSubtreeAutomaton, automaton::InputDrivenNPDA < >, const tree::PrefixRankedTree < > & > ( ExactSubtreeAutomaton::construct );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.h b/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.h
index 6ec24929ef..7024e6ba4f 100644
--- a/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.h
+++ b/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.h
@@ -10,20 +10,17 @@
 
 #include <automaton/AutomatonFeatures.h>
 #include <tree/TreeFeatures.h>
-#include <core/multipleDispatch.hpp>
 
 namespace arbology {
 
 namespace exact {
 
-class ExactSubtreeAutomaton : public alib::SingleDispatch < ExactSubtreeAutomaton, automaton::Automaton, const tree::TreeBase & > {
+class ExactSubtreeAutomaton {
 public:
 	/**
 	 * Performs conversion.
 	 * @return left regular grammar equivalent to source automaton.
 	 */
-	static automaton::Automaton construct ( const tree::Tree & tree );
-
 	static automaton::InputDrivenNPDA < > construct ( const tree::PrefixRankedTree < > & tree );
 
 };
diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatch.cpp b/alib2algo/src/arbology/exact/ExactSubtreeMatch.cpp
index 3cac9b7965..6f77462c47 100644
--- a/alib2algo/src/arbology/exact/ExactSubtreeMatch.cpp
+++ b/alib2algo/src/arbology/exact/ExactSubtreeMatch.cpp
@@ -12,14 +12,10 @@ namespace arbology {
 
 namespace exact {
 
-ext::set < unsigned > ExactSubtreeMatch::match ( const tree::Tree & subject, const tree::Tree & pattern ) {
-	return dispatch ( subject.getData ( ), pattern.getData ( ) );
-}
-
-auto ExactSubtreeMatchUnrankedTree = registration::OverloadRegister < ExactSubtreeMatch, ext::set < unsigned >, tree::UnrankedTree < > > ( ExactSubtreeMatch::match );
-auto ExactSubtreeMatchRankedTree = registration::OverloadRegister < ExactSubtreeMatch, ext::set < unsigned >, tree::RankedTree < > > ( ExactSubtreeMatch::match );
-auto ExactSubtreeMatchPrefixRankedTree = registration::OverloadRegister < ExactSubtreeMatch, ext::set < unsigned >, tree::PrefixRankedTree < > > ( ExactSubtreeMatch::match );
-auto ExactSubtreeMatchPrefixRankedBarTree = registration::OverloadRegister < ExactSubtreeMatch, ext::set < unsigned >, tree::PrefixRankedBarTree < > > ( ExactSubtreeMatch::match );
+auto ExactSubtreeMatchUnrankedTree = registration::AbstractRegister < ExactSubtreeMatch, ext::set < unsigned >, const tree::UnrankedTree < > &, const tree::UnrankedTree < > & > ( ExactSubtreeMatch::match );
+auto ExactSubtreeMatchRankedTree = registration::AbstractRegister < ExactSubtreeMatch, ext::set < unsigned >, const tree::RankedTree < > &, const tree::RankedTree < > & > ( ExactSubtreeMatch::match );
+auto ExactSubtreeMatchPrefixRankedTree = registration::AbstractRegister < ExactSubtreeMatch, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedTree < > & > ( ExactSubtreeMatch::match );
+auto ExactSubtreeMatchPrefixRankedBarTree = registration::AbstractRegister < ExactSubtreeMatch, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarTree < > & > ( ExactSubtreeMatch::match );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatch.h b/alib2algo/src/arbology/exact/ExactSubtreeMatch.h
index 78c170e379..2a53a4889b 100644
--- a/alib2algo/src/arbology/exact/ExactSubtreeMatch.h
+++ b/alib2algo/src/arbology/exact/ExactSubtreeMatch.h
@@ -13,10 +13,6 @@
 #include <deque>
 #include <foreach>
 
-#include <core/multipleDispatch.hpp>
-
-#include <tree/Tree.h>
-#include <tree/TreeFeatures.h>
 #include <alphabet/RankedSymbol.h>
 
 #include <tree/ranked/RankedTree.h>
@@ -28,14 +24,12 @@ namespace arbology {
 
 namespace exact {
 
-class ExactSubtreeMatch : public alib::PromotingDoubleDispatch<ExactSubtreeMatch, ext::set<unsigned>, const tree::TreeBase & > {
+class ExactSubtreeMatch {
 public:
 	/**
 	 * Performs conversion.
 	 * @return left regular grammar equivalent to source automaton.
 	 */
-	static ext::set<unsigned> match(const tree::Tree& subject, const tree::Tree& pattern);
-
 	template < class SymbolType >
 	static ext::set<unsigned> match(const tree::UnrankedTree < SymbolType > & subject, const tree::UnrankedTree < SymbolType > & pattern);
 	template < class SymbolType, class RankType >
diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp
index 1e3fce1d6a..b5c83ff4c7 100644
--- a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp
+++ b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp
@@ -22,10 +22,6 @@ namespace arbology {
 
 namespace exact {
 
-automaton::Automaton ExactSubtreeMatchingAutomaton::construct ( const tree::Tree & pattern ) {
-	return dispatch ( pattern.getData ( ) );
-}
-
 automaton::InputDrivenNPDA < > ExactSubtreeMatchingAutomaton::construct ( const tree::PrefixRankedTree < > & pattern ) {
 	automaton::InputDrivenNPDA < > res ( DefaultStateType ( 0 ), DefaultSymbolType ( 'S' ) );
 
@@ -50,7 +46,7 @@ automaton::InputDrivenNPDA < > ExactSubtreeMatchingAutomaton::construct ( const
 	return res;
 }
 
-auto ExactSubtreeMatchingAutomatonPrefixRankedTree = registration::OverloadRegister < ExactSubtreeMatchingAutomaton, automaton::InputDrivenNPDA < >, tree::PrefixRankedTree < > > ( ExactSubtreeMatchingAutomaton::construct );
+auto ExactSubtreeMatchingAutomatonPrefixRankedTree = registration::AbstractRegister < ExactSubtreeMatchingAutomaton, automaton::InputDrivenNPDA < >, const tree::PrefixRankedTree < > & > ( ExactSubtreeMatchingAutomaton::construct );
 
 automaton::InputDrivenNPDA < > ExactSubtreeMatchingAutomaton::construct ( const tree::PrefixRankedBarTree < > & pattern ) {
 	automaton::InputDrivenNPDA < > res ( DefaultStateType ( 0 ), alphabet::BottomOfTheStackSymbol::instance < DefaultSymbolType > ( ) );
@@ -82,7 +78,7 @@ automaton::InputDrivenNPDA < > ExactSubtreeMatchingAutomaton::construct ( const
 	return res;
 }
 
-auto ExactSubtreeMatchingAutomatonPrefixRankedBarTree = registration::OverloadRegister < ExactSubtreeMatchingAutomaton, automaton::InputDrivenNPDA < >, tree::PrefixRankedBarTree < > > ( ExactSubtreeMatchingAutomaton::construct );
+auto ExactSubtreeMatchingAutomatonPrefixRankedBarTree = registration::AbstractRegister < ExactSubtreeMatchingAutomaton, automaton::InputDrivenNPDA < >, const tree::PrefixRankedBarTree < > & > ( ExactSubtreeMatchingAutomaton::construct );
 
 DefaultStateType constructRecursive ( const ext::tree < common::ranked_symbol < > > & node, automaton::NFTA < > & res, int & nextState ) {
 	ext::vector < DefaultStateType > states;
@@ -107,7 +103,7 @@ automaton::NFTA < > ExactSubtreeMatchingAutomaton::construct ( const tree::Ranke
 	return res;
 }
 
-auto ExactSubtreeMatchingAutomatonRankedTree = registration::OverloadRegister < ExactSubtreeMatchingAutomaton, automaton::NFTA < >, tree::RankedTree < > > ( ExactSubtreeMatchingAutomaton::construct );
+auto ExactSubtreeMatchingAutomatonRankedTree = registration::AbstractRegister < ExactSubtreeMatchingAutomaton, automaton::NFTA < >, const tree::RankedTree < > & > ( ExactSubtreeMatchingAutomaton::construct );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.h b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.h
index f529eda722..1d50753d61 100644
--- a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.h
+++ b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.h
@@ -8,9 +8,7 @@
 #ifndef _EXACT_SUBTREE_MATCHING_AUTOMATON_H__
 #define _EXACT_SUBTREE_MATCHING_AUTOMATON_H__
 
-#include <automaton/Automaton.h>
 #include <automaton/AutomatonFeatures.h>
-#include <tree/Tree.h>
 #include <tree/TreeFeatures.h>
 #include <core/multipleDispatch.hpp>
 
@@ -18,14 +16,12 @@ namespace arbology {
 
 namespace exact {
 
-class ExactSubtreeMatchingAutomaton : public alib::SingleDispatch < ExactSubtreeMatchingAutomaton, automaton::Automaton, const tree::TreeBase & > {
+class ExactSubtreeMatchingAutomaton {
 public:
 	/**
 	 * Performs conversion.
 	 * @return left regular grammar equivalent to source automaton.
 	 */
-	static automaton::Automaton construct ( const tree::Tree & pattern );
-
 	static automaton::InputDrivenNPDA < > construct ( const tree::PrefixRankedTree < > & pattern );
 	static automaton::InputDrivenNPDA < > construct ( const tree::PrefixRankedBarTree < > & pattern );
 	static automaton::NFTA < > construct ( const tree::RankedTree < > & pattern );
diff --git a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp
index cf84e4d631..023bf22078 100644
--- a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp
+++ b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp
@@ -12,11 +12,7 @@ namespace arbology {
 
 namespace exact {
 
-automaton::Automaton ExactTreePatternAutomaton::construct ( const tree::RankedTreeWrapper & tree, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > & subtreeWildcard ) {
-	return dispatch ( tree.getData ( ), subtreeWildcard );
-}
-
-auto ExactTreePatternAutomatonPrefixRankedTree = registration::OverloadRegister < ExactTreePatternAutomaton, automaton::InputDrivenNPDA < common::ranked_symbol < DefaultSymbolType, DefaultRankType >, char, unsigned >, tree::PrefixRankedTree < > > ( ExactTreePatternAutomaton::construct );
+auto ExactTreePatternAutomatonPrefixRankedTree = registration::AbstractRegister < ExactTreePatternAutomaton, automaton::InputDrivenNPDA < common::ranked_symbol < DefaultSymbolType, DefaultRankType >, char, unsigned >, const tree::PrefixRankedTree < > &, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > & > ( ExactTreePatternAutomaton::construct );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h
index a0d413886b..63f3d6dc6e 100644
--- a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h
+++ b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.h
@@ -9,32 +9,25 @@
 #define _EXACT_TREE_PATTERN_AUTOMATON_H__
 
 #include <alphabet/SubtreeWildcardSymbol.h>
-#include <tree/RankedTreeWrapper.h>
 #include <tree/ranked/PrefixRankedTree.h>
-#include <automaton/Automaton.h>
 #include <automaton/PDA/InputDrivenNPDA.h>
 
 #include <deque>
 #include <primitive/Character.h>
 #include <primitive/Unsigned.h>
 
-#include <core/multipleDispatch.hpp>
-
 namespace arbology {
 
 namespace exact {
 
-class ExactTreePatternAutomaton : public alib::SingleDispatch < ExactTreePatternAutomaton, automaton::Automaton, const tree::RankedTreeBase &, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > & > {
+class ExactTreePatternAutomaton {
 public:
 	/**
 	 * Performs conversion.
 	 * @return left regular grammar equivalent to source automaton.
 	 */
-	static automaton::Automaton construct ( const tree::RankedTreeWrapper & tree, const common::ranked_symbol < DefaultSymbolType, DefaultRankType > & subtreeWildcard );
-
 	template < class SymbolType, class RankType >
 	static automaton::InputDrivenNPDA < common::ranked_symbol < SymbolType, RankType >, char, unsigned > construct ( const tree::PrefixRankedTree < SymbolType, RankType > & tree, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard );
-
 };
 
 template < class SymbolType, class RankType >
diff --git a/alib2algo/src/arbology/exact/KnuthMorrisPratt.cpp b/alib2algo/src/arbology/exact/KnuthMorrisPratt.cpp
index de35ff6551..73dcf66045 100644
--- a/alib2algo/src/arbology/exact/KnuthMorrisPratt.cpp
+++ b/alib2algo/src/arbology/exact/KnuthMorrisPratt.cpp
@@ -22,15 +22,11 @@ namespace arbology {
 
 namespace exact {
 
-ext::set < unsigned > KnuthMorrisPratt::match ( const tree::Tree & subject, const tree::Tree & pattern ) {
-	return dispatch ( subject.getData ( ), pattern.getData ( ) );
-}
-
 ext::set < unsigned > KnuthMorrisPratt::match ( const tree::PrefixRankedBarTree < > & subject, const tree::PrefixRankedBarTree < > & pattern ) {
 	return match ( subject, tree::PrefixRankedBarPattern < > ( pattern ) );
 }
 
-auto KnuthMorrisPrattPrefixRankedBarTreePrefixRankedBarTree = registration::OverloadRegister < KnuthMorrisPratt, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarTree < > > ( KnuthMorrisPratt::match );
+auto KnuthMorrisPrattPrefixRankedBarTreePrefixRankedBarTree = registration::AbstractRegister < KnuthMorrisPratt, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarTree < > & > ( KnuthMorrisPratt::match );
 
 ext::set < unsigned > KnuthMorrisPratt::match ( const tree::PrefixRankedBarTree < > & subject, const tree::PrefixRankedBarPattern < > & pattern ) {
 	ext::set < unsigned > occ;
@@ -73,13 +69,13 @@ ext::set < unsigned > KnuthMorrisPratt::match ( const tree::PrefixRankedBarTree
 	return occ;
 }
 
-auto KnuthMorrisPrattPrefixRankedBarTreePrefixRankedBarPattern = registration::OverloadRegister < KnuthMorrisPratt, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarPattern < > > ( KnuthMorrisPratt::match );
+auto KnuthMorrisPrattPrefixRankedBarTreePrefixRankedBarPattern = registration::AbstractRegister < KnuthMorrisPratt, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarPattern < > & > ( KnuthMorrisPratt::match );
 
 ext::set < unsigned > KnuthMorrisPratt::match ( const tree::PrefixRankedTree < > & subject, const tree::PrefixRankedTree < > & pattern ) {
 	return match ( subject, tree::PrefixRankedPattern < > ( pattern ) );
 }
 
-auto KnuthMorrisPrattPrefixRankedTreePrefixRankedTree = registration::OverloadRegister < KnuthMorrisPratt, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedTree < > > ( KnuthMorrisPratt::match );
+auto KnuthMorrisPrattPrefixRankedTreePrefixRankedTree = registration::AbstractRegister < KnuthMorrisPratt, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedTree < > & > ( KnuthMorrisPratt::match );
 
 ext::set < unsigned > KnuthMorrisPratt::match ( const tree::PrefixRankedTree < > & subject, const tree::PrefixRankedPattern < > & pattern ) {
 	ext::set < unsigned > occ;
@@ -122,7 +118,7 @@ ext::set < unsigned > KnuthMorrisPratt::match ( const tree::PrefixRankedTree < >
 	return occ;
 }
 
-auto KnuthMorrisPrattPrefixRankedTreePrefixRankedPattern = registration::OverloadRegister < KnuthMorrisPratt, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedPattern < > > ( KnuthMorrisPratt::match );
+auto KnuthMorrisPrattPrefixRankedTreePrefixRankedPattern = registration::AbstractRegister < KnuthMorrisPratt, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedPattern < > & > ( KnuthMorrisPratt::match );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.cpp b/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.cpp
index 453a56a00a..f8c729310b 100644
--- a/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.cpp
+++ b/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.cpp
@@ -12,16 +12,12 @@ namespace arbology {
 
 namespace exact {
 
-ext::set < unsigned > ReversedBoyerMooreHorspool::match ( const tree::Tree & subject, const tree::Tree & pattern ) {
-	return dispatch ( subject.getData ( ), pattern.getData ( ) );
-}
-
-auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarTree = registration::OverloadRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarTree < > > ( ReversedBoyerMooreHorspool::match );
-auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarPattern = registration::OverloadRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarPattern < > > ( ReversedBoyerMooreHorspool::match );
-auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarNonlinearPattern = registration::OverloadRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedBarTree < >, tree::PrefixRankedBarNonlinearPattern < > > ( ReversedBoyerMooreHorspool::match );
-auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedTree = registration::OverloadRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedTree < > > ( ReversedBoyerMooreHorspool::match );
-auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedPattern = registration::OverloadRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedPattern < > > ( ReversedBoyerMooreHorspool::match );
-auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedNonlinearPattern = registration::OverloadRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, tree::PrefixRankedTree < >, tree::PrefixRankedNonlinearPattern < > > ( ReversedBoyerMooreHorspool::match );
+auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarTree = registration::AbstractRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarTree < > & > ( ReversedBoyerMooreHorspool::match );
+auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarPattern = registration::AbstractRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarPattern < > & > ( ReversedBoyerMooreHorspool::match );
+auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedBarNonlinearPattern = registration::AbstractRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const tree::PrefixRankedBarNonlinearPattern < > & > ( ReversedBoyerMooreHorspool::match );
+auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedTree = registration::AbstractRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedTree < > & > ( ReversedBoyerMooreHorspool::match );
+auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedPattern = registration::AbstractRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedPattern < > & > ( ReversedBoyerMooreHorspool::match );
+auto ReversedBoyerMooreHorspoolPrefixRankedBarTreePrefixRankedNonlinearPattern = registration::AbstractRegister < ReversedBoyerMooreHorspool, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const tree::PrefixRankedNonlinearPattern < > & > ( ReversedBoyerMooreHorspool::match );
 
 } /* namespace exact */
 
diff --git a/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.h b/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.h
index 6f7f324425..a6953ed08c 100644
--- a/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.h
+++ b/alib2algo/src/arbology/exact/ReversedBoyerMooreHorspool.h
@@ -9,14 +9,10 @@
 #define _ARBOLOGY_REVERSED_BOYER_MOORE_HORSPOOL_H_
 
 #include <set>
-#include <core/multipleDispatch.hpp>
-#include <tree/TreeFeatures.h>
-
 #include <tree/properties/ReversedBadCharacterShiftTable.h>
 #include <tree/properties/SubtreeJumpTable.h>
 #include <tree/properties/ExactSubtreeRepeatsNaive.h>
 
-#include <tree/Tree.h>
 #include <tree/ranked/PrefixRankedTree.h>
 #include <tree/ranked/PrefixRankedBarTree.h>
 #include <tree/ranked/PrefixRankedPattern.h>
@@ -35,14 +31,12 @@ namespace exact {
  * Implementation of BMH for MI(E+\eps)-EVY course 2014
  * To get rid of zeros in BCS table we ignore last haystack character
  */
-class ReversedBoyerMooreHorspool : public alib::DoubleDispatch <ReversedBoyerMooreHorspool,  ext::set < unsigned >, const tree::TreeBase &, const tree::TreeBase & > {
+class ReversedBoyerMooreHorspool {
 public:
 	/**
 	 * Search for pattern in linear string.
 	 * @return set set of occurences
 	 */
-	static ext::set < unsigned > match ( const tree::Tree & subject, const tree::Tree & pattern );
-
 	template < class SymbolType, class RankType >
 	static ext::set < unsigned > match ( const tree::PrefixRankedBarTree < SymbolType, RankType > & subject, const tree::PrefixRankedBarTree < SymbolType, RankType > & pattern );
 	template < class SymbolType, class RankType >
diff --git a/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.cpp b/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.cpp
index 25b52da868..7320eee57a 100644
--- a/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.cpp
+++ b/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.cpp
@@ -12,13 +12,9 @@ namespace arbology {
 
 namespace indexing {
 
-indexes::arbology::CompressedBitParallelTreeIndex < > CompressedBitParallelIndexConstruction::construct ( const tree::RankedTreeWrapper & tree ) {
-	return dispatch ( tree.getData ( ) );
-}
+auto compressedBitParallelIndexConstructionPrefixRankedTree = registration::AbstractRegister < CompressedBitParallelIndexConstruction, indexes::arbology::CompressedBitParallelTreeIndex < DefaultSymbolType, DefaultRankType >, const tree::PrefixRankedTree < > & > ( CompressedBitParallelIndexConstruction::construct );
 
-auto compressedBitParallelIndexConstructionPrefixRankedTree = registration::OverloadRegister < CompressedBitParallelIndexConstruction, indexes::arbology::CompressedBitParallelTreeIndex < >, tree::PrefixRankedTree < > > ( CompressedBitParallelIndexConstruction::construct );
-
-auto compressedBitParallelIndexConstructionPrefixRankedBarTree = registration::OverloadRegister < CompressedBitParallelIndexConstruction, indexes::arbology::CompressedBitParallelTreeIndex < >, tree::PrefixRankedBarTree < > > ( CompressedBitParallelIndexConstruction::construct );
+auto compressedBitParallelIndexConstructionPrefixRankedBarTree = registration::AbstractRegister < CompressedBitParallelIndexConstruction, indexes::arbology::CompressedBitParallelTreeIndex < DefaultSymbolType, DefaultRankType >, const tree::PrefixRankedBarTree < > & > ( CompressedBitParallelIndexConstruction::construct );
 
 } /* namespace indexing */
 
diff --git a/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.h b/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.h
index 89ec56906a..5608225183 100644
--- a/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.h
+++ b/alib2algo/src/arbology/indexing/CompressedBitParallelIndexConstruction.h
@@ -9,10 +9,8 @@
 #define ARBOLOGY_COMPRESSED_BIT_PARALLEL_INDEX_CONSTRUCTION_H_
 
 #include <indexes/arbology/CompressedBitParallelTreeIndex.h>
-#include <tree/RankedTreeWrapper.h>
 #include <tree/ranked/PrefixRankedTree.h>
 #include <tree/ranked/PrefixRankedBarTree.h>
-#include <core/multipleDispatch.hpp>
 #include <exception/CommonException.h>
 #include <tree/properties/SubtreeJumpTable.h>
 
@@ -25,15 +23,13 @@ namespace indexing {
  *
  */
 
-class CompressedBitParallelIndexConstruction : public alib::SingleDispatch < CompressedBitParallelIndexConstruction, indexes::arbology::CompressedBitParallelTreeIndex < >, const tree::RankedTreeBase & > {
+class CompressedBitParallelIndexConstruction {
 public:
 	/**
 	 * Creates compressed bit parallel index for trees
 	 * @param tree tree to construct the index for
 	 * @return the index
 	 */
-	static indexes::arbology::CompressedBitParallelTreeIndex < > construct ( const tree::RankedTreeWrapper & tree );
-
 	template < class SymbolType, class RankType >
 	static indexes::arbology::CompressedBitParallelTreeIndex < SymbolType, RankType > construct ( const tree::PrefixRankedTree < SymbolType, RankType > & tree );
 
diff --git a/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.cpp b/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.cpp
index d0692f3af3..e58e8328d7 100644
--- a/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.cpp
+++ b/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.cpp
@@ -12,12 +12,9 @@ namespace arbology {
 
 namespace indexing {
 
-indexes::arbology::FullAndLinearIndex < > FullAndLinearIndexConstruction::construct ( const tree::RankedTreeWrapper & tree ) {
-	return dispatch ( tree.getData ( ) );
-}
+auto fullAndLinearIndexConstructionPrefixRankedTree = registration::AbstractRegister < FullAndLinearIndexConstruction, indexes::arbology::FullAndLinearIndex < DefaultSymbolType, DefaultRankType >, const tree::PrefixRankedTree < > & > ( FullAndLinearIndexConstruction::construct );
 
-auto fullAndLinearIndexConstructionPrefixRankedTree = registration::OverloadRegister < FullAndLinearIndexConstruction, indexes::arbology::FullAndLinearIndex < >, tree::PrefixRankedTree < > > ( FullAndLinearIndexConstruction::construct );
-auto fullAndLinearIndexConstructionPrefixRankedBarTree = registration::OverloadRegister < FullAndLinearIndexConstruction, indexes::arbology::FullAndLinearIndex < >, tree::PrefixRankedBarTree < > > ( FullAndLinearIndexConstruction::construct );
+auto fullAndLinearIndexConstructionPrefixRankedBarTree = registration::AbstractRegister < FullAndLinearIndexConstruction, indexes::arbology::FullAndLinearIndex < DefaultSymbolType, DefaultRankType >, const tree::PrefixRankedBarTree < > & > ( FullAndLinearIndexConstruction::construct );
 
 } /* namespace indexing */
 
diff --git a/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.h b/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.h
index 8131ce1061..46d376ea5b 100644
--- a/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.h
+++ b/alib2algo/src/arbology/indexing/FullAndLinearIndexConstruction.h
@@ -9,10 +9,8 @@
 #define ARBOLOGY_FULL_AND_LINEAR_INDEX_CONSTRUCTION_H_
 
 #include <indexes/arbology/FullAndLinearIndex.h>
-#include <tree/RankedTreeWrapper.h>
 #include <tree/ranked/PrefixRankedTree.h>
 #include <tree/ranked/PrefixRankedBarTree.h>
-#include <core/multipleDispatch.hpp>
 #include <tree/properties/SubtreeJumpTable.h>
 #include <stringology/indexing/PositionHeapNaive.h>
 
@@ -25,15 +23,13 @@ namespace indexing {
  *
  */
 
-class FullAndLinearIndexConstruction : public alib::SingleDispatch < FullAndLinearIndexConstruction, indexes::arbology::FullAndLinearIndex < >, const tree::RankedTreeBase & > {
+class FullAndLinearIndexConstruction {
 public:
 	/**
 	 * Creates compressed bit parallel index for trees
 	 * @param tree tree to construct the index for
 	 * @return the index
 	 */
-	static indexes::arbology::FullAndLinearIndex < > construct ( const tree::RankedTreeWrapper & tree );
-
 	template < class SymbolType, class RankType >
 	static indexes::arbology::FullAndLinearIndex < SymbolType, RankType > construct ( const tree::PrefixRankedTree < SymbolType, RankType > & tree );
 
diff --git a/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.cpp b/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.cpp
index 3f99b22543..36138a1a7f 100644
--- a/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.cpp
+++ b/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.cpp
@@ -12,11 +12,7 @@ namespace arbology {
 
 namespace indexing {
 
-indexes::arbology::NonlinearCompressedBitParallelTreeIndex < > NonlinearCompressedBitParallelIndexConstruction::construct ( const tree::RankedTreeWrapper & tree ) {
-	return dispatch ( tree.getData ( ) );
-}
-
-auto nonlinearcompressedBitParallelIndexConstructionPrefixRankedBarTree = registration::OverloadRegister < NonlinearCompressedBitParallelIndexConstruction, indexes::arbology::NonlinearCompressedBitParallelTreeIndex < >, tree::PrefixRankedBarTree < > > ( NonlinearCompressedBitParallelIndexConstruction::construct );
+auto nonlinearcompressedBitParallelIndexConstructionPrefixRankedBarTree = registration::AbstractRegister < NonlinearCompressedBitParallelIndexConstruction, indexes::arbology::NonlinearCompressedBitParallelTreeIndex < >, const tree::PrefixRankedBarTree < > & > ( NonlinearCompressedBitParallelIndexConstruction::construct );
 
 } /* namespace indexing */
 
diff --git a/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.h b/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.h
index 555aecfdd8..0ac504d5b8 100644
--- a/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.h
+++ b/alib2algo/src/arbology/indexing/NonlinearCompressedBitParallelIndexConstruction.h
@@ -9,9 +9,7 @@
 #define ARBOLOGY_NONLINEAR_COMPRESSED_BIT_PARALLEL_INDEX_CONSTRUCTION_H_
 
 #include <indexes/arbology/NonlinearCompressedBitParallelTreeIndex.h>
-#include <tree/RankedTreeWrapper.h>
 #include <tree/ranked/PrefixRankedBarTree.h>
-#include <core/multipleDispatch.hpp>
 #include <exception/CommonException.h>
 #include <tree/properties/SubtreeJumpTable.h>
 #include <tree/properties/ExactSubtreeRepeatsNaive.h>
@@ -25,15 +23,13 @@ namespace indexing {
  *
  */
 
-class NonlinearCompressedBitParallelIndexConstruction : public alib::SingleDispatch < NonlinearCompressedBitParallelIndexConstruction, indexes::arbology::NonlinearCompressedBitParallelTreeIndex < >, const tree::RankedTreeBase & > {
+class NonlinearCompressedBitParallelIndexConstruction {
 public:
 	/**
 	 * Creates nonlinear compressed bit parallel index for trees
 	 * @param tree tree to construct the index for
 	 * @return the index
 	 */
-	static indexes::arbology::NonlinearCompressedBitParallelTreeIndex < > construct ( const tree::RankedTreeWrapper & tree );
-
 	template < class SymbolType, class RankType >
 	static indexes::arbology::NonlinearCompressedBitParallelTreeIndex < SymbolType, RankType > construct ( const tree::PrefixRankedBarTree < SymbolType, RankType > & tree );
 };
diff --git a/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.cpp b/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.cpp
index d0004c9256..50860bf3a9 100644
--- a/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.cpp
+++ b/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.cpp
@@ -12,12 +12,9 @@ namespace arbology {
 
 namespace indexing {
 
-indexes::arbology::NonlinearFullAndLinearIndex < > NonlinearFullAndLinearIndexConstruction::construct ( const tree::RankedTreeWrapper & tree ) {
-	return dispatch ( tree.getData ( ) );
-}
+auto nonlinearFullAndLinearIndexConstructionPrefixRankedTree = registration::AbstractRegister < NonlinearFullAndLinearIndexConstruction, indexes::arbology::NonlinearFullAndLinearIndex < >, const tree::PrefixRankedTree < > & > ( NonlinearFullAndLinearIndexConstruction::construct );
 
-auto nonlinearFullAndLinearIndexConstructionPrefixRankedTree = registration::OverloadRegister < NonlinearFullAndLinearIndexConstruction, indexes::arbology::NonlinearFullAndLinearIndex < >, tree::PrefixRankedTree < > > ( NonlinearFullAndLinearIndexConstruction::construct );
-auto nonlinearFullAndLinearIndexConstructionPrefixRankedBarTree = registration::OverloadRegister < NonlinearFullAndLinearIndexConstruction, indexes::arbology::NonlinearFullAndLinearIndex < >, tree::PrefixRankedBarTree < > > ( NonlinearFullAndLinearIndexConstruction::construct );
+auto nonlinearFullAndLinearIndexConstructionPrefixRankedBarTree = registration::AbstractRegister < NonlinearFullAndLinearIndexConstruction, indexes::arbology::NonlinearFullAndLinearIndex < >, const tree::PrefixRankedBarTree < > & > ( NonlinearFullAndLinearIndexConstruction::construct );
 
 } /* namespace indexing */
 
diff --git a/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.h b/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.h
index efad54cf49..bae064d733 100644
--- a/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.h
+++ b/alib2algo/src/arbology/indexing/NonlinearFullAndLinearIndexConstruction.h
@@ -9,9 +9,7 @@
 #define ARBOLOGY_NONLINEAR_FULL_AND_LINEAR_INDEX_CONSTRUCTION_H_
 
 #include <indexes/arbology/NonlinearFullAndLinearIndex.h>
-#include <tree/RankedTreeWrapper.h>
 #include <tree/ranked/PrefixRankedTree.h>
-#include <core/multipleDispatch.hpp>
 #include <tree/properties/SubtreeJumpTable.h>
 #include <tree/properties/ExactSubtreeRepeatsNaive.h>
 #include <stringology/indexing/PositionHeapNaive.h>
@@ -25,15 +23,13 @@ namespace indexing {
  *
  */
 
-class NonlinearFullAndLinearIndexConstruction : public alib::SingleDispatch < NonlinearFullAndLinearIndexConstruction, indexes::arbology::NonlinearFullAndLinearIndex < >, const tree::RankedTreeBase & > {
+class NonlinearFullAndLinearIndexConstruction {
 public:
 	/**
 	 * Creates compressed bit parallel index for trees
 	 * @param tree tree to construct the index for
 	 * @return the index
 	 */
-	static indexes::arbology::NonlinearFullAndLinearIndex < > construct ( const tree::RankedTreeWrapper & tree );
-
 	template < class SymbolType, class RankType >
 	static indexes::arbology::NonlinearFullAndLinearIndex < SymbolType, RankType > construct ( const tree::PrefixRankedTree < SymbolType, RankType > & tree );
 
diff --git a/alib2algo/src/arbology/transform/BeginToEndIndex.cpp b/alib2algo/src/arbology/transform/BeginToEndIndex.cpp
index 304af5f176..4057463777 100644
--- a/alib2algo/src/arbology/transform/BeginToEndIndex.cpp
+++ b/alib2algo/src/arbology/transform/BeginToEndIndex.cpp
@@ -12,12 +12,8 @@ namespace arbology {
 
 namespace transform {
 
-ext::set < unsigned > BeginToEndIndex::transform ( const tree::Tree & subject, const ext::set < unsigned > & indexes ) {
-	return dispatch ( subject.getData ( ), indexes );
-}
-
-auto BeginToEndIndexPrefixRankedBarTreePrefixRankedBarTree = registration::OverloadRegister < BeginToEndIndex, ext::set < unsigned >, tree::PrefixRankedBarTree < > > ( BeginToEndIndex::transform );
-auto BeginToEndIndexPrefixRankedBarTreePrefixRankedBarPattern = registration::OverloadRegister < BeginToEndIndex, ext::set < unsigned >, tree::PrefixRankedTree < > > ( BeginToEndIndex::transform );
+auto BeginToEndIndexPrefixRankedBarTreePrefixRankedBarTree = registration::AbstractRegister < BeginToEndIndex, ext::set < unsigned >, const tree::PrefixRankedBarTree < > &, const ext::set < unsigned > & > ( BeginToEndIndex::transform );
+auto BeginToEndIndexPrefixRankedBarTreePrefixRankedBarPattern = registration::AbstractRegister < BeginToEndIndex, ext::set < unsigned >, const tree::PrefixRankedTree < > &, const ext::set < unsigned > & > ( BeginToEndIndex::transform );
 
 } /* namespace transform */
 
diff --git a/alib2algo/src/arbology/transform/BeginToEndIndex.h b/alib2algo/src/arbology/transform/BeginToEndIndex.h
index 0fbdc15414..b8923b085b 100644
--- a/alib2algo/src/arbology/transform/BeginToEndIndex.h
+++ b/alib2algo/src/arbology/transform/BeginToEndIndex.h
@@ -9,12 +9,8 @@
 #define _ARBOLOGY_BEGIN_TO_END_INDEX_H_
 
 #include <set>
-#include <core/multipleDispatch.hpp>
-#include <tree/TreeFeatures.h>
-
 #include <tree/properties/SubtreeJumpTable.h>
 
-#include <tree/Tree.h>
 #include <tree/ranked/PrefixRankedBarTree.h>
 #include <tree/ranked/PrefixRankedTree.h>
 
@@ -24,14 +20,12 @@ namespace transform {
 
 /**
  */
-class BeginToEndIndex : public alib::SingleDispatch < BeginToEndIndex, ext::set < unsigned >, const tree::TreeBase &, const ext::set < unsigned > & > {
+class BeginToEndIndex {
 public:
 	/**
 	 * Search for pattern in linear string.
 	 * @return set set of occurences
 	 */
-	static ext::set < unsigned > transform ( const tree::Tree & subject, const ext::set < unsigned > & indexes );
-
 	template < class SymbolType, class RankType >
 	static ext::set < unsigned > transform ( const tree::PrefixRankedBarTree < SymbolType, RankType > & subject, const ext::set < unsigned > & indexes );
 	template < class SymbolType, class RankType >
diff --git a/alib2algo/src/tree/NormalizeTreeLabels.cpp b/alib2algo/src/tree/NormalizeTreeLabels.cpp
index ad56aaeeb2..b5e4397a87 100644
--- a/alib2algo/src/tree/NormalizeTreeLabels.cpp
+++ b/alib2algo/src/tree/NormalizeTreeLabels.cpp
@@ -6,15 +6,10 @@
  */
 
 #include "NormalizeTreeLabels.h"
-#include <tree/Tree.h>
 #include <registration/AlgoRegistration.hpp>
 
 namespace tree {
 
-tree::Tree NormalizeTreeLabels::normalize ( const tree::Tree & tree ) {
-	return dispatch ( tree.getData ( ) );
-}
-
-auto NormalizeTreeLabelsRankedTree = registration::OverloadRegister < NormalizeTreeLabels, tree::RankedTree < unsigned, DefaultRankType >, tree::RankedTree < > > ( NormalizeTreeLabels::normalize );
+auto NormalizeTreeLabelsRankedTree = registration::AbstractRegister < NormalizeTreeLabels, tree::RankedTree < unsigned, DefaultRankType >, const tree::RankedTree < > & > ( NormalizeTreeLabels::normalize );
 
 } /* namespace tree */
diff --git a/alib2algo/src/tree/NormalizeTreeLabels.h b/alib2algo/src/tree/NormalizeTreeLabels.h
index 91bd25f382..c1d79f48b4 100644
--- a/alib2algo/src/tree/NormalizeTreeLabels.h
+++ b/alib2algo/src/tree/NormalizeTreeLabels.h
@@ -8,7 +8,6 @@
 #ifndef _ARBOLOGY_NORMALIZE_TREE_LABELS_H_
 #define _ARBOLOGY_NORMALIZE_TREE_LABELS_H_
 
-#include <tree/TreeFeatures.h>
 #include <alphabet/SymbolFeatures.h>
 #include <core/multipleDispatch.hpp>
 
@@ -28,17 +27,11 @@ namespace tree {
 /**
  * Simple computation of subtree repeats
  */
-class NormalizeTreeLabels : public alib::SingleDispatch < NormalizeTreeLabels, tree::Tree, const tree::TreeBase & > {
+class NormalizeTreeLabels {
 	template < class SymbolType, class RankType >
 	static ext::tree < common::ranked_symbol < unsigned, RankType > > normalize ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree, ext::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & mapping, unsigned & counter );
 
 public:
-	/**
-	 * Compute a same shaped tree with nodes containing unique subtree ids.
-	 * @return Tree of repeats
-	 */
-	static tree::Tree normalize ( const tree::Tree & pattern );
-
 	/**
 	 * Compute a same shaped tree with nodes containing unique subtree ids.
 	 * @return Tree of repeats
diff --git a/alib2algo/src/tree/properties/BadCharacterShiftTable.cpp b/alib2algo/src/tree/properties/BadCharacterShiftTable.cpp
index 51e5cba802..9ddeb1a638 100644
--- a/alib2algo/src/tree/properties/BadCharacterShiftTable.cpp
+++ b/alib2algo/src/tree/properties/BadCharacterShiftTable.cpp
@@ -6,21 +6,14 @@
  */
 
 #include "BadCharacterShiftTable.h"
-
-#include <tree/ranked/PrefixRankedBarPattern.h>
-#include <tree/ranked/PrefixRankedBarNonlinearPattern.h>
 #include <registration/AlgoRegistration.hpp>
 
 namespace tree {
 
 namespace properties {
 
-ext::map < common::ranked_symbol < >, size_t > BadCharacterShiftTable::bcs ( const tree::RankedTreeWrapper & pattern ) {
-	return dispatch ( pattern.getData ( ) );
-}
-
-auto BadCharacterShiftTablePrefixRankedBarPattern = registration::OverloadRegister < BadCharacterShiftTable, ext::map < common::ranked_symbol < >, size_t >, tree::PrefixRankedBarPattern < > > ( BadCharacterShiftTable::bcs );
-auto BadCharacterShiftTablePrefixRankedBarNonlinearPattern = registration::OverloadRegister < BadCharacterShiftTable, ext::map < common::ranked_symbol < >, size_t >, tree::PrefixRankedBarNonlinearPattern < > > ( BadCharacterShiftTable::bcs );
+auto BadCharacterShiftTablePrefixRankedBarPattern = registration::AbstractRegister < BadCharacterShiftTable, ext::map < common::ranked_symbol < >, size_t >, const tree::PrefixRankedBarPattern < > & > ( BadCharacterShiftTable::bcs );
+auto BadCharacterShiftTablePrefixRankedBarNonlinearPattern = registration::AbstractRegister < BadCharacterShiftTable, ext::map < common::ranked_symbol < >, size_t >, const tree::PrefixRankedBarNonlinearPattern < > & > ( BadCharacterShiftTable::bcs );
 
 } /* namespace properties */
 
diff --git a/alib2algo/src/tree/properties/BadCharacterShiftTable.h b/alib2algo/src/tree/properties/BadCharacterShiftTable.h
index e6ad376657..e351dbba7c 100644
--- a/alib2algo/src/tree/properties/BadCharacterShiftTable.h
+++ b/alib2algo/src/tree/properties/BadCharacterShiftTable.h
@@ -8,10 +8,9 @@
 #ifndef _ARBOLOGY_BAD_CHARACTER_SHIFT_TABLE_H_
 #define _ARBOLOGY_BAD_CHARACTER_SHIFT_TABLE_H_
 
-#include <tree/RankedTreeWrapper.h>
-#include <tree/TreeFeatures.h>
-#include <core/multipleDispatch.hpp>
 #include <alphabet/RankedSymbol.h>
+#include <tree/ranked/PrefixRankedBarPattern.h>
+#include <tree/ranked/PrefixRankedBarNonlinearPattern.h>
 
 #include <set>
 #include <map>
@@ -24,7 +23,7 @@ namespace properties {
  * Computation of BCS table for BMH from MI(E+\eps)-EVY course 2014
  * To get rid of zeros in BCS table we ignore last haystack character
  */
-class BadCharacterShiftTable : public alib::SingleDispatch < BadCharacterShiftTable, ext::map < common::ranked_symbol < >, size_t >, const tree::RankedTreeBase & > {
+class BadCharacterShiftTable {
 public:
 	/**
 	 * Search for pattern in linear string.
diff --git a/alib2algo/src/tree/properties/ExactSubtreeRepeats.cpp b/alib2algo/src/tree/properties/ExactSubtreeRepeats.cpp
index fda17f58fc..f8357d6430 100644
--- a/alib2algo/src/tree/properties/ExactSubtreeRepeats.cpp
+++ b/alib2algo/src/tree/properties/ExactSubtreeRepeats.cpp
@@ -6,18 +6,13 @@
  */
 
 #include "ExactSubtreeRepeats.h"
-#include <tree/Tree.h>
 #include <registration/AlgoRegistration.hpp>
 
 namespace tree {
 
 namespace properties {
 
-tree::Tree ExactSubtreeRepeats::repeats ( const tree::Tree & tree ) {
-	return dispatch ( tree.getData ( ) );
-}
-
-auto ExactRepeatsPostfixRankedTree = registration::OverloadRegister < ExactSubtreeRepeats, tree::PostfixRankedTree < unsigned, DefaultRankType >, tree::PostfixRankedTree < > > ( ExactSubtreeRepeats::repeats );
+auto ExactRepeatsPostfixRankedTree = registration::AbstractRegister < ExactSubtreeRepeats, tree::PostfixRankedTree < unsigned, DefaultRankType >, const tree::PostfixRankedTree < > & > ( ExactSubtreeRepeats::repeats );
 
 } /* namespace properties */
 
diff --git a/alib2algo/src/tree/properties/ExactSubtreeRepeats.h b/alib2algo/src/tree/properties/ExactSubtreeRepeats.h
index dec06172be..0fcd939580 100644
--- a/alib2algo/src/tree/properties/ExactSubtreeRepeats.h
+++ b/alib2algo/src/tree/properties/ExactSubtreeRepeats.h
@@ -9,8 +9,6 @@
 #define _ARBOLOGY_SUBTREE_REPEATS_H_
 
 #include <alphabet/SymbolFeatures.h>
-#include <core/multipleDispatch.hpp>
-#include <tree/TreeFeatures.h>
 
 #include <alphabet/RankedSymbol.h>
 #include <deque>
@@ -34,7 +32,7 @@ namespace properties {
 /**
  * Dynamic computation of subtree repeats
  */
-class ExactSubtreeRepeats : public alib::SingleDispatch < ExactSubtreeRepeats, tree::Tree, const tree::TreeBase & > {
+class ExactSubtreeRepeats {
 
 	/**
 	 *  A nested class to hold and efficiently pass auxiliary arrays
@@ -116,12 +114,6 @@ class ExactSubtreeRepeats : public alib::SingleDispatch < ExactSubtreeRepeats, t
 	static void partition ( ext::tuple < ext::deque < unsigned >, unsigned, int > triplet, const ext::vector < common::ranked_symbol < SymbolType, RankType > > & symbols, ExactSubtreeRepeats::ExactSubtreeRepeatsAux & aux );
 
 public:
-	/**
-	 * Compute a same shaped tree with nodes containing unique subtree ids.
-	 * @return Tree of repeats
-	 */
-	static tree::Tree repeats ( const tree::Tree & pattern );
-
 	/**
 	 * Compute a same shaped tree with nodes containing unique subtree ids.
 	 * @return Tree of repeats
diff --git a/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.cpp b/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.cpp
index 4f8a62cb2a..69167ec4ea 100644
--- a/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.cpp
+++ b/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.cpp
@@ -6,21 +6,16 @@
  */
 
 #include "ExactSubtreeRepeatsNaive.h"
-#include <tree/Tree.h>
 #include <registration/AlgoRegistration.hpp>
 
 namespace tree {
 
 namespace properties {
 
-tree::Tree ExactSubtreeRepeatsNaive::repeats ( const tree::Tree & tree ) {
-	return dispatch ( tree.getData ( ) );
-}
-
-auto ExactRepeatsNaiveRankedTree = registration::OverloadRegister < ExactSubtreeRepeatsNaive, tree::RankedTree < unsigned, DefaultRankType >, tree::RankedTree < > > ( ExactSubtreeRepeatsNaive::repeats );
-auto ExactRepeatsNaivePrefixRankedTree = registration::OverloadRegister < ExactSubtreeRepeatsNaive, tree::PrefixRankedTree < unsigned, DefaultRankType >, tree::PrefixRankedTree < > > ( ExactSubtreeRepeatsNaive::repeats );
-auto ExactRepeatsNaivePostfixRankedTree = registration::OverloadRegister < ExactSubtreeRepeatsNaive, tree::PostfixRankedTree < unsigned, DefaultRankType >, tree::PostfixRankedTree < > > ( ExactSubtreeRepeatsNaive::repeats );
-auto ExactRepeatsNaivePrefixRankedBarTree = registration::OverloadRegister < ExactSubtreeRepeatsNaive, tree::PrefixRankedBarTree < unsigned, DefaultRankType >, tree::PrefixRankedBarTree < > > ( ExactSubtreeRepeatsNaive::repeats );
+auto ExactRepeatsNaiveRankedTree = registration::AbstractRegister < ExactSubtreeRepeatsNaive, tree::RankedTree < unsigned, DefaultRankType >, const tree::RankedTree < > & > ( ExactSubtreeRepeatsNaive::repeats );
+auto ExactRepeatsNaivePrefixRankedTree = registration::AbstractRegister < ExactSubtreeRepeatsNaive, tree::PrefixRankedTree < unsigned, DefaultRankType >, const tree::PrefixRankedTree < > & > ( ExactSubtreeRepeatsNaive::repeats );
+auto ExactRepeatsNaivePostfixRankedTree = registration::AbstractRegister < ExactSubtreeRepeatsNaive, tree::PostfixRankedTree < unsigned, DefaultRankType >, const tree::PostfixRankedTree < > & > ( ExactSubtreeRepeatsNaive::repeats );
+auto ExactRepeatsNaivePrefixRankedBarTree = registration::AbstractRegister < ExactSubtreeRepeatsNaive, tree::PrefixRankedBarTree < unsigned, DefaultRankType >, const tree::PrefixRankedBarTree < > & > ( ExactSubtreeRepeatsNaive::repeats );
 
 } /* namespace properties */
 
diff --git a/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h b/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h
index 8830357f8c..f6e43f88a9 100644
--- a/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h
+++ b/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h
@@ -8,9 +8,7 @@
 #ifndef _ARBOLOGY_SUBTREE_REPEATS_NAIVE_H_
 #define _ARBOLOGY_SUBTREE_REPEATS_NAIVE_H_
 
-#include <tree/TreeFeatures.h>
 #include <alphabet/SymbolFeatures.h>
-#include <core/multipleDispatch.hpp>
 
 #include <map>
 #include <vector>
@@ -33,7 +31,7 @@ namespace properties {
 /**
  * Simple computation of subtree repeats
  */
-class ExactSubtreeRepeatsNaive : public alib::SingleDispatch < ExactSubtreeRepeatsNaive, tree::Tree, const tree::TreeBase & > {
+class ExactSubtreeRepeatsNaive {
 	template < class SymbolType, class RankType >
 	static ext::tree < common::ranked_symbol < unsigned, RankType > > repeats ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, ext::map < std::pair < common::ranked_symbol < SymbolType, RankType >, ext::vector < common::ranked_symbol < unsigned, RankType > > >, unsigned > & data, unsigned & minId );
 	template < class SymbolType, class RankType >
@@ -44,12 +42,6 @@ class ExactSubtreeRepeatsNaive : public alib::SingleDispatch < ExactSubtreeRepea
 	static common::ranked_symbol < unsigned, RankType > repeatsPrefixRankedBar ( const ext::vector < common::ranked_symbol < SymbolType, RankType > > & symbols, ext::vector < common::ranked_symbol < unsigned, RankType > > & res, ext::map < std::pair < common::ranked_symbol <SymbolType, RankType >, ext::vector < common::ranked_symbol < unsigned, RankType > > >, unsigned > & data, unsigned & minId, unsigned barId, int & index );
 
 public:
-	/**
-	 * Compute a same shaped tree with nodes containing unique subtree ids.
-	 * @return Tree of repeats
-	 */
-	static tree::Tree repeats ( const tree::Tree & pattern );
-
 	/**
 	 * Compute a same shaped tree with nodes containing unique subtree ids.
 	 * @return Tree of repeats
diff --git a/alib2data/src/common/PrimitiveRegistrator2.cpp b/alib2data/src/common/PrimitiveRegistrator2.cpp
index ae699b7f98..558a46ff9b 100644
--- a/alib2data/src/common/PrimitiveRegistrator2.cpp
+++ b/alib2data/src/common/PrimitiveRegistrator2.cpp
@@ -7,6 +7,7 @@
 
 #include <abstraction/CastRegistry.hpp>
 #include <abstraction/XmlFileWriterRegistry.hpp>
+#include <abstraction/XmlParserRegistry.hpp>
 #include <abstraction/NormalizeRegistry.hpp>
 #include <abstraction/ValuePrinterRegistry.hpp>
 #include <abstraction/ImmediateRegistry.hpp>
@@ -24,6 +25,10 @@
 #include <container/ObjectsMap.h>
 
 #include <common/DefaultSymbolType.h>
+#include <common/DefaultRankType.h>
+
+#include <common/ranked_symbol.hpp>
+#include <alphabet/RankedSymbol.h>
 
 namespace abstraction {
 
@@ -31,6 +36,10 @@ class PrimitiveRegistrator2 {
 public:
 	PrimitiveRegistrator2 ( ) {
 		abstraction::XmlFileWriterRegistry::registerXmlFileWriter < ext::map < DefaultSymbolType, size_t > > ( );
+		abstraction::XmlFileWriterRegistry::registerXmlFileWriter < ext::map < common::ranked_symbol < DefaultSymbolType, DefaultRankType >, size_t > > ( );
+
+		abstraction::ContainerRegistry::registerSet < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > ( "ranked_symbol" );
+		abstraction::XmlParserRegistry::registerXmlParser < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > ( "ranked_symbol" );
 	}
 };
 
-- 
GitLab