From 3e93e25c638681f3e762a569dd0421d69799aedf Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sat, 26 Nov 2016 23:07:13 +0100 Subject: [PATCH] ease requirements on RankType --- aconvert2/src/DotConverter.h | 4 ++-- aconvert2/src/TikZConverter.h | 4 ++-- .../ExactNonlinearTreePatternAutomaton.cpp | 10 +++++----- .../exact/ExactPatternMatchingAutomaton.cpp | 20 +++++++++---------- .../arbology/exact/ExactSubtreeAutomaton.cpp | 2 +- .../exact/ExactSubtreeMatchingAutomaton.cpp | 4 ++-- .../exact/ExactSubtreeRepeatsNaive.cpp | 4 ++-- .../exact/ExactTreePatternAutomaton.cpp | 6 +++--- .../exact/ReversedBadCharacterShiftTable.cpp | 2 +- .../src/arbology/exact/SubtreeJumpTable.cpp | 4 ++-- .../determinize/DeterminizeNFTAPart.cxx | 2 +- alib2algo/src/automaton/run/Run.cpp | 6 +++--- alib2data/src/automaton/TA/DFTA.h | 2 +- alib2data/src/automaton/TA/NFTA.h | 2 +- .../src/rte/formal/FormalRTESymbolAlphabet.h | 2 +- .../ranked/PrefixRankedBarNonlinearPattern.h | 10 +++++----- .../src/tree/ranked/PrefixRankedBarPattern.h | 8 ++++---- .../src/tree/ranked/PrefixRankedBarTree.h | 4 ++-- .../ranked/PrefixRankedNonlinearPattern.h | 6 +++--- .../src/tree/ranked/PrefixRankedPattern.h | 4 ++-- alib2data/src/tree/ranked/PrefixRankedTree.h | 2 +- .../src/tree/ranked/RankedNonlinearPattern.h | 6 +++--- alib2data/src/tree/ranked/RankedPattern.h | 4 ++-- alib2data/src/tree/ranked/RankedTree.h | 2 +- alib2raw/src/tree/TreeToRawComposer.cpp | 4 ++-- alib2str/src/tree/TreeToStringComposer.cpp | 4 ++-- 26 files changed, 64 insertions(+), 64 deletions(-) diff --git a/aconvert2/src/DotConverter.h b/aconvert2/src/DotConverter.h index 2bcb88ecef..d7415254b1 100644 --- a/aconvert2/src/DotConverter.h +++ b/aconvert2/src/DotConverter.h @@ -992,7 +992,7 @@ void DotConverter::transitions(const automaton::NFTA < SymbolType, RankType, Sta //put transitions from automaton to "transitions" for (const auto& transition : fta.getTransitions()) { std::string symbol = alib::StringDataFactory::toString(transition.first.first.getSymbol()); - symbol += std::to_string(transition.first.first.getRank().getData()); + symbol += std::to_string(transition.first.first.getRank()); for(const StateType& to : transition.second) { std::pair<int, std::vector<int>> key(states.find(to)->second, {}); @@ -1044,7 +1044,7 @@ void DotConverter::transitions(const automaton::DFTA < SymbolType, RankType, Sta //put transitions from automaton to "transitions" for (const auto& transition : fta.getTransitions()) { std::string symbol = alib::StringDataFactory::toString(transition.first.first.getSymbol()); - symbol += std::to_string(transition.first.first.getRank().getData()); + symbol += std::to_string(transition.first.first.getRank()); std::pair<int, std::vector<int>> key(states.find(transition.second)->second, {}); for(const StateType& state : transition.first.second) { diff --git a/aconvert2/src/TikZConverter.h b/aconvert2/src/TikZConverter.h index 3dfe411827..b1132d34d4 100644 --- a/aconvert2/src/TikZConverter.h +++ b/aconvert2/src/TikZConverter.h @@ -960,7 +960,7 @@ void TikZConverter::transitions ( const automaton::NFTA < SymbolType, RankType, // put transitions from automaton to "transitions" for ( const auto & transition : fta.getTransitions ( ) ) { std::string symbol = alib::StringDataFactory::toString ( transition.first.first.getSymbol ( ) ); - symbol += std::to_string ( transition.first.first.getRank ( ).getData ( ) ); + symbol += std::to_string ( transition.first.first.getRank ( ) ); for ( const StateType & to : transition.second ) { std::pair < int, std::vector < int > > key ( states.find ( to )->second, { } ); @@ -1026,7 +1026,7 @@ void TikZConverter::transitions ( const automaton::DFTA < SymbolType, RankType, // put transitions from automaton to "transitions" for ( const auto & transition : fta.getTransitions ( ) ) { std::string symbol = alib::StringDataFactory::toString ( transition.first.first.getSymbol ( ) ); - symbol += std::to_string ( transition.first.first.getRank ( ).getData ( ) ); + symbol += std::to_string ( transition.first.first.getRank ( ) ); std::pair < int, std::vector < int > > key ( states.find ( transition.second )->second, { } ); diff --git a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp index 6fa77585c1..46331981f9 100644 --- a/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp +++ b/alib2algo/src/arbology/exact/ExactNonlinearTreePatternAutomaton.cpp @@ -25,12 +25,12 @@ automaton::Automaton ExactNonlinearTreePatternAutomaton::construct ( const tree: } void ExactNonlinearTreePatternAutomaton::constructTail ( automaton::InputDrivenNPDA < > & res, const tree::PrefixRankedTree < > & tree, const alphabet::Symbol & subtreeWildcard, const alphabet::Symbol & currentNonlinearVariable, const std::set < alphabet::Symbol > & nonlinearVariables, const std::ranked_symbol < > & subtreeSettings, unsigned subtreeId, std::vector < std::ranked_symbol < > >::const_iterator rankedSymbolsIter, int i, std::vector < std::ranked_symbol < > >::const_iterator subtreeRepeatsIter ) { - std::deque < std::pair < unsigned, int > > subtreeJumps; + std::deque < std::pair < size_t, int > > subtreeJumps; std::deque < std::ranked_symbol < > > subtreeRepeatsStack; for (++ rankedSymbolsIter, ++ subtreeRepeatsIter, ++i; rankedSymbolsIter != tree.getContent ( ).end ( ); ++ rankedSymbolsIter, ++ subtreeRepeatsIter, ++i ) { alphabet::Symbol symbol ( alphabet::RankedSymbol < > { * rankedSymbolsIter } ); - subtreeJumps.push_back ( std::make_pair ( rankedSymbolsIter->getRank ( ).getData ( ), i - 1 ) ); + subtreeJumps.push_back ( std::make_pair ( ( size_t ) rankedSymbolsIter->getRank ( ), i - 1 ) ); subtreeRepeatsStack.push_back ( * subtreeRepeatsIter ); label::Label currentState = label::labelFrom ( i, subtreeId ); @@ -73,7 +73,7 @@ automaton::InputDrivenNPDA < > ExactNonlinearTreePatternAutomaton::constructInte for ( const std::ranked_symbol < > & rankedSymbol : tree.getAlphabet ( ) ) { alphabet::Symbol symbol ( alphabet::RankedSymbol < > { rankedSymbol } ); res.addInputSymbol ( symbol ); - res.setPushdownStoreOperation ( symbol, std::vector < alphabet::Symbol > ( 1, S ), std::vector < alphabet::Symbol > ( rankedSymbol.getRank ( ).getData ( ), S ) ); + res.setPushdownStoreOperation ( symbol, std::vector < alphabet::Symbol > ( 1, S ), std::vector < alphabet::Symbol > ( ( size_t ) rankedSymbol.getRank ( ), S ) ); } res.addInputSymbol ( subtreeWildcard ); @@ -85,14 +85,14 @@ automaton::InputDrivenNPDA < > ExactNonlinearTreePatternAutomaton::constructInte } int i = 1; - std::deque < std::pair < unsigned, int > > subtreeJumps; + std::deque < std::pair < size_t, int > > subtreeJumps; std::deque < std::ranked_symbol < > > subtreeRepeatsStack; std::vector < std::ranked_symbol < > >::const_iterator rankedSymbolsIter; std::vector < std::ranked_symbol < > >::const_iterator subtreeRepeatsIter; for ( rankedSymbolsIter = tree.getContent ( ).begin(), subtreeRepeatsIter = repeats.getContent ( ).begin ( ); rankedSymbolsIter != tree.getContent ( ).end ( ); ++ rankedSymbolsIter, ++ subtreeRepeatsIter, ++ i ) { alphabet::Symbol symbol ( alphabet::RankedSymbol < > { * rankedSymbolsIter } ); - subtreeJumps.push_back ( std::make_pair ( rankedSymbolsIter->getRank ( ).getData ( ), i - 1 ) ); + subtreeJumps.push_back ( std::make_pair ( ( size_t ) rankedSymbolsIter->getRank ( ), i - 1 ) ); subtreeRepeatsStack.push_back ( * subtreeRepeatsIter ); label::Label currentState = label::labelFrom ( i ); diff --git a/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp b/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp index 36cd8e05a3..d790eab30f 100644 --- a/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp +++ b/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp @@ -43,7 +43,7 @@ auto ExactPatternMatchingAutomatonPrefixRankedTree = ExactPatternMatchingAutomat std::vector < alphabet::Symbol > computeRHS ( const tree::PrefixRankedPattern < > & pattern, const std::vector < int > & patternSubtreeJumpTable, int i ) { const std::vector < std::ranked_symbol < > > & content = pattern.getContent ( ); - unsigned rank = content[i].getRank ( ).getData ( ); + unsigned rank = ( unsigned ) content[i].getRank ( ); i++; @@ -77,7 +77,7 @@ automaton::NPDA < > ExactPatternMatchingAutomaton::construct ( const tree::Prefi for ( const std::ranked_symbol < > & symbol : pattern.getAlphabet ( ) ) { if ( symbol == pattern.getSubtreeWildcard ( ) ) continue; - res.addTransition ( label::labelFrom ( 0 ), alphabet::Symbol ( alphabet::RankedSymbol < > { symbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'T' ) ), label::labelFrom ( 0 ), std::vector < alphabet::Symbol > ( symbol.getRank ( ).getData ( ), alphabet::symbolFrom ( 'T' ) ) ); + res.addTransition ( label::labelFrom ( 0 ), alphabet::Symbol ( alphabet::RankedSymbol < > { symbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'T' ) ), label::labelFrom ( 0 ), std::vector < alphabet::Symbol > ( ( size_t ) symbol.getRank ( ), alphabet::symbolFrom ( 'T' ) ) ); } std::vector < int > patternSubtreeJumpTable = SubtreeJumpTable::compute ( pattern ); @@ -91,15 +91,15 @@ automaton::NPDA < > ExactPatternMatchingAutomaton::construct ( const tree::Prefi for ( const std::ranked_symbol < > & alphabetSymbol : pattern.getAlphabet ( ) ) { if ( alphabetSymbol == pattern.getSubtreeWildcard ( ) ) continue; - if ( alphabetSymbol.getRank ( ).getData ( ) == 0 ) { + if ( ( unsigned ) alphabetSymbol.getRank ( ) == 0 ) { res.addTransition ( label::labelFrom ( i - 1 ), alphabet::Symbol ( alphabet::RankedSymbol < > { alphabetSymbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'T' ) ), label::labelFrom ( i - 1 ), std::vector < alphabet::Symbol > { } ); res.addTransition ( label::labelFrom ( i - 1 ), alphabet::Symbol ( alphabet::RankedSymbol < > { alphabetSymbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'R' ) ), label::labelFrom ( i ), std::vector < alphabet::Symbol > { } ); } else { - std::vector < alphabet::Symbol > push ( alphabetSymbol.getRank ( ).getData ( ), alphabet::symbolFrom ( 'T' ) ); + std::vector < alphabet::Symbol > push ( ( unsigned ) alphabetSymbol.getRank ( ), alphabet::symbolFrom ( 'T' ) ); res.addTransition ( label::labelFrom ( i - 1 ), alphabet::Symbol ( alphabet::RankedSymbol < > { alphabetSymbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'T' ) ), label::labelFrom ( i - 1 ), push ); - push[alphabetSymbol.getRank ( ).getData ( ) - 1] = alphabet::symbolFrom ( 'R' ); + push[ ( unsigned ) alphabetSymbol.getRank ( ) - 1] = alphabet::symbolFrom ( 'R' ); res.addTransition ( label::labelFrom ( i - 1 ), alphabet::Symbol ( alphabet::RankedSymbol < > { alphabetSymbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'R' ) ), label::labelFrom ( i - 1 ), push ); } } @@ -202,9 +202,9 @@ label::Label constructRecursivePattern ( const std::tree < std::ranked_symbol < for ( const std::ranked_symbol < > & symbol : res.getInputAlphabet ( ) ) { std::vector < label::Label > states; - states.reserve ( symbol.getRank ( ).getData ( ) ); + states.reserve ( ( size_t ) symbol.getRank ( ) ); - for ( unsigned i = 0; i < symbol.getRank ( ).getData ( ); i++ ) + for ( unsigned i = 0; i < ( unsigned ) symbol.getRank ( ); i++ ) states.push_back ( loopState ); res.addTransition ( symbol, states, state ); @@ -213,7 +213,7 @@ label::Label constructRecursivePattern ( const std::tree < std::ranked_symbol < return state; } else { std::vector < label::Label > states; - states.reserve ( node.getData ( ).getRank ( ).getData ( ) ); + states.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); for ( const std::tree < std::ranked_symbol < > > & child : node.getChildren ( ) ) states.push_back ( constructRecursivePattern ( child, res, subtreeWildcard, loopState, nextState ) ); @@ -240,9 +240,9 @@ automaton::NFTA < > ExactPatternMatchingAutomaton::construct ( const tree::Ranke for ( const std::ranked_symbol < > & symbol : res.getInputAlphabet ( ) ) { std::vector < label::Label > states; - states.reserve ( symbol.getRank ( ).getData ( ) ); + states.reserve ( ( size_t ) symbol.getRank ( ) ); - for ( unsigned i = 0; i < symbol.getRank ( ).getData ( ); i++ ) + for ( unsigned i = 0; i < ( unsigned ) symbol.getRank ( ); i++ ) states.push_back ( loopState ); res.addTransition ( symbol, states, loopState ); diff --git a/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp b/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp index f23b61fc75..0286cd621e 100644 --- a/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp +++ b/alib2algo/src/arbology/exact/ExactSubtreeAutomaton.cpp @@ -29,7 +29,7 @@ automaton::InputDrivenNPDA < > ExactSubtreeAutomaton::construct ( const tree::Pr for ( const std::ranked_symbol < > & rankedSymbol : tree.getAlphabet ( ) ) { alphabet::Symbol symbol ( alphabet::RankedSymbol < > { rankedSymbol } ); res.addInputSymbol ( symbol ); - res.setPushdownStoreOperation ( symbol, std::vector < alphabet::Symbol > ( 1, S ), std::vector < alphabet::Symbol > ( rankedSymbol.getRank ( ).getData ( ), S ) ); + res.setPushdownStoreOperation ( symbol, std::vector < alphabet::Symbol > ( 1, S ), std::vector < alphabet::Symbol > ( ( size_t ) rankedSymbol.getRank ( ), S ) ); } int i = 1; diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp index 2f3e997d99..8875cc7800 100644 --- a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp +++ b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp @@ -30,7 +30,7 @@ automaton::InputDrivenNPDA < > ExactSubtreeMatchingAutomaton::construct ( const for ( const std::ranked_symbol < > & symbol : pattern.getAlphabet ( ) ) { res.addInputSymbol ( alphabet::Symbol ( alphabet::RankedSymbol < > { symbol } ) ); - res.setPushdownStoreOperation ( alphabet::Symbol ( alphabet::RankedSymbol < > { symbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'S' ) ), std::vector < alphabet::Symbol > ( symbol.getRank ( ).getData ( ), alphabet::symbolFrom ( 'S' ) ) ); + res.setPushdownStoreOperation ( alphabet::Symbol ( alphabet::RankedSymbol < > { symbol } ), std::vector < alphabet::Symbol > ( 1, alphabet::symbolFrom ( 'S' ) ), std::vector < alphabet::Symbol > ( ( size_t ) symbol.getRank ( ), alphabet::symbolFrom ( 'S' ) ) ); } for ( const std::ranked_symbol < > & symbol : pattern.getAlphabet ( ) ) { @@ -86,7 +86,7 @@ auto ExactSubtreeMatchingAutomatonPrefixRankedBarTree = ExactSubtreeMatchingAuto label::Label constructRecursive ( const std::tree < std::ranked_symbol < > > & node, automaton::NFTA < > & res, int & nextState ) { std::vector < label::Label > states; - states.reserve ( node.getData ( ).getRank ( ).getData ( ) ); + states.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); for ( const std::tree < std::ranked_symbol < > > & child : node.getChildren ( ) ) states.push_back ( constructRecursive ( child, res, nextState ) ); diff --git a/alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.cpp b/alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.cpp index a04777b6b5..47205eef2d 100644 --- a/alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.cpp +++ b/alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.cpp @@ -55,7 +55,7 @@ std::ranked_symbol < > ExactSubtreeRepeatsNaive::repeatsPrefixRanked ( const std index++; - for ( unsigned i = 0; i < symbols[begin].getRank ( ).getData ( ); ++i ) + for ( unsigned i = 0; i < ( unsigned ) symbols[begin].getRank ( ); ++i ) childRepeatsKey.second.push_back ( repeatsPrefixRanked ( symbols, res, data, minId, index ) ); int & uniqueRepeatId = data[childRepeatsKey]; @@ -86,7 +86,7 @@ std::ranked_symbol < > ExactSubtreeRepeatsNaive::repeatsPrefixRankedBar ( const index++; - for ( unsigned i = 0; i < symbols[begin].getRank ( ).getData ( ); ++i ) + for ( unsigned i = 0; i < ( unsigned ) symbols[begin].getRank ( ); ++i ) childRepeatsKey.second.push_back ( repeatsPrefixRankedBar ( symbols, res, data, minId, index ) ); int & uniqueRepeatId = data[childRepeatsKey]; diff --git a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp index 43cbc88786..eb6e125e22 100644 --- a/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp +++ b/alib2algo/src/arbology/exact/ExactTreePatternAutomaton.cpp @@ -29,18 +29,18 @@ automaton::InputDrivenNPDA < > ExactTreePatternAutomaton::construct ( const tree for ( const std::ranked_symbol < > & rankedSymbol : tree.getAlphabet ( ) ) { alphabet::Symbol symbol ( alphabet::RankedSymbol < > { rankedSymbol } ); res.addInputSymbol ( symbol ); - res.setPushdownStoreOperation ( symbol, std::vector < alphabet::Symbol > ( 1, S ), std::vector < alphabet::Symbol > ( rankedSymbol.getRank ( ).getData ( ), S ) ); + res.setPushdownStoreOperation ( symbol, std::vector < alphabet::Symbol > ( 1, S ), std::vector < alphabet::Symbol > ( ( size_t ) rankedSymbol.getRank ( ), S ) ); } res.addInputSymbol ( subtreeWildcard ); res.setPushdownStoreOperation ( subtreeWildcard, std::vector < alphabet::Symbol > ( 1, S ), std::vector < alphabet::Symbol > { } ); int i = 1; - std::deque < std::pair < unsigned, int > > subtreeJumps; + std::deque < std::pair < size_t, int > > subtreeJumps; for ( const std::ranked_symbol < > & rankedSymbol : tree.getContent ( ) ) { alphabet::Symbol symbol ( alphabet::RankedSymbol < > { rankedSymbol } ); - subtreeJumps.push_back ( std::make_pair ( rankedSymbol.getRank ( ).getData ( ), i - 1 ) ); + subtreeJumps.push_back ( std::make_pair ( ( size_t ) rankedSymbol.getRank ( ), i - 1 ) ); res.addState ( label::labelFrom ( i ) ); res.addTransition ( label::labelFrom ( i - 1 ), symbol, label::labelFrom ( i ) ); diff --git a/alib2algo/src/arbology/exact/ReversedBadCharacterShiftTable.cpp b/alib2algo/src/arbology/exact/ReversedBadCharacterShiftTable.cpp index 056b9fa245..c0f7dca523 100644 --- a/alib2algo/src/arbology/exact/ReversedBadCharacterShiftTable.cpp +++ b/alib2algo/src/arbology/exact/ReversedBadCharacterShiftTable.cpp @@ -56,7 +56,7 @@ std::map < std::ranked_symbol < >, size_t > ReversedBadCharacterShiftTable::bcs if ( pattern.getBars ( ).count ( symbol ) ) // size of the smallest subtree containing given terminal depend // on the arity of the terminal - tmp += symbol.getRank ( ).getData ( ) * 2; + tmp += ( size_t ) symbol.getRank ( ) * 2; else if ( tmp >= 2 ) // bar symbols match the variable bar which is one symbol after // the last variable, conditioned because of the case S S| where diff --git a/alib2algo/src/arbology/exact/SubtreeJumpTable.cpp b/alib2algo/src/arbology/exact/SubtreeJumpTable.cpp index f7b4022b48..b35fbd55d4 100644 --- a/alib2algo/src/arbology/exact/SubtreeJumpTable.cpp +++ b/alib2algo/src/arbology/exact/SubtreeJumpTable.cpp @@ -73,7 +73,7 @@ int SubtreeJumpTable::buildDataPointersBar ( std::vector < int > & res, const T int index = begin + 1; if ( ! subject.getBars ( ).count ( subject.getContent ( )[begin] ) ) - for ( unsigned i = 0; i < subject.getContent ( )[begin].getRank ( ).getData ( ); i++ ) + for ( unsigned i = 0; i < ( unsigned ) subject.getContent ( )[begin].getRank ( ); i++ ) index = buildDataPointersBar ( res, subject, index ); index++; @@ -99,7 +99,7 @@ template < class T > int SubtreeJumpTable::buildDataPointersPrefixRankedInternal ( std::vector < int > & res, const T & subject, int begin ) { int index = begin + 1; - for ( unsigned i = 0; i < subject.getContent ( )[begin].getRank ( ).getData ( ); i++ ) + for ( unsigned i = 0; i < ( unsigned ) subject.getContent ( )[begin].getRank ( ); i++ ) index = buildDataPointersPrefixRankedInternal ( res, subject, index ); res[begin] = index; diff --git a/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.cxx b/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.cxx index 75e8f915d0..9b09333bda 100644 --- a/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.cxx +++ b/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.cxx @@ -20,7 +20,7 @@ std::set<label::Label> getTransitionRightSide(const NFTA < > & nfta, const std:: for (const auto & transition : nfta.getTransitions()) { if (transition.first.first != symbol) continue; - unsigned i = symbol.getRank().getData(); + unsigned i = ( unsigned ) symbol.getRank(); for (; i > 0; i--) if (!recreateNFAStates(states[i - 1]).count(transition.first.second[i - 1])) break; diff --git a/alib2algo/src/automaton/run/Run.cpp b/alib2algo/src/automaton/run/Run.cpp index 0feabbfb5d..10caa1614f 100644 --- a/alib2algo/src/automaton/run/Run.cpp +++ b/alib2algo/src/automaton/run/Run.cpp @@ -109,7 +109,7 @@ std::tuple < bool, std::set < label::Label >, std::set < unsigned > > Run::calcu std::pair < bool, label::Label > Run::calculateState ( const automaton::DFTA < > & automaton, const std::tree < std::ranked_symbol < > > & node, std::set < unsigned > & occ, unsigned & i ) { std::vector < label::Label > states; - states.reserve ( node.getData ( ).getRank ( ).getData ( ) ); + states.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); unsigned tmp = i; i++; @@ -154,7 +154,7 @@ std::tuple < bool, label::Label, std::set < unsigned > > Run::calculateState ( c std::pair < bool, std::set < label::Label > > Run::calculateStates ( const automaton::NFTA < > & automaton, const std::tree < std::ranked_symbol < > > & node, std::set < unsigned > & occ, unsigned & i ) { std::vector < std::set < label::Label > > resStates; - resStates.reserve ( node.getData ( ).getRank ( ).getData ( ) ); + resStates.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); unsigned tmp = i; i++; @@ -176,7 +176,7 @@ std::pair < bool, std::set < label::Label > > Run::calculateStates ( const autom if ( transition.first.first != node.getData ( ) ) continue; - unsigned rank = transition.first.first.getRank ( ).getData ( ); + unsigned rank = ( unsigned ) transition.first.first.getRank ( ); unsigned j; for ( j = 0; j < rank; j++ ) diff --git a/alib2data/src/automaton/TA/DFTA.h b/alib2data/src/automaton/TA/DFTA.h index bed1454b82..6629778541 100644 --- a/alib2data/src/automaton/TA/DFTA.h +++ b/alib2data/src/automaton/TA/DFTA.h @@ -173,7 +173,7 @@ AutomatonBase* DFTA < SymbolType, RankType, StateType >::plunder() && { template<class SymbolType, class RankType, class StateType > bool DFTA < SymbolType, RankType, StateType >::addTransition(const std::ranked_symbol < SymbolType, RankType > & symbol, const std::vector<StateType> & prevStates, const StateType & next) { - if ( prevStates.size() != symbol.getRank().getData()) + if ( prevStates.size() != ( size_t ) symbol.getRank() ) throw AutomatonException("Number of states doesn't match rank of the symbol"); if (! getInputAlphabet().count(symbol)) diff --git a/alib2data/src/automaton/TA/NFTA.h b/alib2data/src/automaton/TA/NFTA.h index b979838cb2..c900c1f3a4 100644 --- a/alib2data/src/automaton/TA/NFTA.h +++ b/alib2data/src/automaton/TA/NFTA.h @@ -191,7 +191,7 @@ AutomatonBase* NFTA < SymbolType, RankType, StateType >::plunder() && { template < class SymbolType, class RankType, class StateType > bool NFTA < SymbolType, RankType, StateType >::addTransition(const std::ranked_symbol < SymbolType, RankType > & symbol, const std::vector<StateType> & prevStates, const StateType & next) { - if (prevStates.size() != symbol.getRank().getData()) + if (prevStates.size() != ( size_t ) symbol.getRank() ) throw AutomatonException("Number of states doesn't match rank of the symbol"); if (! getInputAlphabet().count(symbol)) diff --git a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h index 0b1c8ff8a7..07d63d5f2c 100644 --- a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h +++ b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h @@ -110,7 +110,7 @@ template < class SymbolType, class RankType > void FormalRTESymbolAlphabet < SymbolType, RankType >::appendElement ( FormalRTESymbol < SymbolType, RankType > && element ) { // TODO: Remove this. Pass vector in constructor. Now an Element can have LESS children that is MUST have. - if ( primitive::Unsigned ( this->getChildren ( ).size ( ) ) >= this->getSymbol ( ).getRank ( ) ) + if ( this->getChildren ( ).size ( ) >= ( size_t ) this->getSymbol ( ).getRank ( ) ) throw exception::CommonException ( "Ranked node cannot have more children then its rank" ); this->pushBackChild ( std::smart_ptr < FormalRTESymbol < SymbolType, RankType > > ( std::move ( element ).plunder ( ) ) ); diff --git a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h index 4393edae43..bc2eeee9d3 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h @@ -232,11 +232,11 @@ void PrefixRankedBarNonlinearPattern < SymbolType, RankType >::arityChecksum ( c for ( const std::ranked_symbol < SymbolType, RankType > & symbol : data ) { if ( getBars ( ).count ( symbol ) || ( symbol == getVariablesBar ( ) ) ) { - arityChecksumBars += symbol.getRank ( ).getData ( ); + arityChecksumBars += ( unsigned ) symbol.getRank ( ); arityChecksumBars -= 1; arityChecksumTypes -= 1; } else { - arityChecksumTerminals += symbol.getRank ( ).getData ( ); + arityChecksumTerminals += ( unsigned ) symbol.getRank ( ); arityChecksumTerminals -= 1; arityChecksumTypes += 1; } @@ -368,7 +368,7 @@ public: } static void valid ( const ::tree::PrefixRankedBarNonlinearPattern < SymbolType, RankType > & pattern, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if ( symbol.getRank ( ).getData ( ) != 0 ) + if ( ( unsigned ) symbol.getRank ( ) != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); if ( pattern.template accessElement < ::tree::SubtreeWildcard > ( ).get ( ) == symbol ) @@ -384,7 +384,7 @@ public: } static void valid ( const ::tree::PrefixRankedBarNonlinearPattern < SymbolType, RankType > & pattern, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if ( symbol.getRank ( ).getData ( ) != 0 ) + if ( ( unsigned ) symbol.getRank ( ) != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); if ( pattern.template accessComponent < ::tree::NonlinearAlphabet > ( ).get ( ).count ( symbol ) ) @@ -400,7 +400,7 @@ public: } static void valid ( const ::tree::PrefixRankedBarNonlinearPattern < SymbolType, RankType > &, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if ( symbol.getRank ( ).getData ( ) != 0 ) + if ( ( unsigned ) symbol.getRank ( ) != 0 ) throw ::tree::TreeException ( "VariablesBarSymbol has nonzero arity" ); } }; diff --git a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h index 4004e445e4..6dae7f5e89 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h @@ -198,11 +198,11 @@ void PrefixRankedBarPattern < SymbolType, RankType >::arityChecksum ( const std: for ( const std::ranked_symbol < SymbolType, RankType > & symbol : data ) { if ( getBars ( ).count ( symbol ) || symbol == getVariablesBar ( ) ) { - arityChecksumBars += symbol.getRank ( ).getData ( ); + arityChecksumBars += ( unsigned ) symbol.getRank ( ); arityChecksumBars -= 1; arityChecksumTypes -= 1; } else { - arityChecksumTerminals += symbol.getRank ( ).getData ( ); + arityChecksumTerminals += ( unsigned ) symbol.getRank ( ); arityChecksumTerminals -= 1; arityChecksumTypes += 1; } @@ -328,7 +328,7 @@ public: } static void valid ( const ::tree::PrefixRankedBarPattern < SymbolType, RankType > &, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if( symbol.getRank().getData() != 0 ) + if( ( unsigned ) symbol.getRank() != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); } }; @@ -341,7 +341,7 @@ public: } static void valid ( const ::tree::PrefixRankedBarPattern < SymbolType, RankType > &, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if( symbol.getRank().getData() != 0 ) + if( ( unsigned ) symbol.getRank() != 0 ) throw ::tree::TreeException ( "VariablesBarSymbol has nonzero arity" ); } }; diff --git a/alib2data/src/tree/ranked/PrefixRankedBarTree.h b/alib2data/src/tree/ranked/PrefixRankedBarTree.h index 0153851eba..78930c3300 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarTree.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarTree.h @@ -177,11 +177,11 @@ void PrefixRankedBarTree < SymbolType, RankType >::arityChecksum ( const std::ve for ( const std::ranked_symbol < SymbolType, RankType > & symbol : data ) { if ( getBars ( ).count ( symbol ) ) { - arityChecksumBars += symbol.getRank ( ).getData ( ); + arityChecksumBars += ( unsigned ) symbol.getRank ( ); arityChecksumBars -= 1; arityChecksumTypes -= 1; } else { - arityChecksumTerminals += symbol.getRank ( ).getData ( ); + arityChecksumTerminals += ( unsigned ) symbol.getRank ( ); arityChecksumTerminals -= 1; arityChecksumTypes += 1; } diff --git a/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h b/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h index 8a97f9b949..b5f9bc390a 100644 --- a/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h @@ -199,7 +199,7 @@ void PrefixRankedNonlinearPattern < SymbolType, RankType >::arityChecksum ( cons int arityChecksumAcc = 1; for ( const std::ranked_symbol < SymbolType, RankType > & symbol : data ) { - arityChecksumAcc += symbol.getRank ( ).getData ( ); + arityChecksumAcc += ( unsigned ) symbol.getRank ( ); arityChecksumAcc -= 1; } @@ -303,7 +303,7 @@ public: } static void valid ( const ::tree::PrefixRankedNonlinearPattern < SymbolType, RankType > & pattern, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if ( symbol.getRank ( ).getData ( ) != 0 ) + if ( ( unsigned ) symbol.getRank ( ) != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); if ( pattern.template accessElement < ::tree::SubtreeWildcard > ( ).get ( ) == symbol ) @@ -319,7 +319,7 @@ public: } static void valid ( const ::tree::PrefixRankedNonlinearPattern < SymbolType, RankType > & pattern, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if ( symbol.getRank ( ).getData ( ) != 0 ) + if ( ( unsigned ) symbol.getRank ( ) != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); if ( pattern.template accessComponent < ::tree::NonlinearAlphabet > ( ).get ( ).count ( symbol ) ) diff --git a/alib2data/src/tree/ranked/PrefixRankedPattern.h b/alib2data/src/tree/ranked/PrefixRankedPattern.h index 2393243c85..6a55201820 100644 --- a/alib2data/src/tree/ranked/PrefixRankedPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedPattern.h @@ -171,7 +171,7 @@ void PrefixRankedPattern < SymbolType, RankType >::arityChecksum ( const std::ve int arityChecksumAcc = 1; for ( const std::ranked_symbol < SymbolType, RankType > & symbol : data ) { - arityChecksumAcc += symbol.getRank ( ).getData ( ); + arityChecksumAcc += ( unsigned ) symbol.getRank ( ); arityChecksumAcc -= 1; } @@ -269,7 +269,7 @@ public: } static void valid ( const ::tree::PrefixRankedPattern < SymbolType, RankType > &, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if( symbol.getRank().getData() != 0 ) + if( ( unsigned ) symbol.getRank() != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); } }; diff --git a/alib2data/src/tree/ranked/PrefixRankedTree.h b/alib2data/src/tree/ranked/PrefixRankedTree.h index a55c98f346..021defcc65 100644 --- a/alib2data/src/tree/ranked/PrefixRankedTree.h +++ b/alib2data/src/tree/ranked/PrefixRankedTree.h @@ -158,7 +158,7 @@ void PrefixRankedTree < SymbolType, RankType >::arityChecksum ( const std::vecto int arityChecksumAcc = 1; for ( const std::ranked_symbol < SymbolType, RankType > & symbol : data ) { - arityChecksumAcc += symbol.getRank ( ).getData ( ); + arityChecksumAcc += ( unsigned ) symbol.getRank ( ); arityChecksumAcc -= 1; } diff --git a/alib2data/src/tree/ranked/RankedNonlinearPattern.h b/alib2data/src/tree/ranked/RankedNonlinearPattern.h index 762bb8ecb3..795a3287e5 100644 --- a/alib2data/src/tree/ranked/RankedNonlinearPattern.h +++ b/alib2data/src/tree/ranked/RankedNonlinearPattern.h @@ -171,7 +171,7 @@ void RankedNonlinearPattern < SymbolType, RankType >::checkAlphabet ( const std: template < class SymbolType, class RankType > void RankedNonlinearPattern < SymbolType, RankType >::checkArities ( const std::tree < std::ranked_symbol < SymbolType, RankType > > & data ) const { - if ( data.getData ( ).getRank ( ).getData ( ) != data.getChildren ( ).size ( ) ) + if ( ( size_t ) data.getData ( ).getRank ( ) != data.getChildren ( ).size ( ) ) throw exception::CommonException ( "Invalid rank." ); for ( const std::tree < std::ranked_symbol < SymbolType, RankType > > & child : data ) @@ -273,7 +273,7 @@ public: } static void valid ( const ::tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if( symbol.getRank().getData() != 0 ) + if( ( unsigned ) symbol.getRank() != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); if ( pattern.template accessElement < ::tree::SubtreeWildcard > ( ).get ( ) == symbol ) @@ -289,7 +289,7 @@ public: } static void valid ( const ::tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if( symbol.getRank().getData() != 0 ) + if( ( unsigned ) symbol.getRank() != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); if ( pattern.template accessComponent < ::tree::NonlinearAlphabet > ( ).get ( ).count ( symbol ) ) diff --git a/alib2data/src/tree/ranked/RankedPattern.h b/alib2data/src/tree/ranked/RankedPattern.h index a38f2c6b3d..ea7d4bb392 100644 --- a/alib2data/src/tree/ranked/RankedPattern.h +++ b/alib2data/src/tree/ranked/RankedPattern.h @@ -161,7 +161,7 @@ void RankedPattern < SymbolType, RankType >::checkAlphabet ( const std::tree < s template < class SymbolType, class RankType > void RankedPattern < SymbolType, RankType >::checkArities ( const std::tree < std::ranked_symbol < SymbolType, RankType > > & data ) const { - if ( data.getData ( ).getRank ( ).getData ( ) != data.getChildren ( ).size ( ) ) + if ( ( size_t ) data.getData ( ).getRank ( ) != data.getChildren ( ).size ( ) ) throw exception::CommonException ( "Invalid rank." ); for ( const std::tree < std::ranked_symbol < SymbolType, RankType > > & child : data ) @@ -257,7 +257,7 @@ public: } static void valid ( const ::tree::RankedPattern < SymbolType, RankType > &, const std::ranked_symbol < SymbolType, RankType > & symbol) { - if( symbol.getRank().getData() != 0 ) + if( ( unsigned ) symbol.getRank() != 0 ) throw ::tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" ); } }; diff --git a/alib2data/src/tree/ranked/RankedTree.h b/alib2data/src/tree/ranked/RankedTree.h index 402277c3cd..2dcd8ed300 100644 --- a/alib2data/src/tree/ranked/RankedTree.h +++ b/alib2data/src/tree/ranked/RankedTree.h @@ -156,7 +156,7 @@ void RankedTree < SymbolType, RankType >::checkAlphabet ( const std::tree < std: template < class SymbolType, class RankType > void RankedTree < SymbolType, RankType >::checkArities ( const std::tree < std::ranked_symbol < SymbolType, RankType > > & data ) const { - if ( data.getData ( ).getRank ( ).getData ( ) != data.getChildren ( ).size ( ) ) + if ( ( size_t ) data.getData ( ).getRank ( ) != data.getChildren ( ).size ( ) ) throw exception::CommonException ( "Invalid rank." ); for ( const std::tree < std::ranked_symbol < SymbolType, RankType > > & child : data ) diff --git a/alib2raw/src/tree/TreeToRawComposer.cpp b/alib2raw/src/tree/TreeToRawComposer.cpp index ed65d9deb9..dcfba67938 100644 --- a/alib2raw/src/tree/TreeToRawComposer.cpp +++ b/alib2raw/src/tree/TreeToRawComposer.cpp @@ -55,7 +55,7 @@ void TreeToRawComposer::composeNode(std::deque<sax::Token>& out, const std::tree } void TreeToRawComposer::composePrefixRankedNotation(std::deque<sax::Token>& out, unsigned& index, const std::vector<std::ranked_symbol < > > & notation) { - unsigned size = notation[index].getRank().getData(); + unsigned size = ( unsigned ) notation[index].getRank(); unsigned root = index; if(size == 0) { out.emplace_back(sax::Token((std::string) notation[root], sax::Token::TokenType::CHARACTER)); @@ -73,7 +73,7 @@ void TreeToRawComposer::composePrefixRankedNotation(std::deque<sax::Token>& out, } void TreeToRawComposer::composePrefixRankedBarNotation(std::deque<sax::Token>& out, unsigned& index, const std::vector<std::ranked_symbol < > > & notation) { - unsigned size = notation[index].getRank().getData(); + unsigned size = ( unsigned ) notation[index].getRank(); unsigned root = index; if(size == 0) { out.emplace_back(sax::Token((std::string) notation[root], sax::Token::TokenType::CHARACTER)); diff --git a/alib2str/src/tree/TreeToStringComposer.cpp b/alib2str/src/tree/TreeToStringComposer.cpp index 6452a1c8c1..e43374ec42 100644 --- a/alib2str/src/tree/TreeToStringComposer.cpp +++ b/alib2str/src/tree/TreeToStringComposer.cpp @@ -24,7 +24,7 @@ TreeToStringComposer::RegistratorWrapper < void, RankedTree < > > StringToString void TreeToStringComposer::compose ( std::ostream & out, const std::tree < std::ranked_symbol < > > & node ) { alib::stringApi < alphabet::Symbol >::compose ( out, node.getData ( ).getSymbol ( ) ); - out << std::to_string ( node.getData ( ).getRank ( ).getData ( ) ); + out << std::to_string ( node.getData ( ).getRank ( ) ); for ( const std::tree < std::ranked_symbol < > > & child : node ) { out << " "; @@ -44,7 +44,7 @@ void TreeToStringComposer::compose ( std::ostream & out, const std::ranked_symbo } else { alib::stringApi < alphabet::Symbol >::compose ( out, node.getData ( ).getSymbol ( ) ); - out << std::to_string ( node.getData ( ).getRank ( ).getData ( ) ); + out << std::to_string ( node.getData ( ).getRank ( ) ); for ( const std::tree < std::ranked_symbol < > > & child : node ) { out << " "; -- GitLab