diff --git a/modeling/AVATAR/faulttreetest.xml b/modeling/AVATAR/faulttreetest.xml index 772d6cb7c27ee74bf218948a251fe7b75c69f7b5..49cce9753a6a78ec943900ed9263631d80c6602d 100644 --- a/modeling/AVATAR/faulttreetest.xml +++ b/modeling/AVATAR/faulttreetest.xml @@ -87,188 +87,233 @@ <Modeling type="FaultTree" nameTab="Fault Trees" > <FaultTreeDiagramPanel name="Fault Tree" minX="10" maxX="1600" minY="10" maxY="961" zoom="1.0000000000000016" > <CONNECTOR type="6001" id="52" > -<cdparam x="315" y="244" /> +<cdparam x="297" y="393" /> <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector" value="" /> <TGConnectingPoint num="0" id="51" /> -<P1 x="315" y="244" id="122" /> -<P2 x="232" y="174" id="87" /> +<P1 x="297" y="393" id="61" /> +<P2 x="315" y="292" id="152" /> <AutomaticDrawing data="true" /> </CONNECTOR> <CONNECTOR type="6001" id="54" > -<cdparam x="459" y="361" /> +<cdparam x="315" y="244" /> <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector" value="" /> <TGConnectingPoint num="0" id="53" /> -<P1 x="459" y="361" id="139" /> -<P2 x="352" y="292" id="133" /> +<P1 x="315" y="244" id="149" /> +<P2 x="232" y="174" id="114" /> <AutomaticDrawing data="true" /> </CONNECTOR> <CONNECTOR type="6001" id="56" > -<cdparam x="156" y="338" /> +<cdparam x="459" y="361" /> <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector" value="" /> <TGConnectingPoint num="0" id="55" /> -<P1 x="156" y="338" id="64" /> -<P2 x="278" y="292" id="132" /> +<P1 x="459" y="361" id="166" /> +<P2 x="352" y="292" id="160" /> <AutomaticDrawing data="true" /> </CONNECTOR> -<CONNECTOR type="6002" id="58" > -<cdparam x="449" y="182" /> +<CONNECTOR type="6001" id="58" > +<cdparam x="156" y="338" /> <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector" value="" /> <TGConnectingPoint num="0" id="57" /> -<P1 x="534" y="370" id="154" /> -<P2 x="580" y="401" id="110" /> +<P1 x="85" y="355" id="91" /> +<P2 x="278" y="292" id="159" /> +<AutomaticDrawing data="true" /> +</CONNECTOR> +<CONNECTOR type="6002" id="60" > +<cdparam x="449" y="182" /> +<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<infoparam name="connector" value="" /> +<TGConnectingPoint num="0" id="59" /> +<P1 x="534" y="370" id="181" /> +<P2 x="580" y="401" id="137" /> <AutomaticDrawing data="true" /> </CONNECTOR> -<COMPONENT type="6101" id="83" > -<cdparam x="81" y="338" /> +<COMPONENT type="6101" id="85" > +<cdparam x="247" y="393" /> +<sizeparam width="100" height="40" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<hidden value="false" /> +<enabled value="true" /> +<cdrectangleparam minX="10" maxX="1601" minY="10" maxY="962" /> +<infoparam name="TGComponent" value="fault01" /> +<TGConnectingPoint num="0" id="61" /> +<TGConnectingPoint num="1" id="62" /> +<TGConnectingPoint num="2" id="63" /> +<TGConnectingPoint num="3" id="64" /> +<TGConnectingPoint num="4" id="65" /> +<TGConnectingPoint num="5" id="66" /> +<TGConnectingPoint num="6" id="67" /> +<TGConnectingPoint num="7" id="68" /> +<TGConnectingPoint num="8" id="69" /> +<TGConnectingPoint num="9" id="70" /> +<TGConnectingPoint num="10" id="71" /> +<TGConnectingPoint num="11" id="72" /> +<TGConnectingPoint num="12" id="73" /> +<TGConnectingPoint num="13" id="74" /> +<TGConnectingPoint num="14" id="75" /> +<TGConnectingPoint num="15" id="76" /> +<TGConnectingPoint num="16" id="77" /> +<TGConnectingPoint num="17" id="78" /> +<TGConnectingPoint num="18" id="79" /> +<TGConnectingPoint num="19" id="80" /> +<TGConnectingPoint num="20" id="81" /> +<TGConnectingPoint num="21" id="82" /> +<TGConnectingPoint num="22" id="83" /> +<TGConnectingPoint num="23" id="84" /> +<extraparam> +<info description="blah blah blah" root="false" /> +</extraparam> +</COMPONENT> + +<COMPONENT type="6101" id="110" > +<cdparam x="10" y="355" /> <sizeparam width="100" height="40" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> <cdrectangleparam minX="10" maxX="1601" minY="10" maxY="962" /> <infoparam name="TGComponent" value="fault03" /> -<TGConnectingPoint num="0" id="59" /> -<TGConnectingPoint num="1" id="60" /> -<TGConnectingPoint num="2" id="61" /> -<TGConnectingPoint num="3" id="62" /> -<TGConnectingPoint num="4" id="63" /> -<TGConnectingPoint num="5" id="64" /> -<TGConnectingPoint num="6" id="65" /> -<TGConnectingPoint num="7" id="66" /> -<TGConnectingPoint num="8" id="67" /> -<TGConnectingPoint num="9" id="68" /> -<TGConnectingPoint num="10" id="69" /> -<TGConnectingPoint num="11" id="70" /> -<TGConnectingPoint num="12" id="71" /> -<TGConnectingPoint num="13" id="72" /> -<TGConnectingPoint num="14" id="73" /> -<TGConnectingPoint num="15" id="74" /> -<TGConnectingPoint num="16" id="75" /> -<TGConnectingPoint num="17" id="76" /> -<TGConnectingPoint num="18" id="77" /> -<TGConnectingPoint num="19" id="78" /> -<TGConnectingPoint num="20" id="79" /> -<TGConnectingPoint num="21" id="80" /> -<TGConnectingPoint num="22" id="81" /> -<TGConnectingPoint num="23" id="82" /> +<TGConnectingPoint num="0" id="86" /> +<TGConnectingPoint num="1" id="87" /> +<TGConnectingPoint num="2" id="88" /> +<TGConnectingPoint num="3" id="89" /> +<TGConnectingPoint num="4" id="90" /> +<TGConnectingPoint num="5" id="91" /> +<TGConnectingPoint num="6" id="92" /> +<TGConnectingPoint num="7" id="93" /> +<TGConnectingPoint num="8" id="94" /> +<TGConnectingPoint num="9" id="95" /> +<TGConnectingPoint num="10" id="96" /> +<TGConnectingPoint num="11" id="97" /> +<TGConnectingPoint num="12" id="98" /> +<TGConnectingPoint num="13" id="99" /> +<TGConnectingPoint num="14" id="100" /> +<TGConnectingPoint num="15" id="101" /> +<TGConnectingPoint num="16" id="102" /> +<TGConnectingPoint num="17" id="103" /> +<TGConnectingPoint num="18" id="104" /> +<TGConnectingPoint num="19" id="105" /> +<TGConnectingPoint num="20" id="106" /> +<TGConnectingPoint num="21" id="107" /> +<TGConnectingPoint num="22" id="108" /> +<TGConnectingPoint num="23" id="109" /> <extraparam> <info description="blah blah blah" root="false" /> </extraparam> </COMPONENT> -<COMPONENT type="6101" id="108" > +<COMPONENT type="6101" id="135" > <cdparam x="173" y="134" /> <sizeparam width="118" height="40" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> <cdrectangleparam minX="10" maxX="1601" minY="10" maxY="962" /> -<infoparam name="TGComponent" value="fault01" /> -<TGConnectingPoint num="0" id="84" /> -<TGConnectingPoint num="1" id="85" /> -<TGConnectingPoint num="2" id="86" /> -<TGConnectingPoint num="3" id="87" /> -<TGConnectingPoint num="4" id="88" /> -<TGConnectingPoint num="5" id="89" /> -<TGConnectingPoint num="6" id="90" /> -<TGConnectingPoint num="7" id="91" /> -<TGConnectingPoint num="8" id="92" /> -<TGConnectingPoint num="9" id="93" /> -<TGConnectingPoint num="10" id="94" /> -<TGConnectingPoint num="11" id="95" /> -<TGConnectingPoint num="12" id="96" /> -<TGConnectingPoint num="13" id="97" /> -<TGConnectingPoint num="14" id="98" /> -<TGConnectingPoint num="15" id="99" /> -<TGConnectingPoint num="16" id="100" /> -<TGConnectingPoint num="17" id="101" /> -<TGConnectingPoint num="18" id="102" /> -<TGConnectingPoint num="19" id="103" /> -<TGConnectingPoint num="20" id="104" /> -<TGConnectingPoint num="21" id="105" /> -<TGConnectingPoint num="22" id="106" /> -<TGConnectingPoint num="23" id="107" /> +<infoparam name="TGComponent" value="faultmain" /> +<TGConnectingPoint num="0" id="111" /> +<TGConnectingPoint num="1" id="112" /> +<TGConnectingPoint num="2" id="113" /> +<TGConnectingPoint num="3" id="114" /> +<TGConnectingPoint num="4" id="115" /> +<TGConnectingPoint num="5" id="116" /> +<TGConnectingPoint num="6" id="117" /> +<TGConnectingPoint num="7" id="118" /> +<TGConnectingPoint num="8" id="119" /> +<TGConnectingPoint num="9" id="120" /> +<TGConnectingPoint num="10" id="121" /> +<TGConnectingPoint num="11" id="122" /> +<TGConnectingPoint num="12" id="123" /> +<TGConnectingPoint num="13" id="124" /> +<TGConnectingPoint num="14" id="125" /> +<TGConnectingPoint num="15" id="126" /> +<TGConnectingPoint num="16" id="127" /> +<TGConnectingPoint num="17" id="128" /> +<TGConnectingPoint num="18" id="129" /> +<TGConnectingPoint num="19" id="130" /> +<TGConnectingPoint num="20" id="131" /> +<TGConnectingPoint num="21" id="132" /> +<TGConnectingPoint num="22" id="133" /> +<TGConnectingPoint num="23" id="134" /> <accessibility /> <extraparam> <info description="blah blah blah" root="true" /> </extraparam> </COMPONENT> -<COMPONENT type="6103" id="121" > +<COMPONENT type="6103" id="148" > <cdparam x="592" y="382" /> <sizeparam width="164" height="39" minWidth="78" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="1601" minY="10" maxY="962" /> <infoparam name="TGComponent" value="counter01" /> -<TGConnectingPoint num="0" id="109" /> -<TGConnectingPoint num="1" id="110" /> -<TGConnectingPoint num="2" id="111" /> -<TGConnectingPoint num="3" id="112" /> -<TGConnectingPoint num="4" id="113" /> -<TGConnectingPoint num="5" id="114" /> -<TGConnectingPoint num="6" id="115" /> -<TGConnectingPoint num="7" id="116" /> -<TGConnectingPoint num="8" id="117" /> -<TGConnectingPoint num="9" id="118" /> -<TGConnectingPoint num="10" id="119" /> -<TGConnectingPoint num="11" id="120" /> +<TGConnectingPoint num="0" id="136" /> +<TGConnectingPoint num="1" id="137" /> +<TGConnectingPoint num="2" id="138" /> +<TGConnectingPoint num="3" id="139" /> +<TGConnectingPoint num="4" id="140" /> +<TGConnectingPoint num="5" id="141" /> +<TGConnectingPoint num="6" id="142" /> +<TGConnectingPoint num="7" id="143" /> +<TGConnectingPoint num="8" id="144" /> +<TGConnectingPoint num="9" id="145" /> +<TGConnectingPoint num="10" id="146" /> +<TGConnectingPoint num="11" id="147" /> </COMPONENT> -<COMPONENT type="6102" id="134" > +<COMPONENT type="6102" id="161" > <cdparam x="241" y="244" /> <sizeparam width="148" height="48" minWidth="99" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="1601" minY="10" maxY="962" /> -<infoparam name="TGComponent" value="<<XOR>>" /> -<TGConnectingPoint num="0" id="122" /> -<TGConnectingPoint num="1" id="123" /> -<TGConnectingPoint num="2" id="124" /> -<TGConnectingPoint num="3" id="125" /> -<TGConnectingPoint num="4" id="126" /> -<TGConnectingPoint num="5" id="127" /> -<TGConnectingPoint num="6" id="128" /> -<TGConnectingPoint num="7" id="129" /> -<TGConnectingPoint num="8" id="130" /> -<TGConnectingPoint num="9" id="131" /> -<TGConnectingPoint num="10" id="132" /> -<TGConnectingPoint num="11" id="133" /> +<infoparam name="TGComponent" value="<<VOTE>>" /> +<TGConnectingPoint num="0" id="149" /> +<TGConnectingPoint num="1" id="150" /> +<TGConnectingPoint num="2" id="151" /> +<TGConnectingPoint num="3" id="152" /> +<TGConnectingPoint num="4" id="153" /> +<TGConnectingPoint num="5" id="154" /> +<TGConnectingPoint num="6" id="155" /> +<TGConnectingPoint num="7" id="156" /> +<TGConnectingPoint num="8" id="157" /> +<TGConnectingPoint num="9" id="158" /> +<TGConnectingPoint num="10" id="159" /> +<TGConnectingPoint num="11" id="160" /> <extraparam> -<info equation="" index="1" /> +<info equation="" index="7" /> </extraparam> </COMPONENT> -<COMPONENT type="6101" id="159" > +<COMPONENT type="6101" id="186" > <cdparam x="435" y="361" /> <sizeparam width="99" height="39" minWidth="99" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> <cdrectangleparam minX="10" maxX="1601" minY="10" maxY="962" /> <infoparam name="TGComponent" value="fault02" /> -<TGConnectingPoint num="0" id="135" /> -<TGConnectingPoint num="1" id="136" /> -<TGConnectingPoint num="2" id="137" /> -<TGConnectingPoint num="3" id="138" /> -<TGConnectingPoint num="4" id="139" /> -<TGConnectingPoint num="5" id="140" /> -<TGConnectingPoint num="6" id="141" /> -<TGConnectingPoint num="7" id="142" /> -<TGConnectingPoint num="8" id="143" /> -<TGConnectingPoint num="9" id="144" /> -<TGConnectingPoint num="10" id="145" /> -<TGConnectingPoint num="11" id="146" /> -<TGConnectingPoint num="12" id="147" /> -<TGConnectingPoint num="13" id="148" /> -<TGConnectingPoint num="14" id="149" /> -<TGConnectingPoint num="15" id="150" /> -<TGConnectingPoint num="16" id="151" /> -<TGConnectingPoint num="17" id="152" /> -<TGConnectingPoint num="18" id="153" /> -<TGConnectingPoint num="19" id="154" /> -<TGConnectingPoint num="20" id="155" /> -<TGConnectingPoint num="21" id="156" /> -<TGConnectingPoint num="22" id="157" /> -<TGConnectingPoint num="23" id="158" /> +<TGConnectingPoint num="0" id="162" /> +<TGConnectingPoint num="1" id="163" /> +<TGConnectingPoint num="2" id="164" /> +<TGConnectingPoint num="3" id="165" /> +<TGConnectingPoint num="4" id="166" /> +<TGConnectingPoint num="5" id="167" /> +<TGConnectingPoint num="6" id="168" /> +<TGConnectingPoint num="7" id="169" /> +<TGConnectingPoint num="8" id="170" /> +<TGConnectingPoint num="9" id="171" /> +<TGConnectingPoint num="10" id="172" /> +<TGConnectingPoint num="11" id="173" /> +<TGConnectingPoint num="12" id="174" /> +<TGConnectingPoint num="13" id="175" /> +<TGConnectingPoint num="14" id="176" /> +<TGConnectingPoint num="15" id="177" /> +<TGConnectingPoint num="16" id="178" /> +<TGConnectingPoint num="17" id="179" /> +<TGConnectingPoint num="18" id="180" /> +<TGConnectingPoint num="19" id="181" /> +<TGConnectingPoint num="20" id="182" /> +<TGConnectingPoint num="21" id="183" /> +<TGConnectingPoint num="22" id="184" /> +<TGConnectingPoint num="23" id="185" /> <accessibility /> <extraparam> <info description="blah blah blah" root="false" /> diff --git a/src/main/java/faulttrees/NOTNode.java b/src/main/java/faulttrees/NOTNode.java new file mode 100755 index 0000000000000000000000000000000000000000..1e41d30317475485b67970dfda73d6b549968cb5 --- /dev/null +++ b/src/main/java/faulttrees/NOTNode.java @@ -0,0 +1,57 @@ +/* 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 faulttrees; + +/** + * Class NOTNode + * Creation: 31/01/2018 + * @version 1.0 31/01/2018 + * @author Ludovic APVRILLE + */ +public class NOTNode extends BooleanNode { + + public NOTNode(String _name, Object _referenceObject) { + super(_name, _referenceObject); + type = "NOT"; + } + +} diff --git a/src/main/java/faulttrees/VoteNode.java b/src/main/java/faulttrees/VoteNode.java new file mode 100755 index 0000000000000000000000000000000000000000..6ce63afc5c3fbf117331a880638966aa7f3cc03e --- /dev/null +++ b/src/main/java/faulttrees/VoteNode.java @@ -0,0 +1,57 @@ +/* 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 faulttrees; + +/** + * Class VoteNode + * Creation: 31/01/2018 + * @version 1.0 31/01/2018 + * @author Ludovic APVRILLE + */ +public class VoteNode extends FaultNode { + + public VoteNode(String _name, Object _referenceObject) { + super(_name, _referenceObject); + type = "VOTE"; + } + +} diff --git a/src/main/java/ui/FaultTreePanelTranslator.java b/src/main/java/ui/FaultTreePanelTranslator.java index 8c9aa24f4923ebb3600f0c74c61a3efada6b2f21..4f99da713c44466608747a5b06b4946980ba121d 100644 --- a/src/main/java/ui/FaultTreePanelTranslator.java +++ b/src/main/java/ui/FaultTreePanelTranslator.java @@ -39,8 +39,8 @@ package ui; -import faulttrees.*; import avatartranslator.*; +import faulttrees.*; import translator.CheckingError; import ui.ftd.*; @@ -156,6 +156,11 @@ public class FaultTreePanelTranslator { at.addNode(xornode); listE.addCor(xornode, comp); + } else if (cons.isNOT()) { + NOTNode notnode = new NOTNode("NOT__" + nodeID, cons); + at.addNode(notnode); + listE.addCor(notnode, comp); + //SEQUENCE } else if (cons.isSequence()) { SequenceNode seqnode = new SequenceNode("SEQUENCE__" + nodeID, cons); @@ -194,6 +199,11 @@ public class FaultTreePanelTranslator { addCheckingError(ce); } + } else if (cons.isVote()) { + VoteNode voteNode = new VoteNode("VOTE__" + nodeID, cons); + at.addNode(voteNode); + listE.addCor(voteNode, comp); + } else { UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Invalid Fault node"); ce.setTGComponent(comp); @@ -504,6 +514,7 @@ public class FaultTreePanelTranslator { if (_ref1 instanceof FTDFault) { activatedState.setAsVerifiable(true); } + AvatarState performedState = new AvatarState("performed", _ref, false, false); AvatarState mainStop = new AvatarState("stop", _ref, false, false); AvatarState stopBeforeActivate = new AvatarState("stopBeforeActivate", _ref, false, false); @@ -695,6 +706,8 @@ public class FaultTreePanelTranslator { makeAfterNode(_as, _main, ab, (AfterNode) node, listE.getTG(node)); } else if (node instanceof BeforeNode) { makeBeforeNode(_as, _main, ab, (BeforeNode) node, listE.getTG(node)); + } else if (node instanceof VoteNode) { + makeVoteNode(_as, _main, ab, (VoteNode) node, listE.getTG(node)); } } } @@ -770,6 +783,84 @@ public class FaultTreePanelTranslator { at.addNext(overallState); } + private void makeVoteNode(AvatarSpecification _as, AvatarBlock _main, AvatarBlock _ab, VoteNode _node, Object _ref) { + Object _ref1 = _ref; + _ref = null; + AvatarStateMachine asm = _ab.getStateMachine(); + + // Basic machine + AvatarStartState start = new AvatarStartState("start", _ref); + AvatarState mainState = new AvatarState("main", _ref, false, false); + AvatarState endState = new AvatarState("end", _ref, false, false); + AvatarState overallState = new AvatarState("overall", _ref, false, false); + asm.addElement(start); + asm.setStartState(start); + asm.addElement(mainState); + asm.addElement(endState); + asm.addElement(overallState); + AvatarTransition atF = new AvatarTransition(_ab, "at1", _ref); + asm.addElement(atF); + start.addNext(atF); + atF.addNext(mainState); + atF.setHidden(true); + String finalGuard = ""; + + AvatarAttribute aCount = new AvatarAttribute("__nbOfPerformed", AvatarType.INTEGER, _ab, _ref); + _ab.addAttribute(aCount); + + double nbOfVoters = _node.getInputFaults().size() / 2.0; + int thres = (int) (Math.ceil(nbOfVoters)); + finalGuard = "( __nbOfPerformed >= " + thres + ")"; + for (Fault att : _node.getInputFaults()) { + AvatarAttribute aa = new AvatarAttribute(att.getName() + "__performed", AvatarType.BOOLEAN, _ab, _ref); + + /*if (finalGuard.length() == 0) { + finalGuard += "(" + att.getName() + "__performed == true)"; + } else { + finalGuard += " && (" + att.getName() + "__performed == true)"; + }*/ + _ab.addAttribute(aa); + atF.addAction(att.getName() + "__performed = false"); + + + avatartranslator.AvatarSignal sigAtt = _main.getAvatarSignalWithName("accept__" + att.getName()); + AvatarActionOnSignal acceptFault = new AvatarActionOnSignal("AcceptFault", sigAtt, _ref1); + asm.addElement(acceptFault); + AvatarTransition at = new AvatarTransition(_ab, "at_toInputFault", _ref); + asm.addElement(at); + mainState.addNext(at); + at.addNext(acceptFault); + at.setGuard(new AvatarSimpleGuardDuo(aa, AvatarConstant.FALSE, "==")); + at = new AvatarTransition(_ab, "at_fromInputFault", _ref); + at.addAction(att.getName() + "__performed = true"); + at.addAction(aCount.getName() + " = " + aCount.getName() + " + 1" ); + asm.addElement(at); + acceptFault.addNext(at); + at.addNext(mainState); + at.setHidden(true); + } + + // Adding resulting Fault + AvatarTransition at = new AvatarTransition(_ab, "at_toEnd", _ref); + asm.addElement(at); + mainState.addNext(at); + at.addNext(endState); + at.setGuard("[" + finalGuard + "]"); + + Fault resulting = _node.getResultingFault(); + avatartranslator.AvatarSignal sigFault = _main.getAvatarSignalWithName("nodeDone__" + resulting.getName()); + AvatarActionOnSignal resultingFault = new AvatarActionOnSignal("ResultingFault", sigFault, _ref1); + asm.addElement(resultingFault); + at = new AvatarTransition(_ab, "at_toResultingFault", _ref); + asm.addElement(at); + endState.addNext(at); + at.addNext(resultingFault); + at = new AvatarTransition(_ab, "at_Overall", _ref); + asm.addElement(at); + resultingFault.addNext(at); + at.addNext(overallState); + } + private void makeORNode(AvatarSpecification _as, AvatarBlock _main, AvatarBlock _ab, ORNode _node, Object _ref) { Object _ref1 = _ref; diff --git a/src/main/java/ui/ftd/FTDConstraint.java b/src/main/java/ui/ftd/FTDConstraint.java index cf5e948679a888f782a1a6ef2102d483219226dd..33161268624f8d2e9c507147ba9ae567826d7743 100644 --- a/src/main/java/ui/ftd/FTDConstraint.java +++ b/src/main/java/ui/ftd/FTDConstraint.java @@ -49,7 +49,8 @@ import ui.window.JDialogConstraintText; import javax.swing.*; import java.awt.*; -import myutil.*;; + +; /** * Class FTDConstraint @@ -258,18 +259,26 @@ public class FTDConstraint extends TGCScalableWithInternalComponent implements S return (value.compareTo(STEREOTYPES[2]) == 0); } - public boolean isSequence() { + public boolean isNOT() { return (value.compareTo(STEREOTYPES[3]) == 0); } - public boolean isBefore() { + public boolean isSequence() { return (value.compareTo(STEREOTYPES[4]) == 0); } - public boolean isAfter() { + public boolean isBefore() { return (value.compareTo(STEREOTYPES[5]) == 0); } + public boolean isAfter() { + return (value.compareTo(STEREOTYPES[6]) == 0); + } + + public boolean isVote() { + return (value.compareTo(STEREOTYPES[7]) == 0); + } + protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<info equation=\"" + GTURTLEModeling.transformString(getEquation()));