From e1614a62e60cf43b3fa872b697949832c06afa49 Mon Sep 17 00:00:00 2001 From: Jonny007-MKD <1-23-4-5@web.de> Date: Tue, 7 Jan 2014 20:28:09 +0100 Subject: [PATCH] Supress 2nd Wertetabelle if no hazard was found --- Hazard/Hazard/CellCollection.cpp | 1 + Hazard/Hazard/CellCollection.h | 2 ++ Hazard/Hazard/Hazard.cpp | 7 ++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Hazard/Hazard/CellCollection.cpp b/Hazard/Hazard/CellCollection.cpp index 8f38a1e..c027444 100644 --- a/Hazard/Hazard/CellCollection.cpp +++ b/Hazard/Hazard/CellCollection.cpp @@ -47,6 +47,7 @@ void CellCollection::findHazards() printf("Hazard found! Cell %d <--> Cell %d\n", I, (*nc)->index); this->globalPIC->add(I, (*nc)->index); // add PI that solves hazard. Not quite smart... (*nc)->refresh(this->globalPIC); // refresh the foreign PIC (a PI was added) + this->hazardsFound = true; } currentCell->refresh(this->globalPIC); // refresh the current PIC (a PI was added) delete hazardousNeighbors; diff --git a/Hazard/Hazard/CellCollection.h b/Hazard/Hazard/CellCollection.h index 26f5259..2e8abea 100644 --- a/Hazard/Hazard/CellCollection.h +++ b/Hazard/Hazard/CellCollection.h @@ -27,11 +27,13 @@ public: CellCollection(PrimImplikantCollection* &globalPIC) { this->init(globalPIC); + this->hazardsFound = false; }; vector cells; PrimImplikantCollection* globalPIC; + bool hazardsFound; }; #endif \ No newline at end of file diff --git a/Hazard/Hazard/Hazard.cpp b/Hazard/Hazard/Hazard.cpp index f9c40f1..810d17e 100644 --- a/Hazard/Hazard/Hazard.cpp +++ b/Hazard/Hazard/Hazard.cpp @@ -161,9 +161,10 @@ void user_main(void) // find and solve Hazards allCells->findHazards(); - - // print Wertetabelle and KV of corrected data - wt->Print(); + + if (allCells->hazardsFound) + // print Wertetabelle and KV of corrected data + wt->Print(); kv->Print(30 + kv->width() + 30, 30); // Diagramm neben dem vorherigen