X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/8d3e09e430e829b9d847847334cbfe37790baca3..5d4e709cb8d460b2efc083e6e7999f1c3a0eb602:/Graph.cpp?ds=sidebyside diff --git a/Graph.cpp b/Graph.cpp index a4dd676..d3fd276 100644 --- a/Graph.cpp +++ b/Graph.cpp @@ -107,3 +107,37 @@ bool Graph::removeSourceBlock(FunctionalBlock *block) { sources.removeAll(block); return true; } + +bool Graph::createPatterns() { + bool ok = true; + foreach(AbstractBlock* block, sources) { + FunctionalBlock* funBlock = AB_TO_FUN(block); + ok = funBlock->createPatterns(); + if (!ok) return false; + } + + foreach(AbstractBlock* block, groups) { + GroupBlock* group = AB_TO_GRP(block); + foreach(AbstractBlock* inBlock, group->getBlocks()) { + if (inBlock->isFunctionalBlock()) { + FunctionalBlock* funBlock = AB_TO_FUN(inBlock); + ok = funBlock->createPatterns(); + if (!ok) return false; + } + } + } + return true; +} + +void Graph::resetPatternComputed() { + foreach(AbstractBlock* block, sources) { + block->setPatternComputed(false); + } + foreach(AbstractBlock* block, groups) { + GroupBlock* group = AB_TO_GRP(block); + group->setPatternComputed(false); + foreach(AbstractBlock* inBlock, group->getBlocks()) { + inBlock->setPatternComputed(false); + } + } +}