next up previous contents index
Next: Base Class for Pre- Up: Pre- and Postconditions Previous: Tagged Rule Literals (   Contents   Index


Tagged Rules ( TaggedRule )

Definition

An instance r of the data type TaggedRule is a rule (p1, i1) $ \wedge$...$ \wedge$ (pk, ik) $ \rightarrow$ q, where (pj, ij) (1 < = j < = k) are tagged rule literals (of type TRLiteral), and q is a key. Tagged rules are used by modules in order to define postcondition rules.

#include < AGD/TaggedRule.h >

Creation

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

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

TaggedRule r(const leda_list<TRLiteral>& L, AgdKey q)
    creates an instances r of type TaggedRule initialized to l1 $ \wedge$...$ \wedge$ lk $ \rightarrow$ q if L = l1,..., lk.

Operations

const leda_list<TRLiteral>& r.left() returns the left side of r, i.e., (p1, i1),...,(pk, ik).

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

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

TaggedRule& r.And(AgdKey p, int j = 1)
    extends r to (p1, i1) $ \wedge$...$ \wedge$ (pk, ik) $ \wedge$ (p, j) $ \rightarrow$ q and returns r.

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

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

Example

We create a tagged rule (planar, 1) $ \wedge$ (triconnected, 1) $ \wedge$ (simple, 1) $ \wedge$ (no$ \_$self$ \_$loops, 1)$ \to$convex and set it as postcondition rule of a layout algorithm.


SampleLayout::SampleLayout() : LayoutModule (true)
{
  TaggedRule r(convex);

  r.And(planar).And(triconnected).And(simple).And(no_self_loops);

  add_post_rule(r);
  
    ....
}


next up previous contents index
Next: Base Class for Pre- Up: Pre- and Postconditions Previous: Tagged Rule Literals (   Contents   Index

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