diff --git a/modeling/AVATAR/CoffeeMachine_Avatar.xml b/modeling/AVATAR/CoffeeMachine_Avatar.xml index 543761e46f6ec59cc96ec1c5e5a8be6a2df16423..11b3c2b4bafd606abe89ee02d8e27d339b60a691 100644 --- a/modeling/AVATAR/CoffeeMachine_Avatar.xml +++ b/modeling/AVATAR/CoffeeMachine_Avatar.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="false" ACTIVATE_PENALTIES="true" UPDATE_INFORMATION_DIPLO_SIM="false" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="1" LAST_SELECTED_SUB_TAB="0"> +<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="false" ACTIVATE_PENALTIES="true" UPDATE_INFORMATION_DIPLO_SIM="false" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="1" LAST_SELECTED_SUB_TAB="4"> <Modeling type="Avatar Requirement" nameTab="AVATAR Requirements" > <AvatarRDPanel name="AVATAR RD" minX="10" maxX="1900" minY="10" maxY="1400" zoom="1.0" > @@ -1293,7 +1293,7 @@ <extraparam> <isd value="in pushCoffeeButton()" /> <oso value="out push()" /> -<FIFOType asynchronous="false" synchronous="false" size="1024" blocking="false" private="true" broadcast="false" lossy="false" ams="false" /> +<FIFOType asynchronous="false" synchronousCH="true" size="1024" blocking="false" private="true" broadcast="false" lossy="false" ams="false" /> </extraparam> </CONNECTOR> <CONNECTOR type="5002" id="697" > @@ -1309,7 +1309,7 @@ <osd value="out ejectCoin(int nbOfCoins)" /> <isd value="in getCoin(int nbOfCoins)" /> <oso value="out putCoin(int nbOfCoins)" /> -<FIFOType asynchronous="false" synchronous="true" size="1024" blocking="false" private="true" broadcast="false" lossy="false" ams="false" /> +<FIFOType asynchronous="false" synchronousCH="true" size="1024" blocking="false" private="true" broadcast="false" lossy="false" ams="false" /> </extraparam> </CONNECTOR> <CONNECTOR type="5002" id="699" > @@ -1323,7 +1323,7 @@ <extraparam> <isd value="in pushTeaButton()" /> <oso value="out push()" /> -<FIFOType asynchronous="false" synchronous="false" size="1024" blocking="false" private="true" broadcast="false" lossy="false" ams="false" /> +<FIFOType asynchronous="false" synchronousCH="true" size="1024" blocking="false" private="true" broadcast="false" lossy="false" ams="false" /> </extraparam> </CONNECTOR> <COMPONENT type="303" id="716" > diff --git a/modeling/DIPLODOCUS/SmartCardProtocol.xml b/modeling/DIPLODOCUS/SmartCardProtocol.xml index cdb6ba8a1c9c80f349b2f22a1ebde7547766633d..e162e55fbf2c2fd7f65284df36142b165ced179f 100755 --- a/modeling/DIPLODOCUS/SmartCardProtocol.xml +++ b/modeling/DIPLODOCUS/SmartCardProtocol.xml @@ -1823,7 +1823,7 @@ <SUBCOMPONENT type="-1" id="336" > <father id="339" num="0" /> <cdparam x="1539" y="1274" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -1842,7 +1842,7 @@ <SUBCOMPONENT type="-1" id="340" > <father id="343" num="0" /> <cdparam x="1538" y="1088" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -1935,7 +1935,7 @@ <SUBCOMPONENT type="-1" id="360" > <father id="363" num="0" /> <cdparam x="1655" y="1254" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -1954,7 +1954,7 @@ <SUBCOMPONENT type="-1" id="364" > <father id="367" num="0" /> <cdparam x="2219" y="1083" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -1973,7 +1973,7 @@ <SUBCOMPONENT type="-1" id="368" > <father id="371" num="0" /> <cdparam x="2288" y="1044" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2030,7 +2030,7 @@ <SUBCOMPONENT type="-1" id="380" > <father id="383" num="0" /> <cdparam x="1218" y="1127" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2087,7 +2087,7 @@ <SUBCOMPONENT type="-1" id="392" > <father id="395" num="0" /> <cdparam x="732" y="714" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2106,7 +2106,7 @@ <SUBCOMPONENT type="-1" id="396" > <father id="399" num="0" /> <cdparam x="953" y="1045" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2164,7 +2164,7 @@ <SUBCOMPONENT type="-1" id="408" > <father id="411" num="0" /> <cdparam x="818" y="1031" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2222,7 +2222,7 @@ <SUBCOMPONENT type="-1" id="420" > <father id="423" num="0" /> <cdparam x="354" y="785" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2241,7 +2241,7 @@ <SUBCOMPONENT type="-1" id="424" > <father id="427" num="0" /> <cdparam x="146" y="818" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2296,7 +2296,7 @@ <SUBCOMPONENT type="-1" id="436" > <father id="439" num="0" /> <cdparam x="474" y="802" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2315,7 +2315,7 @@ <SUBCOMPONENT type="-1" id="440" > <father id="443" num="0" /> <cdparam x="245" y="885" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2334,7 +2334,7 @@ <SUBCOMPONENT type="-1" id="444" > <father id="447" num="0" /> <cdparam x="1059" y="1077" /> -<sizeparam width="8" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="10" height="15" minWidth="10" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="-75" maxX="30" minY="10" maxY="30" /> <infoparam name="value of the delay" value="b" /> @@ -2952,7 +2952,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="622" > <cdparam x="998" y="850" /> -<sizeparam width="50" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="50" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="Final @@ -3014,7 +3014,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="647" > <cdparam x="781" y="950" /> -<sizeparam width="89" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="89" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="Active Open @@ -3042,7 +3042,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="664" > <cdparam x="715" y="907" /> -<sizeparam width="97" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="97" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="Passive Open @@ -3115,7 +3115,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="692" > <cdparam x="884" y="1068" /> -<sizeparam width="108" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="108" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="send Ack of Fin @@ -3177,7 +3177,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="717" > <cdparam x="1000" y="1094" /> -<sizeparam width="108" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="108" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="send Ack of Fin @@ -3557,7 +3557,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="813" > <cdparam x="1159" y="1153" /> -<sizeparam width="108" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="108" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="send Ack of Fin @@ -3690,7 +3690,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="854" > <cdparam x="1759" y="1192" /> -<sizeparam width="86" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="86" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="Correct ack @@ -3718,7 +3718,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="871" > <cdparam x="1635" y="1168" /> -<sizeparam width="71" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="71" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="false ack @@ -3769,7 +3769,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="893" > <cdparam x="1469" y="1295" /> -<sizeparam width="127" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="127" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="return acknowldge @@ -3797,7 +3797,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="910" > <cdparam x="1620" y="927" /> -<sizeparam width="50" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="50" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="data @@ -3967,7 +3967,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="961" > <cdparam x="1825" y="889" /> -<sizeparam width="50" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="50" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="Syn @@ -3995,7 +3995,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="978" > <cdparam x="1707" y="945" /> -<sizeparam width="50" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="50" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="ack @@ -4124,7 +4124,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="1018" > <cdparam x="2283" y="1065" /> -<sizeparam width="114" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="114" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="2900" minY="10" maxY="1900" /> <infoparam name="UML Note" value="send Ack of SYN @@ -5693,7 +5693,7 @@ On prend b=1 comme exemple <COMPONENT type="301" id="1260" > <cdparam x="453" y="214" /> -<sizeparam width="105" height="20" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="105" height="15" minWidth="50" minHeight="20" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" /> <infoparam name="UML Note" value="data exchange @@ -5735,7 +5735,7 @@ On prend b=1 comme exemple <COMPONENT type="1008" id="1266" > <cdparam x="412" y="507" /> -<sizeparam width="129" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<sizeparam width="130" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" /> @@ -5957,14 +5957,14 @@ On prend b=1 comme exemple <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="600" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from write channel to send event" value="null" /> <P1 x="476" y="473" id="1262" /> -<P2 x="476" y="502" id="1264" /> +<P2 x="477" y="502" id="1264" /> <AutomaticDrawing data="true" /> </CONNECTOR> <CONNECTOR type="115" id="1302" > <cdparam x="471" y="529" /> <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="600" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from send event to stop state" value="null" /> -<P1 x="476" y="532" id="1265" /> +<P1 x="477" y="532" id="1265" /> <P2 x="476" y="565" id="1267" /> <AutomaticDrawing data="true" /> </CONNECTOR> diff --git a/src/main/java/avatartranslator/AvatarError.java b/src/main/java/avatartranslator/AvatarError.java new file mode 100644 index 0000000000000000000000000000000000000000..616466c230654045f5b2ccb407694c3f2567bb8f --- /dev/null +++ b/src/main/java/avatartranslator/AvatarError.java @@ -0,0 +1,98 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + +package avatartranslator; + +/** + * Class AvatarError + * Creation: 20/09/2020 + * + * @author Ludovic APVRILLE + * @version 1.0 20/08/2020 + */ +public class AvatarError { + + + public final static String[] errorStrings = { + "Invalid number of signals in the two sides of the relation", + "Signals are connected but there are not compatible because they are both IN signals", + "Signals are connected but there are not compatible because they are both OUT signals", + "Signals are connected but there have non compatible parameters", + "Missing block1 declaration in relation", + "Missing block2 declaration in relation", //5 + "No signal of that name in block" + }; + + + public int error; + public AvatarSpecification avspec; + public AvatarBlock block; + public AvatarRelation relation; + public AvatarElement firstAvatarElement; + public AvatarElement secondAvatarElement; + + public AvatarError(AvatarSpecification _avspec) { + avspec = _avspec; + } + + public String toString() { + String ret = ""; + if (block != null) { + ret+= block.getName() + " | "; + } + if (relation != null) { + ret += "relation " + relation.block1.getName() + " <> " + relation.block1.getName() + " | "; + } + + if (firstAvatarElement != null) { + ret += " for " + firstAvatarElement.getName() + " | "; + } + + if (secondAvatarElement != null) { + ret += " and for " + secondAvatarElement.getName() + " | "; + } + + if (error < errorStrings.length) { + ret += " : " + errorStrings[error]; + } + + + return ret; + } + +} diff --git a/src/main/java/avatartranslator/AvatarPragmaReachability.java b/src/main/java/avatartranslator/AvatarPragmaReachability.java index 9b0ed3e32240b3c70f77fa7ad6da0c0b5851d554..7307669d9244bb2010e18588b3b60bc89dc42f34 100644 --- a/src/main/java/avatartranslator/AvatarPragmaReachability.java +++ b/src/main/java/avatartranslator/AvatarPragmaReachability.java @@ -74,8 +74,7 @@ public class AvatarPragmaReachability extends AvatarPragma { } @Override - public AvatarPragmaReachability advancedClone(AvatarSpecification avspec) - { + public AvatarPragmaReachability advancedClone(AvatarSpecification avspec) { // !!! Should never be called !!! return null; } diff --git a/src/main/java/avatartranslator/AvatarRelation.java b/src/main/java/avatartranslator/AvatarRelation.java index 6bc915588d1ecca41a16b0f7fe585e0e43071689..7e73109492d9254b138a62d7914d459cde22af8d 100644 --- a/src/main/java/avatartranslator/AvatarRelation.java +++ b/src/main/java/avatartranslator/AvatarRelation.java @@ -156,6 +156,14 @@ public class AvatarRelation extends AvatarElement { return signals1.size(); } + public List<AvatarSignal> getSignals1() { + return signals1; + } + + public List<AvatarSignal> getSignals2() { + return signals2; + } + public AvatarSignal getSignal1(int _index) { return signals1.get(_index); } diff --git a/src/main/java/avatartranslator/AvatarSyntaxChecker.java b/src/main/java/avatartranslator/AvatarSyntaxChecker.java index 760de46251dd75245ab0aa201e1a40bb78de73ca..b8c72ddf514b720161beff3d4d1a344edbc69f54 100644 --- a/src/main/java/avatartranslator/AvatarSyntaxChecker.java +++ b/src/main/java/avatartranslator/AvatarSyntaxChecker.java @@ -64,6 +64,118 @@ public class AvatarSyntaxChecker { public AvatarSyntaxChecker() { } + + + public static ArrayList<AvatarError> checkSyntax(AvatarSpecification avspec) { + ArrayList<AvatarError> errors = new ArrayList<>(); + + errors.addAll(checkSignalRelations(avspec)); + + return errors; + } + + public static ArrayList<AvatarError> checkSignalRelations(AvatarSpecification avspec) { + ArrayList<AvatarError> errors = new ArrayList<>(); + + List<AvatarSignal> signals1, signals2; + // Check relations are corrects + for (AvatarRelation relation : avspec.getRelations()) { + signals1 = relation.getSignals1(); + signals2 = relation.getSignals2(); + + AvatarBlock block1, block2; + block1 = relation.block1; + block2 = relation.block2; + + if (block1 == null) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.error = 4; + errors.add(error); + } + + if (block2 == null) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.error = 5; + errors.add(error); + } + + if (signals1.size() != signals2.size()) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.error = 0; + errors.add(error); + } else { + // Compare signals characteristics + AvatarSignal sig1, sig2; + for(int i=0; i<signals1.size(); i++) { + sig1 = signals1.get(i); + sig2 = signals2.get(i); + + // In vs out + if (sig1.isIn() && sig2.isIn()) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.firstAvatarElement = sig1; + error.secondAvatarElement = sig2; + error.error = 1; + errors.add(error); + } else if (sig1.isOut() && sig2.isOut()) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.firstAvatarElement = sig1; + error.secondAvatarElement = sig2; + error.error = 2; + errors.add(error); + } + + // Attributes + //TraceManager.addDev("Checking attributes compatibility"); + if (!(sig1.isCompatibleWith(sig2))) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.firstAvatarElement = sig1; + error.secondAvatarElement = sig2; + error.error = 3; + errors.add(error); + } + + // Both signals exist in their respective block + if (block1 != null) { + AvatarSignal as = block1.getSignalByName(sig1.getSignalName()); + if (as == null) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.block = block1; + error.firstAvatarElement = sig1; + error.error = 6; + errors.add(error); + } + } + + if (block2 != null) { + AvatarSignal as = block2.getSignalByName(sig2.getSignalName()); + if (as == null) { + AvatarError error = new AvatarError(avspec); + error.relation = relation; + error.block = block2; + error.firstAvatarElement = sig2; + error.error = 6; + errors.add(error); + } + } + + } + } + } + + + return errors; + } + + + public static int isAValidGuard(AvatarSpecification _as, AvatarStateMachineOwner _ab, String _guard) { //TraceManager.addDev("Evaluating (non modified) guard:" + _guard); @@ -93,7 +205,7 @@ public class AvatarSyntaxChecker { BoolExpressionEvaluator bee = new BoolExpressionEvaluator(); - TraceManager.addDev("Evaluating (modified) guard:" + act); + //TraceManager.addDev("Evaluating (modified) guard:" + act); boolean result = bee.getResultOfWithIntExpr(act); if (bee.getError() != null) { TraceManager.addDev("Error: " + bee.getError() + " result=" + result); diff --git a/src/main/java/ui/GTURTLEModeling.java b/src/main/java/ui/GTURTLEModeling.java index 4691bb65b928a0b21876b1309eaba7ca2d17bcd6..d3e38150e9f25476ccd651c8dbc94f1cd63e2589 100644 --- a/src/main/java/ui/GTURTLEModeling.java +++ b/src/main/java/ui/GTURTLEModeling.java @@ -39,13 +39,14 @@ package ui; import avatartranslator.*; -import avatartranslator.AvatarSpecification; import avatartranslator.toproverif.AVATAR2ProVerif; import avatartranslator.totpn.AVATAR2TPN; import avatartranslator.toturtle.AVATAR2TURTLE; import avatartranslator.touppaal.AVATAR2UPPAAL; import common.ConfigurationTTool; import common.SpecConfigTTool; +import ddtranslator.DDSyntaxException; +import ddtranslator.DDTranslator; import graph.RG; import launcher.LauncherException; import launcher.RemoteExecutionThread; @@ -60,7 +61,11 @@ import org.xml.sax.SAXException; import proverifspec.ProVerifOutputAnalyzer; import proverifspec.ProVerifSpec; import req.ebrdd.EBRDD; +import sddescription.HMSC; +import sddescription.MSC; import sddescription.SDExchange; +import sdtranslator.SDTranslationException; +import sdtranslator.SDTranslator; import tmatrix.RequirementModeling; import tmltranslator.*; import tmltranslator.modelcompiler.TMLModelCompiler; @@ -69,9 +74,10 @@ import tmltranslator.toautomata.TML2AUTviaLOTOS; import tmltranslator.toavatar.FullTML2Avatar; import tmltranslator.toavatarsec.TML2Avatar; import tmltranslator.tosystemc.TML2SystemC; +import tmltranslator.toturtle.Mapping2TIF; +import tmltranslator.toturtle.TML2TURTLE; import tmltranslator.touppaal.RelationTMLUPPAAL; import tmltranslator.touppaal.TML2UPPAAL; -import tmltranslator.toturtle.*; import tpndescription.TPN; import translator.*; import translator.totpn.TURTLE2TPN; @@ -81,24 +87,22 @@ import ui.ad.TActivityDiagramPanel; import ui.atd.AttackTreeDiagramPanel; import ui.avatarad.AvatarADPanel; import ui.avatarbd.*; -import ui.avatarbd.AvatarBDLibraryFunction; -import ui.avatarbd.AvatarBDPanel; -import ui.avatarbd.AvatarBDStateMachineOwner; import ui.avatarcd.AvatarCDPanel; import ui.avatardd.ADDDiagramPanel; import ui.avatarmad.AvatarMADPanel; import ui.avatarmethodology.AvatarMethodologyDiagramPanel; import ui.avatarpd.AvatarPDPanel; import ui.avatarrd.AvatarRDPanel; -import ui.avatarsmd.AvatarSMDPanel; -import ui.avatarsmd.AvatarSMDState; -import ui.cd.*; -import ui.dd.*; import ui.avatarsmd.*; +import ui.cd.TCDTClass; +import ui.cd.TCDTObject; +import ui.cd.TClassDiagramPanel; +import ui.dd.TDDArtifact; +import ui.dd.TDDNode; +import ui.dd.TDeploymentDiagramPanel; import ui.diplodocusmethodology.DiplodocusMethodologyDiagramPanel; import ui.ebrdd.EBRDDPanel; import ui.eln.ELNDiagramPanel; -import ui.syscams.SysCAMSComponentTaskDiagramPanel; import ui.ftd.FaultTreeDiagramPanel; import ui.iod.InteractionOverviewDiagramPanel; import ui.ncdd.NCDiagramPanel; @@ -108,7 +112,9 @@ import ui.oscd.TURTLEOSClassDiagramPanel; import ui.procsd.ProCSDComponent; import ui.procsd.ProactiveCSDPanel; import ui.prosmd.ProactiveSMDPanel; +import ui.req.Requirement; import ui.req.RequirementDiagramPanel; +import ui.syscams.SysCAMSComponentTaskDiagramPanel; import ui.sysmlsecmethodology.SysmlsecMethodologyDiagramPanel; import ui.tmlad.*; import ui.tmlcd.TMLTaskDiagramPanel; @@ -122,11 +128,7 @@ import ui.ucd.UseCaseDiagramPanel; import ui.util.DefaultText; import ui.util.IconManager; import ui.window.JFrameSimulationTrace; -import ui.req.*; import uppaaldesc.UPPAALSpec; -import sddescription.*; -import sdtranslator.*; -import ddtranslator.*; import javax.swing.*; import javax.swing.tree.TreePath; @@ -135,8 +137,6 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.awt.*; import java.io.*; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.*; import java.util.List; @@ -310,14 +310,14 @@ public class GTURTLEModeling { if (newTrace.hasFile()) { // We have to remove identical traces LinkedList<SimulationTrace> ll = new LinkedList<>(); - for(SimulationTrace trace: simulationTraces) { + for (SimulationTrace trace : simulationTraces) { if (trace.hasFile()) { if (trace.getFullPath().compareTo(newTrace.getFullPath()) == 0) { ll.add(trace); } } } - for(SimulationTrace trace: ll) { + for (SimulationTrace trace : ll) { simulationTraces.remove(trace); } } @@ -808,8 +808,8 @@ public class GTURTLEModeling { //Check if a path between two tasks uses firewallnode boolean secure = true; List<HwLink> links = map.getTMLArchitecture().getHwLinks(); - HwExecutionNode node1 = map.getHwNodeOf(t1); - HwExecutionNode node2 = map.getHwNodeOf(t2); + HwExecutionNode node1 = map.getHwNodeOf(t1); + HwExecutionNode node2 = map.getHwNodeOf(t2); List<HwNode> found = new ArrayList<HwNode>(); List<HwNode> done = new ArrayList<HwNode>(); List<HwNode> path = new ArrayList<HwNode>(); @@ -875,7 +875,7 @@ public class GTURTLEModeling { List<HwNode> done = new ArrayList<HwNode>(); //List<HwNode> path = new ArrayList<HwNode>(); - HwExecutionNode node1 = map.getHwNodeOf(t1); + HwExecutionNode node1 = map.getHwNodeOf(t1); //Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); for (HwLink link : links) { @@ -1586,7 +1586,7 @@ public class GTURTLEModeling { HwExecutionNode node; List<TMLTask> tasks = map.getMappedTasks(); TMLTask task; - for(int i=0; i<nodes.size(); i++) { + for (int i = 0; i < nodes.size(); i++) { node = nodes.get(i); task = tasks.get(i); if ((node != null) && (task != null)) { @@ -1958,7 +1958,7 @@ public class GTURTLEModeling { TraceManager.addDev("Select last panel"); // Select the last Panel - TURTLEPanel newTP = mgui.getTabs().get(mgui.getTabs().size()-1); + TURTLEPanel newTP = mgui.getTabs().get(mgui.getTabs().size() - 1); if (newTP == null) { TraceManager.addDev("Null selected panel"); @@ -6287,7 +6287,7 @@ public class GTURTLEModeling { nameTab = elt.getAttribute("nameTab"); //indexDesign = mgui.createSysmlsecMethodology(nameTab); - indexDesign = mgui.createSysCAMSComponentDesign(nameTab); + indexDesign = mgui.createSysCAMSComponentDesign(nameTab); diagramNl = node.getChildNodes(); @@ -7979,7 +7979,7 @@ public class GTURTLEModeling { } catch (Exception e) { TraceManager.addError("Exception XML Component " + e.getMessage() + "trace=" + e.getStackTrace()); - throw new MalformedModelingException( e ); + throw new MalformedModelingException(e); } return tgc; } @@ -8745,8 +8745,6 @@ public class GTURTLEModeling { mgui.setMode(MainGUI.GEN_DESIGN_OK); - - return true; } } @@ -9031,7 +9029,7 @@ public class GTURTLEModeling { locMap.put(asme, timerReset); } - if (asme instanceof AvatarState ) { + if (asme instanceof AvatarState) { //check if empty checker state /* if (asme.getName().contains("signalstate_")){ //don't add the state, ignore next transition, @@ -9129,6 +9127,247 @@ public class GTURTLEModeling { public void drawPanel(AvatarSpecification avspec, AvatarDesignPanel adp) { // + + + // Check Errors in AVSPEC + TraceManager.addDev("Checking syntax of avatar spec."); + ArrayList<AvatarError> list = AvatarSyntaxChecker.checkSyntax(avspec); + for (AvatarError error : list) { + TraceManager.addDev("Error: " + error.toString()); + } + TraceManager.addDev("Check done. " + checkingErrors.size() + " errors found"); + + // Go for drawing! + hasCrypto = false; + //Map<String, Set<String>> originDestMap = new HashMap<String, Set<String>>(); + Map<String, AvatarBDBlock> blockMap = new HashMap<String, AvatarBDBlock>(); + if (adp == null) { + return; + } + if (avspec == null) { + return; + } + AvatarBDPanel abd = adp.abdp; + + //Find all blocks, create nested blocks starting from top left + int xpos = 10; + int ypos = 40; + + //Create blocks recursively, starting from top level ones with no father + //Lowest level blocks should be 100x100, next should be 100x(number of children*100+50)...etc, + //Find level #, 0 refers to no father, etc + Map<AvatarBlock, Integer> blockLevelMap = new HashMap<AvatarBlock, Integer>(); + Map<AvatarBlock, Integer> blockSizeMap = new HashMap<AvatarBlock, Integer>(); + Map<AvatarBlock, Integer> blockIncMap = new HashMap<AvatarBlock, Integer>(); + int maxLevel = 0; + for (AvatarBlock ab : avspec.getListOfBlocks()) { + int level = 0; + AvatarBlock block = ab; + while (block.getFather() != null) { + if (blockSizeMap.containsKey(block.getFather())) { + blockSizeMap.put(block.getFather(), blockSizeMap.get(block.getFather()) + 1); + } else { + blockSizeMap.put(block.getFather(), 1); + blockIncMap.put(block.getFather(), 10); + } + level++; + block = block.getFather(); + } + if (level > maxLevel) { + maxLevel = level; + } + if (!blockSizeMap.containsKey(block)) { + blockSizeMap.put(block, 0); + blockIncMap.put(block, 10); + } + blockLevelMap.put(ab, level); + } + + + for (int level = 0; level < maxLevel + 1; level++) { + for (AvatarBlock ab : avspec.getListOfBlocks()) { + if (blockLevelMap.get(ab) == level) { + if (level == 0) { + AvatarBDBlock bl = new AvatarBDBlock(xpos, ypos, abd.getMinX(), abd.getMaxX(), abd.getMinY(), abd.getMaxY(), false, null, abd); + abd.addComponent(bl, xpos, ypos, false, true); + bl.resize(100 * blockSizeMap.get(ab) + 100, 100 + (maxLevel - level) * 50); + drawBlockProperties(ab, bl); + AvatarSMDPanel smp = adp.getAvatarSMDPanel(bl.getValue()); + buildStateMachine(ab, bl, smp); + //TraceManager.addDev("Putting in block") + blockMap.put(bl.getValue().split("__")[bl.getValue().split("__").length - 1], bl); + xpos += 100 * blockSizeMap.get(ab) + 200; + } else { + + AvatarBDBlock father = blockMap.get(ab.getFather().getName().split("__")[ab.getFather().getName().split("__").length - 1]); + // + if (father == null) { + // + continue; + } + AvatarBDBlock bl = new AvatarBDBlock(father.getX() + blockIncMap.get(ab.getFather()), father.getY() + 10, abd.getMinX(), abd.getMaxX(), abd.getMinY(), abd.getMaxY(), false, father, abd); + abd.addComponent(bl, father.getX() + blockIncMap.get(ab.getFather()), father.getY() + 10, false, true); + int size = 100; + if (blockSizeMap.containsKey(ab)) { + size = 100 * blockSizeMap.get(ab) + 50; + } + bl.resize(size, 100 + (maxLevel - level) * 50); + drawBlockProperties(ab, bl); + abd.attach(bl); + AvatarSMDPanel smp = adp.getAvatarSMDPanel(bl.getValue()); + buildStateMachine(ab, bl, smp); + blockMap.put(bl.getValue().split("__")[bl.getValue().split("__").length - 1], bl); + blockIncMap.put(ab.getFather(), blockIncMap.get(ab.getFather()) + size + 10); + } + } + } + } + + for(String s: blockMap.keySet()) { + TraceManager.addDev("Key:" + s); + } + + + for (AvatarRelation ar : avspec.getRelations()) { + String bl1 = ar.block1.getName(); + String bl2 = ar.block2.getName(); + + /*TraceManager.addDev("bl1=" + bl1 + " bl2=" + bl2); + + AvatarBDBlock ab1 = blockMap.get(bl1); + AvatarBDBlock ab2 = blockMap.get(bl2); + + if (ab1 == null) { + TraceManager.addDev("Null ab1 block"); + break; + } + + if (ab2 == null) { + TraceManager.addDev("Null ab2 block"); + break; + }*/ + + bl1 = getLastKeyword(bl1); + bl2 = getLastKeyword(bl2); + + Vector<Point> points = new Vector<Point>(); + + TGConnectingPoint p1 = blockMap.get(bl1).findFirstFreeTGConnectingPoint(true, true); + p1.setFree(false); + + TGConnectingPoint p2 = blockMap.get(bl2).findFirstFreeTGConnectingPoint(true, true); + p2.setFree(false); + + if (bl2.equals(bl1)) { + //Add 2 point so the connection looks square + Point p = new Point(p1.getX(), p1.getY() - 10); + points.add(p); + p = new Point(p2.getX(), p2.getY() - 10); + points.add(p); + } + AvatarBDPortConnector conn = new AvatarBDPortConnector(0, 0, 0, 0, 0, 0, true, null, abd, p1, p2, points); + abd.addComponent(conn, 0, 0, false, true); + conn.setAsynchronous(ar.isAsynchronous()); + conn.setSynchronous(!ar.isAsynchronous()); + conn.setAMS(false); + conn.setBlocking(ar.isBlocking()); + conn.setPrivate(ar.isPrivate()); + conn.setSizeOfFIFO(ar.getSizeOfFIFO()); + + for (int indexSig = 0; indexSig < ar.getSignals1().size(); indexSig++) { + + //TraceManager.addDev("Adding signal 1: " + ar.getSignal1(i).toString() + " of block " + ar.block1.getName()); + conn.addSignal(ar.getSignal1(indexSig).toString(), ar.getSignal1(indexSig).getInOut() == 0, ar.block1.getName().contains(bl1)); + //TraceManager.addDev("Adding signal 2:" + ar.getSignal2(i).toString() + " of block " + ar.block2.getName()); + conn.addSignal(ar.getSignal2(indexSig).toString(), ar.getSignal2(indexSig).getInOut() == 0, !ar.block2.getName().contains(bl2)); + + conn.updateAllSignals(); + } + + conn.updateAllSignals(); + } + + ypos += 100; + + + //Add Pragmas + AvatarBDPragma pragma = new AvatarBDPragma(xpos, ypos, xpos, xpos * 2, ypos, ypos * 2, false, null, abd); + // String[] arr = new String[avspec.getPragmas().size()]; + String s = ""; + // int i=0; + for ( + AvatarPragma p : avspec.getPragmas()) + + { + + // arr[i] = p.getName(); + String t = ""; + String[] split = p.getName().split(" "); + if (p.getName().contains("#Confidentiality")) { + for (String str : split) { + if (str.contains(".")) { + String tmp = str.split("\\.")[0]; + String tmp2 = str.split("\\.")[1]; + t = t.concat(tmp.split("__")[tmp.split("__").length - 1] + "." + tmp2.split("__")[tmp2.split("__").length - 1] + " "); + } else { + t = t.concat(str + " "); + } + } + } else if (p.getName().contains("Authenticity")) { + t = p.getName(); + } else if (p.getName().contains("Initial")) { + t = p.getName(); + } else { + t = p.getName(); + } + s = s.concat(t + "\n"); + // i++; + } + pragma.setValue(s); + pragma.makeValue(); + abd.addComponent(pragma, xpos, ypos, false, true); + //Add message and key datatype if there is a cryptoblock + + xpos = 50; + ypos += 200; + if (hasCrypto) { + AvatarBDDataType message = new AvatarBDDataType(xpos, ypos, xpos, xpos * 2, ypos, ypos * 2, false, null, abd); + message.setValue("Message"); + + abd.addComponent(message, xpos, ypos, false, true); + message.resize(200, 100); + xpos += 400; + + AvatarBDDataType key = new AvatarBDDataType(xpos, ypos, xpos, xpos * 2, ypos, ypos * 2, false, null, abd); + key.setValue("Key"); + TAttribute attr = new TAttribute(2, "data", "0", 8); + message.addAttribute(attr); + key.addAttribute(attr); + key.resize(200, 100); + abd.addComponent(key, xpos, ypos, false, true); + } + + } + + public String getLastKeyword(String s) { + return s.split("__")[s.split("__").length - 1]; + } + + public void drawPanelOld(AvatarSpecification avspec, AvatarDesignPanel adp) { + // + + + // Check Errors in AVSPEC + TraceManager.addDev("Checking syntax of avatar spec."); + ArrayList<AvatarError> list = AvatarSyntaxChecker.checkSyntax(avspec); + for (AvatarError error : list) { + TraceManager.addDev("Error: " + error.toString()); + } + TraceManager.addDev("Check done. " + checkingErrors.size() + " errors found"); + + // Go for drawing! + + hasCrypto = false; Map<String, Set<String>> originDestMap = new HashMap<String, Set<String>>(); Map<String, AvatarBDBlock> blockMap = new HashMap<String, AvatarBDBlock>(); @@ -9254,7 +9493,17 @@ public class GTURTLEModeling { //Add Relations to connector for (AvatarRelation ar : avspec.getRelations()) { - if (ar.block1.getName().contains(bl1) && ar.block2.getName().contains(bl2) || ar.block1.getName().contains(bl2) && ar.block2.getName().contains(bl1)) { + + // Equal or endWith "__" + name + // One must be equal + // if (ar.block1.getName().equals(bl1) || ar.block1.getName().equals(bl2) || ar.block2.getName().equals(bl1) || ar.block1.getName + // ().equals(bl2)) { + + if (ar.block1.getName().endsWith(bl1) && ar.block2.getName().endsWith(bl2) || ar.block1.getName().endsWith(bl2) && ar + .block2.getName() + .endsWith(bl1)) { + TraceManager.addDev("Adding relations between " + bl1 + "/" + bl2 + " block1=" + ar.block1.getName() + " block2=" + ar + .block2.getName()); //TraceManager.addDev("Trying adding signal relations to connector"); //TGConnectingPoint p1= blockMap.get(bl1).getFreeTGConnectingPoint(blockMap.get(bl1).getX(), blockMap.get(bl1).getY()); @@ -9369,14 +9618,14 @@ public class GTURTLEModeling { //Remove the empty check states AvatarStartState start = asm.getStartState(); - + addStates(start, smx, smy, smp, bl, SMDMap, locMap, tranDestMap, tranSourceMap); //Add transitions for (AvatarTransition t : tranSourceMap.keySet()) { - if (tranSourceMap.get(t) == null || tranDestMap.get(t) == null || locMap.get(tranDestMap.get(t)) ==null) { + if (tranSourceMap.get(t) == null || tranDestMap.get(t) == null || locMap.get(tranDestMap.get(t)) == null) { continue; } - + int x = tranSourceMap.get(t).getX() + tranSourceMap.get(t).getWidth() / 2; int y = tranSourceMap.get(t).getY() + tranSourceMap.get(t).getHeight(); diff --git a/src/main/java/ui/avatarbd/AvatarBDBlock.java b/src/main/java/ui/avatarbd/AvatarBDBlock.java index 39881d5d2ea0bdd37361cd9981d9271fabed6bc7..0bc49d31e51a5fbbf2af93ed64b2f3525792b2e3 100644 --- a/src/main/java/ui/avatarbd/AvatarBDBlock.java +++ b/src/main/java/ui/avatarbd/AvatarBDBlock.java @@ -1607,7 +1607,7 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S if (as.getId().compareTo(_id) == 0) return as; } - TraceManager.addDev("Not found"); + TraceManager.addDev("Signal " + _id + " not found in block " + this.getBlockName()); return null; }