diff --git a/Tests/group_test.flow b/Tests/group_test.flow index dfd733c..35c1711 100644 --- a/Tests/group_test.flow +++ b/Tests/group_test.flow @@ -1,7 +1,7 @@ blockdiag { st -> req1 -> req2; - st -> wt2; - wt1 -> req3; + st -> wt1 -> req3; + bl3; st [type=start]; req1 [type=sync, req="['1']"]; @@ -9,14 +9,29 @@ blockdiag { req3 [type=sync, req="['3']"]; wt1 [type=sync, wait="['1']"]; - wt2 [type=sync, wait="['2']"]; + bl3 [type=sync, block="['3']"]; group { req1; req2; - wt2; wt1; + bl3 } + ###################################################################################### + + # For debugging + class hidden [color = none, style = none, textcolor = white]; + stt -> listener -> logger -> listener [style = "none"]; + + listener [type=sync, + wait="lambda e: True", + class = "hidden", autoformat='false']; + + logger [type=logger, label="Events log", autoformat='false', width=200] + stt [type=start, class = "hidden", autoformat='false']; + + + } diff --git a/Tests/group_test.png b/Tests/group_test.png index 4a33438..bda8f41 100644 Binary files a/Tests/group_test.png and b/Tests/group_test.png differ diff --git a/flow.py b/flow.py index 68492d2..a1273cc 100644 --- a/flow.py +++ b/flow.py @@ -161,19 +161,12 @@ def step_to_next_state(diagram): t["ID"] = _id _id += 1 tmp[sn].extend(trans) + tmp[n].extend(trans) tmp[n].extend(n.node_type.keep(n.tokens, n)) - # for g in nodes_group: - # for n in g.conn_nodes: - # for t in n.tokens + n.sync: - # for sn in g.groupStop: - # if t["ID"] not in [tt["ID"] for tt in (sn.tokens + sn.sync)]: - # if t in n.tokens: - # n.tokens.remove(t) - # elif t in n.sync: - # n.sync.remove(t) + for n in nodes: tmp[n], n.sync = n.node_type.synchronization(tmp[n], n.sync, n) @@ -190,6 +183,17 @@ def step_to_next_state(diagram): n.tokens.remove(t) elif t in n.sync: n.sync.remove(t) + for g in nodes_group: + ids =[] + for n in g.conn_nodes: + ids.extend([t["ID"] for t in (n.tokens + n.sync)]) + for n in g.groupStop: + for t in n.tokens +n.sync: + if t["ID"] not in ids: + if t in n.tokens: + n.tokens.remove(t) + elif t in n.sync: + n.sync.remove(t) return changed