Commit adae0d3e authored by Ing. Jan Trávníček's avatar Ing. Jan Trávníček

copy alib2raw lib to result dir; fix suffix trie

parent 3acd192c
......@@ -12,6 +12,7 @@
#include <exception/AlibException.h>
#include <string/LinearString.h>
#include <string/Epsilon.h>
#include <alphabet/EndSymbol.h>
namespace stringology {
......@@ -24,6 +25,10 @@ indexes::SuffixTrie SuffixTrie::construct ( const string::String & string ) {
indexes::SuffixTrie SuffixTrie::construct ( const string::LinearString & w ) {
indexes::SuffixTrie res ( w.getAlphabet ( ) );
if ( w.getAlphabet ( ).find ( alphabet::Symbol ( alphabet::EndSymbol::END ) ) != w.getAlphabet ( ).end ( ) ) throw exception::AlibException ( "Implicit termination symbol is already in the string alphabet" );
res.addSymbol ( alphabet::Symbol ( alphabet::EndSymbol::END ) );
for ( unsigned int i = 0; i < w.getContent ( ).size ( ); i++ ) {
unsigned int k = i;
indexes::SuffixTrieNode * n = & res.getRoot ( );
......@@ -32,9 +37,10 @@ indexes::SuffixTrie SuffixTrie::construct ( const string::LinearString & w ) {
n = & n->getChild ( w.getContent ( )[k++] );
for ( ; k < w.getContent ( ).size ( ); k++ ) {
n = & n->addChild ( w.getContent ( )[k], indexes::SuffixTrieNode { { }
} );
n = & n->addChild ( w.getContent ( )[k], indexes::SuffixTrieNode ( { } ) );
}
n->addChild ( alphabet::Symbol ( alphabet::EndSymbol::END ), indexes::SuffixTrieNode ( { } ) );
}
return res;
......
......@@ -104,6 +104,8 @@ SuffixTrieNode & SuffixTrieNode::addChild ( alphabet::Symbol symbol, SuffixTrieN
if ( iter != children.end ( ) ) throw exception::AlibException ( "child already exist" );
if ( ( this->parentTree != NULL ) && ( this->parentTree->getAlphabet ( ).find ( symbol ) == this->parentTree->getAlphabet ( ).end ( ) ) ) throw exception::AlibException ( "Symbol is not in the alphabet" );
return * children.insert ( std::make_pair ( std::move ( symbol ), new SuffixTrieNode ( std::move ( node ) ) ) ).first->second;
}
......
......@@ -87,7 +87,7 @@ debug: all-debug
mkdir -p $(addsuffix -debug, $(BINFOLDER));\
fi
rm -rf $(addsuffix -debug, $(BINFOLDER))/*
for dir in $(STD_LIB) $(CORE_LIB) $(STR_LIB) $(ALGO_LIB) $(ELGO_LIB); do \
for dir in $(STD_LIB) $(CORE_LIB) $(STR_LIB) $(RAW_LIB) $(ALGO_LIB) $(ELGO_LIB); do \
cp $$dir/lib-debug/* $(addsuffix -debug, $(BINFOLDER)); \
done
for dir in $(SUBDIRS_BINS); do \
......@@ -111,7 +111,7 @@ release: all-release
mkdir -p $(addsuffix -release, $(BINFOLDER));\
fi
rm -rf $(addsuffix -release, $(BINFOLDER))/*
for dir in $(STD_LIB) $(CORE_LIB) $(STR_LIB) $(ALGO_LIB) $(ELGO_LIB); do \
for dir in $(STD_LIB) $(CORE_LIB) $(STR_LIB) $(RAW_LIB) $(ALGO_LIB) $(ELGO_LIB); do \
cp $$dir/lib-release/* $(addsuffix -release, $(BINFOLDER)); \
done
for dir in $(SUBDIRS_BINS); do \
......@@ -296,6 +296,7 @@ doc:
$(MAKE) doc -C alib2std
$(MAKE) doc -C alib2data
$(MAKE) doc -C alib2str
$(MAKE) doc -C alib2raw
$(MAKE) doc -C alib2algo
$(MAKE) doc -C alib2elgo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment