From 70ea8891f391ca14a86dbb8be7398fc7b1746166 Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paris.fr> Date: Thu, 31 Oct 2024 13:08:03 +0100 Subject: [PATCH] Fixing bug of ticket 415 on DG generation --- .../AvatarCompactDependencyGraph.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/avatartranslator/AvatarCompactDependencyGraph.java b/src/main/java/avatartranslator/AvatarCompactDependencyGraph.java index acfb2bf52..c818e0b0a 100644 --- a/src/main/java/avatartranslator/AvatarCompactDependencyGraph.java +++ b/src/main/java/avatartranslator/AvatarCompactDependencyGraph.java @@ -258,13 +258,23 @@ public class AvatarCompactDependencyGraph { // We remove all transitions from previous to the first next in read operations + // This first next must lead to a read for (AUTState state : previousRead) { - if (state.outTransitions.size() > 0) { - AUTTransition tr = state.outTransitions.get(0); - AUTState otherState = states.get(tr.destination); - state.outTransitions.remove(0); - otherState.inTransitions.remove(0); - transitions.remove(tr); + // We look for a next corresponding to a read on signal + for(int i=0; i<state.outTransitions.size(); i++){ + AUTTransition tr = state.outTransitions.get(i); + if (states.size() >= tr.destination) { + AUTState otherState = states.get(tr.destination); + if (otherState.referenceObject instanceof AvatarActionOnSignal) { + AvatarActionOnSignal aaos = (AvatarActionOnSignal) otherState.referenceObject; + if (aaos.isReceiving()) { + state.outTransitions.remove(i); + otherState.inTransitions.remove(i); + transitions.remove(tr); + break; + } + } + } } } -- GitLab