UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Rule Class Reference

Represents the data structure for a rule including a unique identifier. More...

#include <Rule.h>

Inheritance diagram for Rule:
Inheritance graph
[legend]
Collaboration diagram for Rule:
Collaboration graph
[legend]

Public Member Functions

 Rule (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. More...
 
 Rule (Rule const &oldRule)
 Generates a new rule for the given rule, copying its content. More...
 
 Rule (AnonRule const &oldRule)
 Generates a new rule for the given rule, copying its content. More...
 
 Rule (AnonHypergraph const &graph)
 Generates a new rule using the given graph. More...
 
virtual ~Rule ()
 Destroys this Rule object.
 
IDType getID () const
 Returns the unique identifier of this Rule object. More...
 
virtual void streamTo (std::ostream &ost) const override
 Streams as string representation of this Streamable object to the given ostream. More...
 
string getName () const
 Returns the name of this rule. More...
 
void setName (string name)
 Sets the name of this rule to the given string. More...
 
AnonHypergraph_sp getLeft ()
 Returns a pointer to the left graph of this rule. More...
 
AnonHypergraph_csp getLeft () const
 Returns a pointer to the left graph of this rule. More...
 
AnonHypergraph_sp getRight ()
 Returns a pointer to the right graph of this rule. More...
 
AnonHypergraph_csp getRight () const
 Returns a pointer to the right graph of this rule. More...
 
void setLeft (AnonHypergraph_sp graph)
 Sets the left graph of this rule to be the given graph. More...
 
void setRight (AnonHypergraph_sp graph)
 Sets the right graph of this rule to be the given graph. More...
 
MappinggetMapping ()
 Returns a reference to the mapping of this rule. More...
 
Mapping const & getMapping () const
 Returns a reference to the mapping of this rule. More...
 
void setMapping (Mapping const &map)
 Replaces the mapping of this rule by the given mapping. More...
 
virtual bool isBackApplicable (AnonHypergraph const &graph, Mapping const &match) const
 Returns true, if this rule is backward applicable to the given graph, i.e. More...
 
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. More...
 
bool isInjective () const
 Checks and returns true, iff the rule is injective. More...
 
bool isConflictFree (Mapping const &match) const
 Check whether the given match is conflict-free wrt. More...
 

Protected Member Functions

void adjustSplitRule (AnonRule &partial, AnonRule &total) const
 Takes two rules and changes them to be the two split rules of this rule. More...
 

Protected Attributes

IDType ID
 Stores the ID of this Rule.
 
string name
 Stores the name of this rule.
 
AnonHypergraph_sp left
 Stores a pointer to the left graph of this rule.
 
AnonHypergraph_sp right
 Stores a pointer to the right graph of this rule.
 
Mapping interface
 Stores the mapping from the left to the right graph of this rule.
 

Detailed Description

Represents the data structure for a rule including a unique identifier.

The rule consists of a name, a left rulegraph, a right rulegraph and a mapping form the left to the right graph. This class slightly extends the AnonRule class.

See Also
AnonHypergraph
Mapping
AnonRule
Author
Jan Stückrath

Constructor & Destructor Documentation

Rule ( 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.

If these parameters are not given, an empty string is used as name, empty graphs are used as left and right sides and an empty mapping is used as mapping. This rule is also assigned a new unique identifier. Caution, the left and right graphs are stores and not copied by this constructor.

Parameters
namethe name of the rule (default: empty string)
leftthe left graph of the rule (default: empty graph)
rightthe right graph of the rule (default: empty graph)
matchthe mapping of the left to the right graph (default: empty mapping)
Rule ( Rule const &  oldRule)

Generates a new rule for the given rule, copying its content.

The new rule is an independent copy of the old rule and is assigned a new unique identifier.

Parameters
oldRulethe old rule from which the data will be copied
Rule ( AnonRule const &  oldRule)

Generates a new rule for the given rule, copying its content.

The new rule is an independent copy of the old rule and is assigned a new unique identifier.

Parameters
oldRulethe old rule from which the data will be copied
Rule ( AnonHypergraph const &  graph)

Generates a new rule using the given graph.

A copy of the given graph is generated as left and as right graph and the mapping is initialized to be the identity. Furthermore, the new rule is assigned a new unique identifier.

Parameters
graphthe graph which will be used as left and right graph

Member Function Documentation

void adjustSplitRule ( AnonRule partial,
AnonRule total 
) const
protectedinherited

Takes two rules and changes them to be the two split rules of this rule.

The first rule (partial) has to be the identity on the left side of this rule and the second rule (total) has to be a copy of this rule.

Parameters
partialthe identity rule on the left graph of this rule
totala copy of this rule
void fillSplitRule ( pair< shared_ptr< AnonRule >, shared_ptr< AnonRule >> &  rulePair) const
virtualinherited

Splits this rule into a total and a partial part and stores both subrules in the given pair.

The first rule p is the partial rule and the second rule t is the total rule, such that the composition t(p(x)) is the old rule.

Parameters
rulePaira reference to a pair of rule pointer, which will be set to the actual pointer to the split rules
IDType getID ( ) const

Returns the unique identifier of this Rule object.

Returns
the unique identifier of this rule
AnonHypergraph_sp getLeft ( )
inherited

Returns a pointer to the left graph of this rule.

Returns
a pointer to the left graph of this rule
AnonHypergraph_csp getLeft ( ) const
inherited

Returns a pointer to the left graph of this rule.

Returns
a pointer to the left graph of this rule
Mapping & getMapping ( )
inherited

Returns a reference to the mapping of this rule.

Returns
a reference to the mapping of this rule
Mapping const & getMapping ( ) const
inherited

Returns a reference to the mapping of this rule.

Returns
a reference to the mapping of this rule
string getName ( ) const
inherited

Returns the name of this rule.

Returns
the name of this rule
AnonHypergraph_sp getRight ( )
inherited

Returns a pointer to the right graph of this rule.

Returns
a pointer to the right graph of this rule
AnonHypergraph_csp getRight ( ) const
inherited

Returns a pointer to the right graph of this rule.

Returns
a pointer to the right graph of this rule
bool isBackApplicable ( AnonHypergraph const &  graph,
Mapping const &  match 
) const
virtualinherited

Returns true, if this rule is backward applicable to the given graph, i.e.

there is at least one graph to which this rule can be applied and the application results in the given graph. The given mapping is used as co-match from the right side of the rule to the given graph. Caution, this functions assumes that the match is a valid total morphism, but does not perfom checks.

Parameters
graphthe graph to which the rule should be applied backwards
matchthe mapping used as co-match from the right graph to the given graph
Returns
true, iff the rule is backward applicable to the given graph using the match

Reimplemented in UQRuleInstance.

bool isConflictFree ( Mapping const &  match) const
inherited

Check whether the given match is conflict-free wrt.

this rule, i.e. there are no two nodes or edges with the same image under the match such that one of these nodes is deleted by the rule and the other is preserved.

Parameters
matchthe match to be checked; it must match all nodes of the left-hand side to some graph (which we do not need to know) return true iff the match is conflict-free wrt. this rule
bool isInjective ( ) const
inherited

Checks and returns true, iff the rule is injective.

A rule is injective if two elements of the left graph are never mapped to the same element of the right graph. Note that a rule need not be total to be injective.

Returns
true, iff the rule is injective
void setLeft ( AnonHypergraph_sp  graph)
inherited

Sets the left graph of this rule to be the given graph.

Caution, the given graph is used directly and not copied. Furthermore, the mapping and right graph are not changed.

Parameters
graphthe new left graph of this rule
void setMapping ( Mapping const &  map)
inherited

Replaces the mapping of this rule by the given mapping.

The given mapping is copied and not used directly.

Parameters
mapthe new mapping of this rule
void setName ( string  name)
inherited

Sets the name of this rule to the given string.

Parameters
namethe new name of this rule
void setRight ( AnonHypergraph_sp  graph)
inherited

Sets the right graph of this rule to be the given graph.

Caution, the given graph is used directly and not copied. Furthermore, the mapping and left graph are not changed.

Parameters
graphthe new right graph of this rule
void streamTo ( std::ostream &  ost) const
overridevirtual

Streams as string representation of this Streamable object to the given ostream.

Parameters
ostthe stream to which the string representation will be written

Reimplemented from AnonRule.


The documentation for this class was generated from the following files: