From d18b8150ba16f4a930b213dae1f4fb369cb3d0bf Mon Sep 17 00:00:00 2001 From: Tim Dwyer Date: Fri, 14 Jul 2006 04:09:40 +0000 Subject: - Connectors with end-markers now constrained to point downwards in graph layout - vpsc namespace added to libvpsc (bzr r1408) --- src/libvpsc/block.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/libvpsc/block.cpp') diff --git a/src/libvpsc/block.cpp b/src/libvpsc/block.cpp index 69a439cd7..221df536a 100644 --- a/src/libvpsc/block.cpp +++ b/src/libvpsc/block.cpp @@ -23,6 +23,7 @@ using std::endl; #endif using std::vector; +namespace vpsc { void Block::addVariable(Variable* const v) { v->block=this; vars->push_back(v); @@ -346,6 +347,22 @@ void Block::populateSplitBlock(Block *b, Variable* const v, Variable* const u) { populateSplitBlock(b, (*c)->right, v); } } +// Search active constraint tree from u to see if there is a directed path to v. +// Returns true if path is found with all constraints in path having their visited flag +// set true. +bool Block::isActiveDirectedPathBetween(Variable* u, Variable *v) { + if(u==v) return true; + for (Cit c=u->out.begin();c!=u->out.end();++c) { + if(canFollowRight(*c,NULL)) { + if(isActiveDirectedPathBetween((*c)->right,v)) { + (*c)->visited=true; + return true; + } + (*c)->visited=false; + } + } + return false; +} /** * Block needs to be split because of a violated constraint between vl and vr. * We need to search the active constraint tree between l and r and find the constraint @@ -402,3 +419,4 @@ ostream& operator <<(ostream &os, const Block& b) } return os; } +} -- cgit v1.2.3