Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
PrefixRankedBarNonlinearPattern.h
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
29#include "../common/TreeFromXMLParser.h"
30#include "../common/TreeToXMLComposer.h"
31
32namespace core {
33
34template < class SymbolType >
35struct xmlApi < tree::PrefixRankedBarNonlinearPattern < SymbolType > > {
43 static std::string xmlTagName ( ) {
44 return "PrefixRankedBarNonlinearPattern";
45 }
46
54 static bool first ( const ext::deque < sax::Token >::const_iterator & input ) {
56 }
57
66
73 static void compose ( ext::deque < sax::Token > & out, const tree::PrefixRankedBarNonlinearPattern < SymbolType > & pattern );
74};
75
76template < class SymbolType >
79 ext::set < common::ranked_symbol < SymbolType > > bars = tree::TreeFromXMLParser::parseBars < common::ranked_symbol < SymbolType > > ( input );
80 common::ranked_symbol < SymbolType > variablesBarSymbol = tree::TreeFromXMLParser::parseVariablesBar < common::ranked_symbol < SymbolType > > ( input );
81 common::ranked_symbol < SymbolType > subtreeWildcardSymbol = tree::TreeFromXMLParser::parseWildcardSymbol < common::ranked_symbol < SymbolType > > ( input );
82 ext::set < common::ranked_symbol < SymbolType > > nonlinearVariables = tree::TreeFromXMLParser::parseNonlinearVariables < common::ranked_symbol < SymbolType > > ( input );
83 ext::set < common::ranked_symbol < SymbolType > > rankedAlphabet = tree::TreeFromXMLParser::parseAlphabet < common::ranked_symbol < SymbolType > > ( input );
84 ext::vector < common::ranked_symbol < SymbolType > > data = tree::TreeFromXMLParser::parseLinearContent < common::ranked_symbol < SymbolType > > ( input );
86
87 return tree::PrefixRankedBarNonlinearPattern < SymbolType > ( std::move ( bars ), std::move ( variablesBarSymbol ), std::move ( subtreeWildcardSymbol ), std::move ( nonlinearVariables ), std::move ( rankedAlphabet ), std::move ( data ) );
88}
89
90template < class SymbolType >
92 out.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT );
99 out.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT );
100}
101
102} /* namespace core */
103
Definition: ranked_symbol.hpp:20
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
Definition: set.hpp:44
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
static void popToken(ext::deque< Token >::iterator &input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:39
static bool isToken(ext::deque< Token >::const_iterator input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:29
Nonlinear tree pattern represented as linear sequece as result of preorder traversal with additional ...
Definition: PrefixRankedBarNonlinearPattern.h:91
const ext::set< common::ranked_symbol< SymbolType > > & getBars() const &
Definition: PrefixRankedBarNonlinearPattern.h:232
const ext::set< common::ranked_symbol< SymbolType > > & getNonlinearVariables() const &
Definition: PrefixRankedBarNonlinearPattern.h:277
const common::ranked_symbol< SymbolType > & getSubtreeWildcard() const &
Definition: PrefixRankedBarNonlinearPattern.h:259
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
static void composeAlphabet(ext::deque< sax::Token > &out, const ext::set< SymbolType > &symbols)
Definition: TreeToXMLComposer.h:86
static void composeContent(ext::deque< sax::Token > &out, const ext::vector< SymbolType > &content)
Definition: TreeToXMLComposer.h:96
static void composeNonlinearVariables(ext::deque< sax::Token > &out, const ext::set< SymbolType > &symbols)
Definition: TreeToXMLComposer.h:130
static void composeBars(ext::deque< sax::Token > &out, const ext::set< SymbolType > &symbols)
Definition: TreeToXMLComposer.h:55
static void composeVariablesBar(ext::deque< sax::Token > &out, const SymbolType &symbol)
Definition: TreeToXMLComposer.h:65
static void composeSubtreeWildcard(ext::deque< sax::Token > &out, const SymbolType &symbol)
Definition: TreeToXMLComposer.h:72
Definition: normalize.hpp:10
Definition: BackwardOccurrenceTest.h:17
static bool first(const ext::deque< sax::Token >::const_iterator &input)
Tests whether the token stream starts with this type.
Definition: PrefixRankedBarNonlinearPattern.h:54
static std::string xmlTagName()
The XML tag name of class.
Definition: PrefixRankedBarNonlinearPattern.h:43
Definition: xmlApi.hpp:27