From af0051b064f6be67c9555312a25c00f2bb6c8862 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Mon, 10 Apr 2017 15:29:01 +0200 Subject: [PATCH] expose computation of BCS table for trees --- aarbology2/src/aarbology.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aarbology2/src/aarbology.cpp b/aarbology2/src/aarbology.cpp index 84f6f7bea4..bbf729c668 100644 --- a/aarbology2/src/aarbology.cpp +++ b/aarbology2/src/aarbology.cpp @@ -56,6 +56,8 @@ int main ( int argc, char * argv[] ) { allowed.push_back ( "exactSubtreeRepeatsNaive" ); allowed.push_back ( "compressedBitParallelIndex" ); allowed.push_back ( "fullAndLinearIndex" ); + + allowed.push_back ( "badCharacterShiftTable" ); TCLAP::ValuesConstraint < std::string > allowedVals ( allowed ); TCLAP::ValueArg < std::string > algorithm ( "a", "algorithm", "Execute algorithm", false, "exactSubtreeMatch", & allowedVals ); @@ -281,6 +283,18 @@ int main ( int argc, char * argv[] ) { measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( fullAndLinearIndex ); + } else if ( algorithm.getValue ( ) == "badCharacterShiftTable" ) { + tree::RankedTreeWrapper pattern = alib::XmlDataFactory::fromTokens ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) ); + + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); + + std::map < std::ranked_symbol < DefaultSymbolType, DefaultRankType >, size_t > bcs = tree::properties::BadCharacterShiftTable::bcs ( pattern ); + + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); + + alib::XmlDataFactory::toStdout ( bcs ); } else { throw exception::CommonException ( "Invalid algorithm" ); } -- GitLab