diff --git a/src/main/java/tmltranslator/TMLChoice.java b/src/main/java/tmltranslator/TMLChoice.java index 87a4bfe865e14b79c4515167321657f6d248150c..b4c8703865807b0c15385f209a79455a1975a234 100755 --- a/src/main/java/tmltranslator/TMLChoice.java +++ b/src/main/java/tmltranslator/TMLChoice.java @@ -78,13 +78,12 @@ public class TMLChoice extends TMLActivityElement{ public boolean isNonDeterministicGuard(int i) { if (i < getNbGuard()) { String guard = guards.get(i); - guard = getGuard(i); - guard = Conversion.replaceAllChar(guard, '[', " "); - guard = Conversion.replaceAllChar(guard, ']', " "); guard = guard.trim(); if (guard.length() == 0) { return true; } + guard = Conversion.replaceAllChar(guard, ' ', ""); + return (guard.compareTo("[]") == 0); } return false; } diff --git a/src/main/java/tmltranslator/TMLSyntaxChecking.java b/src/main/java/tmltranslator/TMLSyntaxChecking.java index 337b834db16801d7f2abb1338950cc100a71b358..4d579b16dcfb1d89f6bd1c00af94274ef2a97a2c 100755 --- a/src/main/java/tmltranslator/TMLSyntaxChecking.java +++ b/src/main/java/tmltranslator/TMLSyntaxChecking.java @@ -365,9 +365,18 @@ public class TMLSyntaxChecking { elseg = choice.getElseGuard(); afterg = choice.getAfterGuard(); for(j=0; j<choice.getNbGuard(); j++) { + /*if (action.length() == 1) { + if ((action.compareTo("[") == 0) || (action.compareTo("]") == 0)) { + addError(t, elt, SYNTAX_ERROR + " in expression " + action, TMLError.ERROR_BEHAVIOR); + } + + }*/ + //TraceManager.addDev("Testing guard: " + choice.getGuard(j)); if (!choice.isNonDeterministicGuard(j) && !choice.isStochasticGuard(j)) { if ((j!= elseg) && (j!=afterg)) { action = choice.getGuard(j); + action = action.trim(); + parsing(t, elt, "guard", action); } } diff --git a/src/main/java/ui/GTMLModeling.java b/src/main/java/ui/GTMLModeling.java index 72c21d70ac77b62c1dda7790acffb4d143f47951..ba9cb7de5044fa35445cef7f0b7b72e8889f3dfc 100755 --- a/src/main/java/ui/GTMLModeling.java +++ b/src/main/java/ui/GTMLModeling.java @@ -2405,7 +2405,7 @@ public class GTMLModeling { int nbNonDeter = tmlchoice.nbOfNonDeterministicGuard(); int nbStocha = tmlchoice.nbOfStochasticGuard(); if ((nbNonDeter > 0) && (nbStocha > 0)) { - UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted choice: it has both non-determinitic and stochastic guards"); + UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted choice: it has both non-deterministic and stochastic guards"); ce.setTDiagramPanel(tadp); ce.setTGComponent(tgc); checkingErrors.add(ce); @@ -2414,7 +2414,7 @@ public class GTMLModeling { if (nb > 0) { nb = nb + tmlchoice.nbOfElseAndAfterGuards(); if (nb != tmlchoice.getNbGuard()) { - UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted choice: it has both non-determinitic/ stochastic and regular guards)"); + UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted choice: it has both non-deterministic/ stochastic and regular guards"); ce.setTDiagramPanel(tadp); ce.setTGComponent(tgc); checkingErrors.add(ce);