Skip to content
Snippets Groups Projects
Commit ad01c5c4 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

tidy: replace count with contains to express true meaning

parent d8538181
No related branches found
No related tags found
1 merge request!200clang tidy fixes
...@@ -385,7 +385,7 @@ ext::tuple < bool, StateType, ext::set < unsigned > > Run::calculateState ( cons ...@@ -385,7 +385,7 @@ ext::tuple < bool, StateType, ext::set < unsigned > > Run::calculateState ( cons
StateType state = automaton.getInitialState ( ); StateType state = automaton.getInitialState ( );
   
for ( const SymbolType & symbol : string.getContent ( ) ) { for ( const SymbolType & symbol : string.getContent ( ) ) {
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occurrences.insert ( i ); occurrences.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -400,7 +400,7 @@ ext::tuple < bool, StateType, ext::set < unsigned > > Run::calculateState ( cons ...@@ -400,7 +400,7 @@ ext::tuple < bool, StateType, ext::set < unsigned > > Run::calculateState ( cons
i++; i++;
} }
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occurrences.insert ( i ); occurrences.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -420,7 +420,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat ...@@ -420,7 +420,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat
}; };
   
for ( const StateType & state : states ) for ( const StateType & state : states )
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occurrences.insert ( i ); occurrences.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -440,7 +440,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat ...@@ -440,7 +440,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat
states = next; states = next;
   
for ( const StateType & state : states ) for ( const StateType & state : states )
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occurrences.insert ( i ); occurrences.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -461,7 +461,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat ...@@ -461,7 +461,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat
}; };
   
for ( const StateType & state : states ) for ( const StateType & state : states )
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occurrences.insert ( i ); occurrences.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -490,7 +490,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat ...@@ -490,7 +490,7 @@ ext::tuple < bool, ext::set < StateType >, ext::set < unsigned > > Run::calculat
states = epsilonNext; states = epsilonNext;
   
for ( const StateType & state : states ) for ( const StateType & state : states )
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occurrences.insert ( i ); occurrences.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -530,7 +530,8 @@ ext::pair < bool, StateType > Run::calculateState ( const automaton::DFTA < Symb ...@@ -530,7 +530,8 @@ ext::pair < bool, StateType > Run::calculateState ( const automaton::DFTA < Symb
   
StateType state = it->second; StateType state = it->second;
   
if ( automaton.getFinalStates ( ).count ( state ) ) occ.insert ( tmp ); if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( tmp );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
common::Streams::log << state << std::endl; common::Streams::log << state << std::endl;
...@@ -594,7 +595,8 @@ ext::pair < bool, StateType > Run::calculateState ( const automaton::ArcFactored ...@@ -594,7 +595,8 @@ ext::pair < bool, StateType > Run::calculateState ( const automaton::ArcFactored
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
common::Streams::log << std::endl; common::Streams::log << std::endl;
   
if ( automaton.getFinalStates ( ).count ( state ) ) occ.insert ( tmp ); if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( tmp );
   
return ext::make_pair ( true, state ); return ext::make_pair ( true, state );
} }
...@@ -636,7 +638,8 @@ ext::pair < bool, StateType > Run::calculateState ( const automaton::UnorderedDF ...@@ -636,7 +638,8 @@ ext::pair < bool, StateType > Run::calculateState ( const automaton::UnorderedDF
   
StateType state = it->second; StateType state = it->second;
   
if ( automaton.getFinalStates ( ).count ( state ) ) occ.insert ( tmp ); if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( tmp );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
common::Streams::log << state << std::endl; common::Streams::log << state << std::endl;
...@@ -685,7 +688,7 @@ ext::pair < bool, ext::set < StateType > > Run::calculateStates ( const automato ...@@ -685,7 +688,7 @@ ext::pair < bool, ext::set < StateType > > Run::calculateStates ( const automato
unsigned j; unsigned j;
   
for ( j = 0; j < rank; j++ ) for ( j = 0; j < rank; j++ )
if ( !resStates[j].count ( transition.first.second[j] ) ) if ( ! resStates [ j ].contains ( transition.first.second [ j ] ) )
break; break;
   
if ( j == rank ) if ( j == rank )
...@@ -693,7 +696,8 @@ ext::pair < bool, ext::set < StateType > > Run::calculateStates ( const automato ...@@ -693,7 +696,8 @@ ext::pair < bool, ext::set < StateType > > Run::calculateStates ( const automato
} }
   
for ( const StateType & state : states ) for ( const StateType & state : states )
if ( automaton.getFinalStates ( ).count ( state ) ) occ.insert ( tmp ); if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( tmp );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
common::Streams::log << states << std::endl; common::Streams::log << states << std::endl;
...@@ -738,7 +742,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -738,7 +742,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
ext::set < unsigned > occ; ext::set < unsigned > occ;
   
for ( const InputSymbolType & symbol : string.getContent ( ) ) { for ( const InputSymbolType & symbol : string.getContent ( ) ) {
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( i ); occ.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -762,7 +766,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -762,7 +766,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
i++; i++;
} }
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( i ); occ.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -783,13 +787,13 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -783,13 +787,13 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
ext::set < unsigned > occ; ext::set < unsigned > occ;
   
for ( const InputSymbolType & symbol : string.getContent ( ) ) { for ( const InputSymbolType & symbol : string.getContent ( ) ) {
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( i ); occ.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
common::Streams::log << state << std::endl; common::Streams::log << state << std::endl;
   
if ( automaton.getCallInputAlphabet ( ).count ( symbol ) ) { if ( automaton.getCallInputAlphabet ( ).contains ( symbol ) ) {
auto transition = automaton.getCallTransitions ( ).find ( ext::make_pair ( state, symbol ) ); auto transition = automaton.getCallTransitions ( ).find ( ext::make_pair ( state, symbol ) );
   
if ( transition == automaton.getCallTransitions ( ).end ( ) ) if ( transition == automaton.getCallTransitions ( ).end ( ) )
...@@ -797,7 +801,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -797,7 +801,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
   
pushdownStore.push_back ( transition->second.second ); pushdownStore.push_back ( transition->second.second );
state = transition->second.first; state = transition->second.first;
} else if ( automaton.getReturnInputAlphabet ( ).count ( symbol ) ) { } else if ( automaton.getReturnInputAlphabet ( ).contains ( symbol ) ) {
auto transition = automaton.getReturnTransitions ( ).find ( ext::make_tuple ( state, symbol, pushdownStore.back ( ) ) ); auto transition = automaton.getReturnTransitions ( ).find ( ext::make_tuple ( state, symbol, pushdownStore.back ( ) ) );
   
if ( transition == automaton.getReturnTransitions ( ).end ( ) ) if ( transition == automaton.getReturnTransitions ( ).end ( ) )
...@@ -806,7 +810,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -806,7 +810,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
if ( pushdownStore.back ( ) != automaton.getBottomOfTheStackSymbol ( ) ) pushdownStore.pop_back ( ); if ( pushdownStore.back ( ) != automaton.getBottomOfTheStackSymbol ( ) ) pushdownStore.pop_back ( );
   
state = transition->second; state = transition->second;
} else if ( automaton.getLocalInputAlphabet ( ).count ( symbol ) ) { } else if ( automaton.getLocalInputAlphabet ( ).contains ( symbol ) ) {
auto transition = automaton.getLocalTransitions ( ).find ( ext::make_pair ( state, symbol ) ); auto transition = automaton.getLocalTransitions ( ).find ( ext::make_pair ( state, symbol ) );
   
if ( transition == automaton.getLocalTransitions ( ).end ( ) ) if ( transition == automaton.getLocalTransitions ( ).end ( ) )
...@@ -820,7 +824,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -820,7 +824,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
i++; i++;
} }
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( i ); occ.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -840,7 +844,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -840,7 +844,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
unsigned i = 0; unsigned i = 0;
ext::set < unsigned > occ; ext::set < unsigned > occ;
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( i ); occ.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -901,7 +905,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -901,7 +905,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
if ( ! transitionFound ) if ( ! transitionFound )
return ext::make_tuple ( false, state, occ, pushdownStore ); return ext::make_tuple ( false, state, occ, pushdownStore );
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( i ); occ.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -942,7 +946,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -942,7 +946,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
if ( ! transitionFound ) if ( ! transitionFound )
break; break;
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( i ); occ.insert ( i );
   
if ( common::GlobalData::verbose ) if ( common::GlobalData::verbose )
...@@ -964,7 +968,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -964,7 +968,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
   
for ( auto symbolIter = string.getContent ( ).begin ( ); symbolIter != string.getContent ( ).end ( ); ) { for ( auto symbolIter = string.getContent ( ).begin ( ); symbolIter != string.getContent ( ).end ( ); ) {
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( std::distance ( string.getContent ( ).begin ( ), symbolIter ) ); occ.insert ( std::distance ( string.getContent ( ).begin ( ), symbolIter ) );
   
if ( common::GlobalData::verbose ) { if ( common::GlobalData::verbose ) {
...@@ -998,7 +1002,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS ...@@ -998,7 +1002,7 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
} }
} }
   
if ( automaton.getFinalStates ( ).count ( state ) ) if ( automaton.getFinalStates ( ).contains ( state ) )
occ.insert ( string.getContent ( ).size ( ) ); occ.insert ( string.getContent ( ).size ( ) );
   
if ( common::GlobalData::verbose ) { if ( common::GlobalData::verbose ) {
...@@ -1050,7 +1054,7 @@ ext::set < ext::tuple < StateType, ext::set < unsigned >, ext::deque < PushdownS ...@@ -1050,7 +1054,7 @@ ext::set < ext::tuple < StateType, ext::set < unsigned >, ext::deque < PushdownS
continue; continue;
   
if ( symbolIter == string . getContent () . end () ) { if ( symbolIter == string . getContent () . end () ) {
if ( automaton . getFinalStates () . count ( state ) || stack.m_value == nullptr ) { if ( automaton . getFinalStates () . contains ( state ) || stack.m_value == nullptr ) {
res.insert ( ext::make_tuple ( state, occurrences, reconstruct ( stack ), reconstruct ( output ) ) ); res.insert ( ext::make_tuple ( state, occurrences, reconstruct ( stack ), reconstruct ( output ) ) );
} }
} }
...@@ -1115,7 +1119,7 @@ ext::set < ext::tuple < StateType, ext::set < unsigned >, ext::deque < PushdownS ...@@ -1115,7 +1119,7 @@ ext::set < ext::tuple < StateType, ext::set < unsigned >, ext::deque < PushdownS
continue; continue;
   
if ( symbolIter == string . getContent () . end () ) { if ( symbolIter == string . getContent () . end () ) {
if ( automaton . getFinalStates () . count ( state ) || stack.m_value == nullptr ) { if ( automaton . getFinalStates () . contains ( state ) || stack.m_value == nullptr ) {
res.insert ( ext::make_tuple ( state, occurrences, reconstruct ( stack ) ) ); res.insert ( ext::make_tuple ( state, occurrences, reconstruct ( stack ) ) );
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment