next up previous contents index
Next: Rule Administrators ( RuleAdmin Up: Pre- and Postconditions Previous: Key Set Iterators (   Contents   Index


Rules ( Rule )

Definition

An instance r of the data type Rule is a rule p1 $ \wedge$...$ \wedge$ pk $ \rightarrow$ q, where p1,...pk, q are properties (of type AgdKey). The interpretation of such a rule is, that property q holds if all properties p1,..., pk are satisfied, e.g., forest $ \wedge$ singlesource $ \rightarrow$ tree means that a graph which represents a forest with a single source is a tree.

If a rule is stored in a rule administrator admin, it is assigned a unique index, which, e.g., can be used for realizing arrays indexed by rules in admin.

We use the following abbreviations: p $ \rightarrow$ q1 $ \wedge$...$ \wedge$ qk stands for the k rules p $ \rightarrow$ q1,..., p $ \rightarrow$ qk, and q $ \leftrightarrow$ p1 $ \wedge$...$ \wedge$ pk stands for the k + 1 rules p1 $ \wedge$...$ \wedge$ pk $ \rightarrow$ q and q $ \rightarrow$ p1,..., q $ \rightarrow$ pk.

#include < AGD/Rule.h >

Creation

Rule r creates an instances r of type Rule initialized to $ \rightarrow$ nil.

Rule r(AgdKey q) creates an instances r of type Rule initialized to $ \rightarrow$ q.

Rule r(AgdKey p1, AgdKey q) creates an instances r of type Rule initialized to p1 $ \rightarrow$ q.

Rule r(AgdKey p1, AgdKey p2, AgdKey q)
    creates an instances r of type Rule initialized to p1 $ \wedge$ p2 $ \rightarrow$ q.

Rule r(AgdKey p1, AgdKey p2, AgdKey p3, AgdKey q)
    creates an instances r of type Rule initialized to p1 $ \wedge$ p2 $ \wedge$ p3 $ \rightarrow$ q.

Rule r(const Rule& r) creates an instances r of type Rule identical to r.

Operations

const leda_list<AgdKey>& r.left() returns the left side of r, i.e., p1 $ \wedge$...$ \wedge$ pk.

AgdKey r.right() returns the right side of r, i.e., q.

int r.length() returns the number k of properties on the left side of r.

int r.index() returns the index of r.

Rule& r.And(AgdKey p) extends r to p1 $ \wedge$...$ \wedge$ pk $ \wedge$ p $ \rightarrow$ q and returns r.

Rule& r.implies(AgdKey q) sets the right side of r to q and returns r.

Rule& r.index(int id) sets the index of r to id and returns r.

ostream& ostream& os << const Rule& r
    writes rule r to output stream os.


next up previous contents index
Next: Rule Administrators ( RuleAdmin Up: Pre- and Postconditions Previous: Key Set Iterators (   Contents   Index

© Copyright 1998-2001, Algorithmic Solutions Software GmbH. All rights reserved.
2001-08-13