UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
AnonRule.h
1 /***************************************************************************
2  * Copyright (C) 2005 by SZS *
3  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
19  ***************************************************************************/
20 
21 #ifndef ANONRULE_H_
22 #define ANONRULE_H_
23 
24 #include "AnonHypergraph.h"
25 #include "Mapping.h"
26 
27 namespace uncover {
28  namespace graphs {
29 
40  {
41 
42  public:
43 
54  AnonRule(string name = "",
55  AnonHypergraph_sp left = make_shared<AnonHypergraph>(),
56  AnonHypergraph_sp right = make_shared<AnonHypergraph>(),
57  Mapping const& match = Mapping());
58 
64  AnonRule(AnonRule const& oldRule);
65 
71  AnonRule(AnonHypergraph const& graph);
72 
76  virtual ~AnonRule();
77 
82  string getName() const;
83 
88  void setName(string name);
89 
95 
101 
106  AnonHypergraph_csp getLeft() const;
107 
113 
119  void setLeft(AnonHypergraph_sp graph);
120 
126  void setRight(AnonHypergraph_sp graph);
127 
132  Mapping& getMapping();
133 
138  Mapping const& getMapping() const;
139 
145  void setMapping(Mapping const& map);
146 
157  virtual bool isBackApplicable(AnonHypergraph const& graph, Mapping const& match) const;
158 
166  virtual void fillSplitRule(pair<shared_ptr<AnonRule>, shared_ptr<AnonRule>>& rulePair) const;
167 
174  bool isInjective() const;
175 
184  bool isConflictFree(Mapping const& match) const;
185 
186  virtual void streamTo(std::ostream& ost) const override;
187 
188  protected:
189 
197  void adjustSplitRule(AnonRule& partial, AnonRule& total) const;
198 
202  string name;
203 
208 
213 
218 
219  };
220 
224  typedef shared_ptr<AnonRule> AnonRule_sp;
225 
229  typedef shared_ptr<const AnonRule> AnonRule_csp;
230 
231  } /* namespace graphs */
232 } /* namespace uncover */
233 
234 #endif /* ANONRULE_H_ */
shared_ptr< AnonHypergraph > AnonHypergraph_sp
Alias of a shared pointer to an AnonHypergraph.
Definition: AnonHypergraph.h:415
void adjustSplitRule(AnonRule &partial, AnonRule &total) const
Takes two rules and changes them to be the two split rules of this rule.
Definition: AnonRule.cpp:173
Streamable provides a streaming function which must be implemented by any deriving class...
Definition: Streamable.h:31
shared_ptr< AnonRule > AnonRule_sp
Alias for a shared pointer to an AnonRule.
Definition: AnonRule.h:224
shared_ptr< const AnonHypergraph > AnonHypergraph_csp
Alias of a shared pointer to a constant AnonHypergraph.
Definition: AnonHypergraph.h:420
bool isConflictFree(Mapping const &match) const
Check whether the given match is conflict-free wrt.
Definition: AnonRule.cpp:207
void setRight(AnonHypergraph_sp graph)
Sets the right graph of this rule to be the given graph.
Definition: AnonRule.cpp:90
virtual bool isBackApplicable(AnonHypergraph const &graph, Mapping const &match) const
Returns true, if this rule is backward applicable to the given graph, i.e.
Definition: AnonRule.cpp:103
This is the data structure representing a morphism mapping from a graph to another graph...
Definition: Mapping.h:36
AnonHypergraph_sp right
Stores a pointer to the right graph of this rule.
Definition: AnonRule.h:212
AnonRule serves as a data structure of a rule object.
Definition: AnonRule.h:39
AnonHypergraph_sp getLeft()
Returns a pointer to the left graph of this rule.
Definition: AnonRule.cpp:67
void setLeft(AnonHypergraph_sp graph)
Sets the left graph of this rule to be the given graph.
Definition: AnonRule.cpp:85
bool isInjective() const
Checks and returns true, iff the rule is injective.
Definition: AnonRule.cpp:203
AnonHypergraph_sp left
Stores a pointer to the left graph of this rule.
Definition: AnonRule.h:207
AnonRule(string name="", AnonHypergraph_sp left=make_shared< AnonHypergraph >(), AnonHypergraph_sp right=make_shared< AnonHypergraph >(), Mapping const &match=Mapping())
Generates a new rule with the given name, left graph, right graph and mapping.
Definition: AnonRule.cpp:30
Mapping interface
Stores the mapping from the left to the right graph of this rule.
Definition: AnonRule.h:217
virtual ~AnonRule()
Destroys this rule.
Definition: AnonRule.cpp:55
void setMapping(Mapping const &map)
Replaces the mapping of this rule by the given mapping.
Definition: AnonRule.cpp:162
string getName() const
Returns the name of this rule.
Definition: AnonRule.cpp:57
An AnonHypergraph is a data structure storing a hypergraph.
Definition: AnonHypergraph.h:43
string name
Stores the name of this rule.
Definition: AnonRule.h:202
shared_ptr< const AnonRule > AnonRule_csp
Alias for a shared pointer to a constant AnonRule.
Definition: AnonRule.h:229
virtual void fillSplitRule(pair< shared_ptr< AnonRule >, shared_ptr< AnonRule >> &rulePair) const
Splits this rule into a total and a partial part and stores both subrules in the given pair...
Definition: AnonRule.cpp:167
Mapping & getMapping()
Returns a reference to the mapping of this rule.
Definition: AnonRule.cpp:95
virtual void streamTo(std::ostream &ost) const override
Streams as string representation of this Streamable object to the given ostream.
Definition: AnonRule.cpp:229
AnonHypergraph_sp getRight()
Returns a pointer to the right graph of this rule.
Definition: AnonRule.cpp:72
void setName(string name)
Sets the name of this rule to the given string.
Definition: AnonRule.cpp:62