diff --git a/alib2algo/src/arbology/exact/ExactPatternMatch.h b/alib2algo/src/arbology/exact/ExactPatternMatch.h index e82877c4474c695d067b2a54e990d4c64f5bfef5..f69338bb8acfb4776883faa27f958642433b2e3a 100644 --- a/alib2algo/src/arbology/exact/ExactPatternMatch.h +++ b/alib2algo/src/arbology/exact/ExactPatternMatch.h @@ -194,7 +194,7 @@ template < class SymbolType > bool ExactPatternMatch::matchHelper ( const ext::tree < common::ranked_symbol < SymbolType > > & subject, const ext::tree < common::ranked_symbol < SymbolType > > & pattern, const common::ranked_symbol < SymbolType > & subtreeVariable, const ext::set < common::ranked_symbol < SymbolType > > & nonlinearVariables, const ext::tree < common::ranked_symbol < unsigned > > & repeats, ext::map < common::ranked_symbol < SymbolType >, unsigned > & variablesSetting ) { if ( pattern.getData ( ) == subtreeVariable ) return true; - if ( nonlinearVariables.count ( pattern.getData ( ) ) ) { + if ( nonlinearVariables.contains ( pattern.getData ( ) ) ) { auto setting = variablesSetting.find ( pattern.getData ( ) ); if ( setting != variablesSetting.end ( ) ) return repeats.getData ( ).getSymbol ( ) == setting->second; diff --git a/alib2algo/src/tree/exact/BackwardOccurrenceTest.h b/alib2algo/src/tree/exact/BackwardOccurrenceTest.h index e05be3f1aadc2dfe91920df8cfbc0dd393e17f58..5568c8e316774ca7c74d7cd9c2e407f944b7a3c5 100644 --- a/alib2algo/src/tree/exact/BackwardOccurrenceTest.h +++ b/alib2algo/src/tree/exact/BackwardOccurrenceTest.h @@ -42,7 +42,7 @@ ext::pair < int, int > BackwardOccurrenceTest::occurrence ( const PrefixRankedBa // match of symbol offset = offset - 1; j = j - 1; - } else if ( ( pattern.getContent ( )[j] == pattern.getVariablesBar ( ) ) && ( subject.getBars ( ).count ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S + } else if ( ( pattern.getContent ( )[j] == pattern.getVariablesBar ( ) ) && ( subject.getBars ( ).contains ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S // match of variable with subtree offset = subjectSubtreeJumpTable[offset]; j = j - 2; @@ -71,13 +71,13 @@ ext::pair < int, int > BackwardOccurrenceTest::occurrence ( const PrefixRankedBa // match of symbol offset = offset - 1; j = j - 1; - } else if ( ( pattern.getContent ( )[j] == pattern.getVariablesBar ( ) ) && ( subject.getBars ( ).count ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S + } else if ( ( pattern.getContent ( )[j] == pattern.getVariablesBar ( ) ) && ( subject.getBars ( ).contains ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S // else match of variable with subtree offset = subjectSubtreeJumpTable[offset]; j = j - 2; // check nonlinear variable - if ( pattern.getNonlinearVariables ( ).count ( pattern.getContent ( )[ j + 1 ] ) ) { + if ( pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( )[ j + 1 ] ) ) { auto setting = variablesSetting.find ( pattern.getContent ( )[ j + 1 ] ); if ( setting != variablesSetting.end ( ) && repeats.getContent ( )[ offset + 1 ].getSymbol ( ) != setting->second ) diff --git a/alib2algo/src/tree/exact/ForwardOccurrenceTest.h b/alib2algo/src/tree/exact/ForwardOccurrenceTest.h index 896df8a0847657930db8c8f5b0ee5cb9fee903d7..09b4ab97cb37a9d25fa3d198e6134b9d256df753 100644 --- a/alib2algo/src/tree/exact/ForwardOccurrenceTest.h +++ b/alib2algo/src/tree/exact/ForwardOccurrenceTest.h @@ -49,7 +49,7 @@ size_t ForwardOccurrenceTest::occurrence ( const PrefixRankedBarTree < SymbolTyp // match of symbol offset = offset + 1; j = j + 1; - } else if ( ( pattern.getContent ( )[j] == pattern.getSubtreeWildcard ( ) ) && ( ! subject.getBars ( ).count ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S + } else if ( ( pattern.getContent ( )[j] == pattern.getSubtreeWildcard ( ) ) && ( ! subject.getBars ( ).contains ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S // match of variable with subtree offset = subjectSubtreeJumpTable[offset]; j = j + 2; @@ -76,9 +76,9 @@ size_t ForwardOccurrenceTest::occurrence ( const PrefixRankedBarTree < SymbolTyp // match of symbol offset = offset + 1; j = j + 1; - } else if ( ( pattern.getContent ( )[j] == pattern.getSubtreeWildcard ( ) || pattern.getNonlinearVariables ( ).count ( pattern.getContent ( )[j] ) ) && ( ! subject.getBars ( ).count ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S + } else if ( ( pattern.getContent ( )[j] == pattern.getSubtreeWildcard ( ) || pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( )[j] ) ) && ( ! subject.getBars ( ).contains ( subject.getContent ( )[offset] ) ) ) { //the second part of the condition is needed to handle S |S // check nonlinear variable - if ( pattern.getNonlinearVariables ( ).count ( pattern.getContent ( )[ j ] ) ) { + if ( pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( )[ j ] ) ) { auto setting = variablesSetting.find ( pattern.getContent ( )[ j ] ); if ( setting != variablesSetting.end ( ) && repeats.getContent ( )[ offset ].getSymbol ( ) != setting->second ) @@ -143,9 +143,9 @@ size_t ForwardOccurrenceTest::occurrence ( const PrefixRankedTree < SymbolType > if ( subject.getContent ( )[offset] == pattern.getContent ( )[j] ) // match of symbol offset = offset + 1; - else if ( pattern.getContent ( )[j] == pattern.getSubtreeWildcard ( ) || pattern.getNonlinearVariables ( ).count ( pattern.getContent ( )[ j ] ) ) { + else if ( pattern.getContent ( )[j] == pattern.getSubtreeWildcard ( ) || pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( )[ j ] ) ) { // check nonlinear variable - if ( pattern.getNonlinearVariables ( ).count ( pattern.getContent ( )[ j ] ) ) { + if ( pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( )[ j ] ) ) { auto setting = variablesSetting.find ( pattern.getContent ( )[ j ] ); if ( setting != variablesSetting.end ( ) && repeats.getContent ( )[ offset ].getSymbol ( ) != setting->second ) diff --git a/alib2algo/src/tree/properties/BorderArrayNaive.h b/alib2algo/src/tree/properties/BorderArrayNaive.h index c3d123f823770ad0ef8153bccdbc7327f36df2ea..2fda47ed3844c92f64b2271edb55c19194ba86c4 100644 --- a/alib2algo/src/tree/properties/BorderArrayNaive.h +++ b/alib2algo/src/tree/properties/BorderArrayNaive.h @@ -86,8 +86,8 @@ bool BorderArrayNaive::matches ( const tree::PrefixRankedBarNonlinearPattern < S if ( pattern.getContent ( )[i] == pattern.getContent ( )[offset] ) { i++; offset++; - } else if ( ( pattern.getContent ( )[i] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).count ( pattern.getContent ( ) [ i ] ) ) - || ( pattern.getContent ( )[offset] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).count ( pattern.getContent ( ) [ offset ] ) ) ) { + } else if ( ( pattern.getContent ( )[i] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( ) [ i ] ) ) + || ( pattern.getContent ( )[offset] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( ) [ offset ] ) ) ) { i = subtreeJumpTable[i]; offset = subtreeJumpTable[offset]; } else { @@ -122,8 +122,8 @@ bool BorderArrayNaive::matches ( const tree::PrefixRankedNonlinearPattern < Symb if ( pattern.getContent ( )[i] == pattern.getContent ( )[offset] ) { i++; offset++; - } else if ( ( pattern.getContent ( )[i] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).count ( pattern.getContent ( ) [ i ] ) ) - || ( pattern.getContent ( )[offset] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).count ( pattern.getContent ( ) [ offset ] ) ) ) { + } else if ( ( pattern.getContent ( )[i] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( ) [ i ] ) ) + || ( pattern.getContent ( )[offset] == pattern.getSubtreeWildcard ( ) ) || ( pattern.getNonlinearVariables ( ).contains ( pattern.getContent ( ) [ offset ] ) ) ) { i = subtreeJumpTable[i]; offset = subtreeJumpTable[offset]; } else {