30template <
class SymbolType = DefaultSymbolType >
31class PrefixRankedBarNonlinearPattern;
37#include <ext/algorithm>
57#include <string/LinearString.h>
70class VariablesBarSymbol;
71class NonlinearAlphabet;
90template <
class SymbolType >
91class PrefixRankedBarNonlinearPattern final :
public core::Components < PrefixRankedBarNonlinearPattern < SymbolType >, ext::set < common::ranked_symbol < SymbolType > >, component::Set, std::tuple < GeneralAlphabet, NonlinearAlphabet, BarSymbols >, common::ranked_symbol < SymbolType >, component::Value, std::tuple < SubtreeWildcard, VariablesBarSymbol > > {
206 return this->
template accessComponent < GeneralAlphabet > ( ).get ( );
215 return std::move ( this->
template accessComponent < GeneralAlphabet > ( ).
get ( ) );
224 this->
template accessComponent < GeneralAlphabet > ( ).add ( symbols );
233 return this->
template accessComponent < BarSymbols > ( ).get ( );
242 return std::move ( this->
template accessComponent < BarSymbols > ( ).
get ( ) );
251 this->
template accessComponent < BarSymbols > ( ).add ( bars );
260 return this->
template accessComponent < SubtreeWildcard > ( ).get ( );
269 return std::move ( this->
template accessComponent < SubtreeWildcard > ( ).
get ( ) );
278 return this->
template accessComponent < NonlinearAlphabet > ( ).get ( );
287 return std::move ( this->
template accessComponent < NonlinearAlphabet > ( ).
get ( ) );
296 return this->
template accessComponent < VariablesBarSymbol > ( ).get ( );
305 return std::move ( this->
template accessComponent < VariablesBarSymbol > ( ).
get ( ) );
344 return std::tie ( m_Data,
getAlphabet ( ),
getSubtreeWildcard ( ),
getNonlinearVariables ( ),
getBars ( ),
getVariablesBar ( ) ) <=>
std::tie ( other.m_Data, other.getAlphabet ( ), other.getSubtreeWildcard ( ), other.getNonlinearVariables ( ), other.getBars ( ), other.getVariablesBar ( ) );
355 return std::tie ( m_Data,
getAlphabet ( ),
getSubtreeWildcard ( ),
getNonlinearVariables ( ),
getBars ( ),
getVariablesBar ( ) ) ==
std::tie ( other.m_Data, other.
getAlphabet ( ), other.
getSubtreeWildcard ( ), other.
getNonlinearVariables ( ), other.
getBars ( ), other.
getVariablesBar ( ) );
367 out <<
"(PrefixRankedBarNonlinearPattern";
369 out <<
" bars = " << instance.
getBars ( );
371 out <<
" content = " << instance.
getContent ( );
388template <
class SymbolType >
389PrefixRankedBarNonlinearPattern < SymbolType >::PrefixRankedBarNonlinearPattern (
ext::set < common::ranked_symbol < SymbolType > > bars,
common::ranked_symbol < SymbolType > variablesBar,
common::ranked_symbol < SymbolType > subtreeWildcard,
ext::set < common::ranked_symbol < SymbolType > > nonlinearVariables,
ext::set < common::ranked_symbol < SymbolType > >
alphabet,
ext::vector < common::ranked_symbol < SymbolType > > data ) :
core::Components <
PrefixRankedBarNonlinearPattern,
ext::set <
common::ranked_symbol < SymbolType > >, component::Set, std::tuple < GeneralAlphabet, NonlinearAlphabet, BarSymbols >,
common::ranked_symbol < SymbolType >, component::Value, std::tuple < SubtreeWildcard, VariablesBarSymbol > > ( std::move (
alphabet ), std::move ( nonlinearVariables ), std::move ( bars ), std::move ( subtreeWildcard ), std::move ( variablesBar ) ) {
390 setContent ( std::move ( data ) );
393template <
class SymbolType >
394PrefixRankedBarNonlinearPattern < SymbolType >::PrefixRankedBarNonlinearPattern (
ext::set < common::ranked_symbol < SymbolType > > bars,
common::ranked_symbol < SymbolType > variablesBar,
common::ranked_symbol < SymbolType > subtreeWildcard,
ext::set < common::ranked_symbol < SymbolType > > nonlinearVariables,
ext::vector < common::ranked_symbol < SymbolType > > data ) :
PrefixRankedBarNonlinearPattern ( bars, variablesBar, subtreeWildcard, nonlinearVariables,
ext::set <
common::ranked_symbol < SymbolType > > ( data.begin ( ), data.end ( ) ) + bars +
ext::set < common::ranked_symbol < SymbolType > > { variablesBar, subtreeWildcard } + nonlinearVariables, data ) {
397template <
class SymbolType >
398PrefixRankedBarNonlinearPattern < SymbolType >::PrefixRankedBarNonlinearPattern (
ext::set < common::ranked_symbol < SymbolType > > bars,
common::ranked_symbol < SymbolType > variablesBar,
common::ranked_symbol < SymbolType > subtreeWildcard,
ext::vector < common::ranked_symbol < SymbolType > > data ) :
PrefixRankedBarNonlinearPattern ( bars, variablesBar, subtreeWildcard, { },
ext::set < common::ranked_symbol < SymbolType > > ( data.begin ( ), data.end ( ) ) + bars +
ext::set <
common::ranked_symbol < SymbolType > > { variablesBar, subtreeWildcard }, data ) {
401template <
class SymbolType >
402PrefixRankedBarNonlinearPattern < SymbolType >::PrefixRankedBarNonlinearPattern (
SymbolType barBase,
common::ranked_symbol < SymbolType > variablesBar,
const RankedTree < SymbolType > &
tree ) :
PrefixRankedBarNonlinearPattern (
TreeAuxiliary::computeBars (
tree.getAlphabet ( ), barBase ) +
ext::set <
common::ranked_symbol < SymbolType > > { variablesBar }, variablesBar, alphabet::WildcardSymbol::instance < common::ranked_symbol < SymbolType > > ( ), { },
tree.getAlphabet ( ) +
TreeAuxiliary::computeBars (
tree.getAlphabet ( ), barBase ) +
ext::set < common::ranked_symbol < SymbolType > > { variablesBar, alphabet::WildcardSymbol::instance < common::ranked_symbol < SymbolType > > ( ) },
TreeAuxiliary::treeToPrefix (
tree.getContent ( ),
alphabet::WildcardSymbol::instance <
common::ranked_symbol < SymbolType > > ( ), { }, barBase, variablesBar ) ) {
405template <
class SymbolType >
406PrefixRankedBarNonlinearPattern < SymbolType >::PrefixRankedBarNonlinearPattern (
SymbolType barBase,
common::ranked_symbol < SymbolType > variablesBar,
const RankedPattern < SymbolType > &
tree ) :
PrefixRankedBarNonlinearPattern (
TreeAuxiliary::computeBars (
tree.getAlphabet ( ), barBase ) +
ext::set <
common::ranked_symbol < SymbolType > > { variablesBar }, variablesBar,
tree.getSubtreeWildcard ( ), { },
tree.getAlphabet ( ) +
TreeAuxiliary::computeBars (
tree.getAlphabet ( ), barBase ) +
ext::set < common::ranked_symbol < SymbolType > > { variablesBar,
tree.getSubtreeWildcard ( ) },
TreeAuxiliary::treeToPrefix (
tree.getContent ( ),
tree.getSubtreeWildcard ( ), { }, barBase, variablesBar ) ) {
409template <
class SymbolType >
410PrefixRankedBarNonlinearPattern < SymbolType >::PrefixRankedBarNonlinearPattern (
SymbolType barBase,
common::ranked_symbol < SymbolType > variablesBar,
const RankedNonlinearPattern < SymbolType > &
tree ) :
PrefixRankedBarNonlinearPattern (
TreeAuxiliary::computeBars (
tree.getAlphabet ( ), barBase ) +
ext::set <
common::ranked_symbol < SymbolType > > { variablesBar }, variablesBar,
tree.getSubtreeWildcard ( ),
tree.getNonlinearVariables ( ),
tree.getAlphabet ( ) +
TreeAuxiliary::computeBars (
tree.getAlphabet ( ), barBase ) +
ext::set < common::ranked_symbol < SymbolType > > { variablesBar,
tree.getSubtreeWildcard ( ) } +
tree.getNonlinearVariables ( ),
TreeAuxiliary::treeToPrefix (
tree.getContent ( ),
tree.getSubtreeWildcard ( ),
tree.getNonlinearVariables ( ), barBase, variablesBar ) ) {
413template <
class SymbolType >
417template <
class SymbolType >
421template <
class SymbolType >
425template <
class SymbolType >
429template <
class SymbolType >
433template <
class SymbolType >
438template <
class SymbolType >
440 return std::move ( this->m_Data );
443template <
class SymbolType >
445 arityChecksum ( data );
449 throw TreeException (
"Input symbols not in the alphabet." );
452 this->m_Data = std::move ( data );
455template <
class SymbolType >
464 if ( getBars ( ).contains ( symbol ) || symbol == getVariablesBar ( ) )
465 return Data { current.terminals, static_cast < int > ( current.bars + symbol.getRank ( ) - 1 ), current.types - 1 };
467 return Data { static_cast < int > ( current.terminals + symbol.getRank ( ) - 1 ), current.bars, current.types + 1 };
470 if ( accRes.terminals != 0 || accRes.bars != 0 || accRes.types != 0 )
471 throw TreeException (
"The string does not form a tree" );
473 for (
unsigned i = 1;
i < data.size ( ); ++
i ) {
474 if ( data [
i - 1 ] == getSubtreeWildcard ( ) && data [
i ] != getVariablesBar ( ) )
475 throw TreeException (
"Inconsystency of SubtreeWildcard and variablesBar" );
477 if ( getNonlinearVariables ( ).
contains ( data [
i - 1 ] ) && data [
i ] != getVariablesBar ( ) )
478 throw TreeException (
"Inconsystency of NonlinearVariables and variablesBar" );
482template <
class SymbolType >
484 return this->m_Data.empty ( );
496template <
class SymbolType >
510 return std::find ( content.
begin ( ), content.
end ( ), symbol ) != content.
end ( ) || pattern.template accessComponent < tree::VariablesBarSymbol > ( ).get ( ) == symbol || pattern.template accessComponent < tree::BarSymbols > ( ).get ( ).count ( symbol ) || pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol;
540template <
class SymbolType >
554 return std::find ( content.
begin ( ), content.
end ( ), symbol ) != content.
end ( ) || pattern.template accessComponent < tree::VariablesBarSymbol > ( ).get ( ) == symbol;
566 return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
584template <
class SymbolType >
608 return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
623 if ( pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol )
633template <
class SymbolType >
645 return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
660 if ( pattern.template accessComponent < tree::NonlinearAlphabet > ( ).get ( ).count ( symbol ) )
670template <
class SymbolType >
682 return pattern.template accessComponent < tree::BarSymbols > ( ).get ( ).count ( symbol );
704template <
class SymbolType >
static ext::vector< common::ranked_symbol< DefaultSymbolType > > normalizeRankedSymbols(ext::vector< common::ranked_symbol< SymbolType > > &&symbols)
Definition: SymbolNormalize.h:113
static common::ranked_symbol< DefaultSymbolType > normalizeRankedSymbol(common::ranked_symbol< SymbolType > &&symbol)
Definition: SymbolNormalize.h:81
static ext::set< common::ranked_symbol< DefaultSymbolType > > normalizeRankedAlphabet(ext::set< common::ranked_symbol< SymbolType > > &&symbols)
Definition: SymbolNormalize.h:59
static Base instance()
Factory for the symbol construction of the symbol based on given type.
Definition: WildcardSymbol.h:83
Definition: ranked_symbol.hpp:20
const size_t & getRank() const &
Definition: ranked_symbol.hpp:83
Definition: components.hpp:181
static bool available(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:644
static void valid(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:656
static bool available(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:681
static void valid(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:693
Definition: components.hpp:25
static bool used(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &, const common::ranked_symbol< SymbolType > &)
Definition: PrefixRankedBarNonlinearPattern.h:595
static bool available(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:607
static void valid(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:619
static void valid(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &, const common::ranked_symbol< SymbolType > &)
Definition: PrefixRankedBarNonlinearPattern.h:531
static bool used(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:507
static bool available(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &, const common::ranked_symbol< SymbolType > &)
Definition: PrefixRankedBarNonlinearPattern.h:521
static bool available(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:565
static void valid(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &, const common::ranked_symbol< SymbolType > &)
Definition: PrefixRankedBarNonlinearPattern.h:575
static bool used(const tree::PrefixRankedBarNonlinearPattern< SymbolType > &pattern, const common::ranked_symbol< SymbolType > &symbol)
Definition: PrefixRankedBarNonlinearPattern.h:551
Definition: setComponents.hpp:26
Output iterator calling a callback function on assignment.
Definition: iterator.hpp:923
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: set.hpp:99
auto end() &
Inherited behavior of end for non-const instance.
Definition: set.hpp:129
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: vector.hpp:125
auto end() &
Inherited behavior of end for non-const instance.
Definition: vector.hpp:155
Linear string.
Definition: LinearString.h:57
Nonlinear tree pattern represented as linear sequece as result of preorder traversal with additional ...
Definition: PrefixRankedBarNonlinearPattern.h:91
friend ext::ostream & operator<<(ext::ostream &out, const PrefixRankedBarNonlinearPattern &instance)
Definition: PrefixRankedBarNonlinearPattern.h:366
const ext::set< common::ranked_symbol< SymbolType > > & getBars() const &
Definition: PrefixRankedBarNonlinearPattern.h:232
bool operator==(const PrefixRankedBarNonlinearPattern &other) const
Definition: PrefixRankedBarNonlinearPattern.h:354
PrefixRankedBarNonlinearPattern(ext::set< common::ranked_symbol< SymbolType > > bars, common::ranked_symbol< SymbolType > variablesBar, common::ranked_symbol< SymbolType > subtreeWildcard, ext::set< common::ranked_symbol< SymbolType > > nonlinearVariables, ext::set< common::ranked_symbol< SymbolType > > alphabet, ext::vector< common::ranked_symbol< SymbolType > > data)
Creates a new instance of the pattern with concrete alphabet, bars, content, wildcard,...
Definition: PrefixRankedBarNonlinearPattern.h:389
void setContent(ext::vector< common::ranked_symbol< SymbolType > > data)
Definition: PrefixRankedBarNonlinearPattern.h:444
bool isEmpty() const
Definition: PrefixRankedBarNonlinearPattern.h:483
void extendAlphabet(const ext::set< common::ranked_symbol< SymbolType > > &symbols)
Definition: PrefixRankedBarNonlinearPattern.h:223
common::ranked_symbol< SymbolType > && getVariablesBar() &&
Definition: PrefixRankedBarNonlinearPattern.h:304
ext::set< common::ranked_symbol< SymbolType > > && getAlphabet() &&
Definition: PrefixRankedBarNonlinearPattern.h:214
const ext::set< common::ranked_symbol< SymbolType > > & getNonlinearVariables() const &
Definition: PrefixRankedBarNonlinearPattern.h:277
const common::ranked_symbol< SymbolType > & getSubtreeWildcard() const &
Definition: PrefixRankedBarNonlinearPattern.h:259
void extendBars(const ext::set< common::ranked_symbol< SymbolType > > &bars)
Definition: PrefixRankedBarNonlinearPattern.h:250
ext::set< common::ranked_symbol< SymbolType > > && getBars() &&
Definition: PrefixRankedBarNonlinearPattern.h:241
ext::set< common::ranked_symbol< SymbolType > > && getNonlinearVariables() &&
Definition: PrefixRankedBarNonlinearPattern.h:286
common::ranked_symbol< SymbolType > && getSubtreeWildcard() &&
Definition: PrefixRankedBarNonlinearPattern.h:268
const ext::set< common::ranked_symbol< SymbolType > > & getAlphabet() const &
Definition: PrefixRankedBarNonlinearPattern.h:205
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedBarNonlinearPattern.h:434
const common::ranked_symbol< SymbolType > & getVariablesBar() const &
Definition: PrefixRankedBarNonlinearPattern.h:295
Tree pattern represented as linear sequece as result of preorder traversal with additional bar symbol...
Definition: PrefixRankedBarPattern.h:85
Tree structure represented as linear sequece as result of preorder traversal with additional bar symb...
Definition: PrefixRankedBarTree.h:78
Nonlinear tree pattern represented in its natural representation. The representation is so called ran...
Definition: RankedNonlinearPattern.h:74
Tree pattern represented in its natural representation. The representation is so called ranked,...
Definition: RankedPattern.h:72
Tree structure represented in its natural representation. The representation is so called ranked,...
Definition: RankedTree.h:72
static ext::set< common::ranked_symbol< SymbolType > > computeBars(const ext::set< common::ranked_symbol< SymbolType > > &alphabet, const SymbolType &barBase)
Definition: TreeAuxiliary.h:89
static ext::vector< common::ranked_symbol< SymbolType > > treeToPrefix(const ext::tree< common::ranked_symbol< SymbolType > > &tree)
Definition: TreeAuxiliary.h:185
Definition: TreeException.h:15
Definition: BarSymbol.cpp:12
int i
Definition: AllEpsilonClosure.h:118
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
Definition: Permutation.hpp:18
Definition: normalize.hpp:10
Definition: sigHandler.cpp:20
constexpr tuple< Elements &... > tie(Elements &... args) noexcept
Helper of extended tuple of references construction. The tuple is constructed to reffer to values in ...
Definition: tuple.hpp:218
bool contains(InputIt first, InputIt last, const Element &elem)
Linear version of search in a range of values.
Definition: algorithm.hpp:170
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
void end()
Definition: measurements.cpp:19
auto & get(ext::ptr_array< Type, N > &tpl)
Specialisation of get function for pointer arrays.
Definition: ptr_array.hpp:693
Definition: BackwardOccurrenceTest.h:17
static tree::PrefixRankedBarNonlinearPattern< > eval(tree::PrefixRankedBarNonlinearPattern< SymbolType > &&value)
Definition: PrefixRankedBarNonlinearPattern.h:706
Definition: normalize.hpp:13