|
From: <ma...@us...> - 2012-08-14 13:07:37
|
Revision: 1450
http://scstudio.svn.sourceforge.net/scstudio/?rev=1450&view=rev
Author: madzin
Date: 2012-08-14 13:07:26 +0000 (Tue, 14 Aug 2012)
Log Message:
-----------
Some fixes connected with Find Flow
Modified Paths:
--------------
trunk/src/membership/diff_impl.cpp
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_base.h
trunk/src/scstudio.cpp
trunk/tests/diff/diff_test.cpp
trunk/tests/membership/membership_test.cpp
trunk/tests/membership/test_bmsc04.mpr.result
trunk/tests/membership/test_bmsc06.mpr.result
trunk/tests/membership/test_bmsc07.mpr.result
Modified: trunk/src/membership/diff_impl.cpp
===================================================================
--- trunk/src/membership/diff_impl.cpp 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/src/membership/diff_impl.cpp 2012-08-14 13:07:26 UTC (rev 1450)
@@ -356,12 +356,44 @@
}
else
{
+ bool change_allowed = true;
+
for (int i = rest; i < 0; i++)
{
- if (event_b != NULL)
- event_b = event_b->get_predecessor();
- else
- event_b = b_soa->get_last();
+ if(event_b == NULL && change_allowed)
+ {
+ EventAreaPtr last_area = start_b->get_instance()->get_last();
+ StrictOrderAreaPtr last_soa = boost::dynamic_pointer_cast<StrictOrderArea>(last_area);
+
+ if(last_soa == NULL)
+ throw std::runtime_error("Flow contains coregion");
+
+ event_b = last_soa->get_last();
+ }
+
+ //the previous bloc is allowed only at first run of cycle
+ change_allowed = false;
+
+ if(event_b->get_predecessor() == NULL)
+ {
+ EventAreaPtr previous_area = event_b->get_area()->get_previous();
+ CoregionAreaPtr previous_ca = boost::dynamic_pointer_cast<CoregionArea>(previous_area);
+
+ if(previous_ca != NULL)
+ throw std::runtime_error("Flow contains coregion");
+
+ StrictOrderAreaPtr previous_soa;
+ previous_soa = boost::dynamic_pointer_cast<StrictOrderArea>(previous_area);
+
+ if(previous_soa == NULL)
+ event_b = NULL;
+ else
+ event_b = previous_soa->get_last();
+
+ continue;
+ }
+
+ event_b = event_b->get_predecessor();
}
}
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/src/membership/membership_alg.cpp 2012-08-14 13:07:26 UTC (rev 1450)
@@ -369,6 +369,7 @@
search_conf = diff_conf->get_flow_config();
c->set_path(diff_conf->get_path());
+ c->set_total_diff_amount(diff_conf->get_diff_amount());
}
else
throw std::runtime_error("Unexpected behaviour 11.");
@@ -377,7 +378,6 @@
if(c->get_hmsc_diff())
return NULL;
- // if HMSC diff it returns specification with colored path
if (c->get_result() != NULL)
return make_result(c, dup_hmsc);
else
@@ -477,14 +477,6 @@
return check_next(c, hmsc_node, b);
else
{
- //when deosn't exist empty path to EndNode
- if (b->is_null(c) && !is_node_null(c, node))
- {
- c->top_pop_path();
- c->pop_time_stacks();
- return false;
- }
-
ConfigurationPtr old_config_I, old_config_II;
old_config_I = new Configuration(b);
@@ -1233,12 +1225,16 @@
}
}
- //TODO ten konfigurak sa mi nepozdava, je potrebne aby to bol konfigurak, ktory odpoveda koncu aktualneho uzlu
- DiffConfigPtr diff_conf = new DiffConfig(c->get_path(), conf, diff_amount);
- c->get_heap()->insert(diff_conf);
-
if(diff_amount != 0)
+ {
+ c->set_total_diff_amount(c->get_total_diff_amount() + diff_amount);
+ //TODO ten konfigurak sa mi nepozdava, je potrebne aby to bol konfigurak,
+ //ktory odpoveda koncu aktualneho uzlu
+ DiffConfigPtr diff_conf = new DiffConfig(c->get_path(), conf, c->get_total_diff_amount());
+ c->get_heap()->insert(diff_conf);
+
return false;
+ }
return true;
}
Modified: trunk/src/membership/membership_base.h
===================================================================
--- trunk/src/membership/membership_base.h 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/src/membership/membership_base.h 2012-08-14 13:07:26 UTC (rev 1450)
@@ -410,6 +410,7 @@
enum checkingTimeMode checking_time_mode;
MembershipHeapPtr diff_heap; //heap for diff computation in HMSC
+ unsigned int total_diff_amount;
enum DiffType diff_type;
bool hmsc_diff;
@@ -429,6 +430,7 @@
msc = NULL;
processed_ref_node = NULL;
diff_heap = new MembershipHeap();
+ total_diff_amount = 0;
hmsc_diff = false;
}
@@ -945,6 +947,16 @@
return diff_heap;
}
+ unsigned int get_total_diff_amount()
+ {
+ return total_diff_amount;
+ }
+
+ void set_total_diff_amount(unsigned int diff_amount)
+ {
+ total_diff_amount = diff_amount;
+ }
+
void set_hmsc_diff(bool v)
{
hmsc_diff = v;
Modified: trunk/src/scstudio.cpp
===================================================================
--- trunk/src/scstudio.cpp 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/src/scstudio.cpp 2012-08-14 13:07:26 UTC (rev 1450)
@@ -585,15 +585,13 @@
{
try
{
+ std::list<MscPtr> counterexamples = (*vec_it)->get_counterexamples();
std::list<MscPtr>::iterator list_it;
std::wcout << (*vec_it)->get_msg() << std::endl; //TODO change to cout
- for(list_it = (*vec_it)->get_counterexamples().begin();
- list_it != (*vec_it)->get_counterexamples().end();
- list_it++)
- {
+
+ for(list_it = counterexamples.begin(); list_it != counterexamples.end(); list_it++)
z120.save_msc(std::cout, L"msc_diff", *list_it);
- }
}
catch(std::exception& exc)
{
@@ -751,15 +749,13 @@
{
try
{
+ std::list<MscPtr> counterexamples = (*vec_it)->get_counterexamples();
std::list<MscPtr>::iterator list_it;
std::wcout << (*vec_it)->get_msg() << std::endl; //TODO change to cout
- for(list_it = (*vec_it)->get_counterexamples().begin();
- list_it != (*vec_it)->get_counterexamples().end();
- list_it++)
- {
+
+ for(list_it = counterexamples.begin(); list_it != counterexamples.end(); list_it++)
z120.save_msc(std::cout, TOWSTRING(specification), *list_it);
- }
}
catch(std::exception& exc)
{
Modified: trunk/tests/diff/diff_test.cpp
===================================================================
--- trunk/tests/diff/diff_test.cpp 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/tests/diff/diff_test.cpp 2012-08-14 13:07:26 UTC (rev 1450)
@@ -118,14 +118,16 @@
try
{
- std::vector<SearcherResultPtr>::iterator result_it;
- std::list<MscPtr>::iterator list_it;
+ std::vector<SearcherResultPtr>::iterator result_it;
+ std::list<MscPtr> counterexamples;
+ std::list<MscPtr>::iterator list_it;
+
for(result_it = result.begin(); result_it != result.end(); result_it++)
{
- for(list_it = (*result_it)->get_counterexamples().begin();
- list_it != (*result_it)->get_counterexamples().end();
- list_it++)
+ counterexamples = (*result_it)->get_counterexamples();
+
+ for(list_it = counterexamples.begin(); list_it != counterexamples.end(); list_it++)
z120.save_msc(std::cout, L"msc_diff", *list_it);
}
}
Modified: trunk/tests/membership/membership_test.cpp
===================================================================
--- trunk/tests/membership/membership_test.cpp 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/tests/membership/membership_test.cpp 2012-08-14 13:07:26 UTC (rev 1450)
@@ -109,22 +109,22 @@
else
result = mem.find(msc[0], bmscs, focused_instances);
-if(!result.empty())
-{
- std::vector<SearcherResultPtr>::iterator vec_it;
- std::list<MscPtr>::iterator list_it;
+ if(!result.empty())
+ {
+ std::vector<SearcherResultPtr>::iterator vec_it;
- for(vec_it = result.begin(); vec_it != result.end(); vec_it++)
- {
- std::wcerr << (*vec_it)->get_msg() << std::endl;
- for(list_it = (*vec_it)->get_counterexamples().begin();
- list_it != (*vec_it)->get_counterexamples().end();
- list_it++)
+ std::list<MscPtr> counterexamples;
+ std::list<MscPtr>::iterator list_it;
+
+ for(vec_it = result.begin(); vec_it != result.end(); vec_it++)
{
- z120.save_msc(std::cout, TOWSTRING(filename), *list_it);
+ counterexamples = (*vec_it)->get_counterexamples();
+ std::wcerr << (*vec_it)->get_msg() << std::endl;
+
+ for(list_it = counterexamples.begin(); list_it != counterexamples.end(); list_it++)
+ z120.save_msc(std::cout, TOWSTRING(filename), (*list_it));
}
}
-}
return errors;
}
Modified: trunk/tests/membership/test_bmsc04.mpr.result
===================================================================
--- trunk/tests/membership/test_bmsc04.mpr.result 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/tests/membership/test_bmsc04.mpr.result 2012-08-14 13:07:26 UTC (rev 1450)
@@ -1 +1,46 @@
-Flow "mystery" not found.
+Flow "mystery" not found. Diff is available (HMSC path + diff):
+mscdocument test_hmsc04;
+msc Stranka_1;
+/* PATH */
+initial connect/* PATH */
+ L0;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L0: reference super/* PATH */
+ connect/* PATH */
+ L1;
+/* PATH */
+L1: final/* PATH */
+;
+endmsc;
+msc super;
+inst A;
+inst B;
+A: instance;
+out aaa,0 to B;
+endinstance;
+B: instance;
+in aaa,0 from A;
+endinstance;
+endmsc;
+mscdocument test_hmsc04;
+msc mystery;
+inst A;
+inst B;
+A: instance;
+/* REMOVED */
+/* REMOVED */
+out bbb,0 to B;
+/* ADDED */
+/* ADDED */
+out aaa,1 to B;
+endinstance;
+B: instance;
+/* REMOVED */
+/* REMOVED */
+in bbb,0 from A;
+/* ADDED */
+/* ADDED */
+in aaa,1 from A;
+endinstance;
+endmsc;
Modified: trunk/tests/membership/test_bmsc06.mpr.result
===================================================================
--- trunk/tests/membership/test_bmsc06.mpr.result 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/tests/membership/test_bmsc06.mpr.result 2012-08-14 13:07:26 UTC (rev 1450)
@@ -1 +1,57 @@
-Flow "mystery" not found.
+Flow "mystery" not found. Diff is available (HMSC path + diff):
+mscdocument test_hmsc06;
+msc Stranka_1;
+/* PATH */
+initial connect/* PATH */
+ L0;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L0: reference Secret/* PATH */
+ connect/* PATH */
+ L1;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L1: reference super/* PATH */
+ connect/* PATH */
+ L2;
+/* PATH */
+L2: final/* PATH */
+;
+endmsc;
+msc Secret;
+inst A;
+inst B;
+A: instance;
+out bbb,0 to B;
+endinstance;
+B: instance;
+in bbb,0 from A;
+endinstance;
+endmsc;
+msc super;
+inst A;
+inst B;
+A: instance;
+in aaa,0 from B;
+endinstance;
+B: instance;
+out aaa,0 to A;
+endinstance;
+endmsc;
+mscdocument test_hmsc06;
+msc mystery;
+inst A;
+inst B;
+A: instance;
+out bbb,0 to B;
+/* ADDED */
+/* ADDED */
+in aaa,1 from B;
+endinstance;
+B: instance;
+in bbb,0 from A;
+/* ADDED */
+/* ADDED */
+out aaa,1 to A;
+endinstance;
+endmsc;
Modified: trunk/tests/membership/test_bmsc07.mpr.result
===================================================================
--- trunk/tests/membership/test_bmsc07.mpr.result 2012-08-14 09:30:48 UTC (rev 1449)
+++ trunk/tests/membership/test_bmsc07.mpr.result 2012-08-14 13:07:26 UTC (rev 1450)
@@ -1 +1,63 @@
-Flow "mystery" not found.
+Flow "mystery" not found. Diff is available (HMSC path + diff):
+mscdocument test_hmsc06;
+msc Stranka_1;
+/* PATH */
+initial connect/* PATH */
+ L0;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L0: reference Secret/* PATH */
+ connect/* PATH */
+ L1;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L1: reference super/* PATH */
+ connect/* PATH */
+ L2;
+/* PATH */
+L2: final/* PATH */
+;
+endmsc;
+msc Secret;
+inst A;
+inst B;
+A: instance;
+out bbb,0 to B;
+endinstance;
+B: instance;
+in bbb,0 from A;
+endinstance;
+endmsc;
+msc super;
+inst A;
+inst B;
+A: instance;
+in aaa,0 from B;
+endinstance;
+B: instance;
+out aaa,0 to A;
+endinstance;
+endmsc;
+mscdocument test_hmsc06;
+msc mystery;
+inst A;
+inst B;
+A: instance;
+out bbb,0 to B;
+/* REMOVED */
+/* REMOVED */
+in a,1 from B;
+/* ADDED */
+/* ADDED */
+in aaa,2 from B;
+endinstance;
+B: instance;
+in bbb,0 from A;
+/* REMOVED */
+/* REMOVED */
+out a,1 to A;
+/* ADDED */
+/* ADDED */
+out aaa,2 to A;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|