From 8d2a6080fd1f9e2d1d0a2be552f24fa4f90967dd Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Wed, 11 Jan 2017 18:26:21 +0100
Subject: [PATCH] Adding minimization alfos debugged

---
 Makefile                                 |   12 +-
 modeling/AVATAR/CoffeeMachine_Avatar.xml | 1048 ++++++++++----------
 src/graphminimize.txt                    |    2 +
 src/ui/graph/AUTGraph.java               | 1118 +++++++++++-----------
 src/ui/graph/AUTState.java               |    3 +-
 src/ui/window/JFrameMinimize.java        |   42 +-
 6 files changed, 1153 insertions(+), 1072 deletions(-)
 create mode 100755 src/graphminimize.txt

diff --git a/Makefile b/Makefile
index 0f11c36186..34cb8f9c67 100755
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ BUILD_TO_MODIFY = src/ui/DefaultText.java
 TTOOL_BINARY = ttool.jar
 LAUNCHER_BINARY = launcher.jar
 GRAPHSHOW_BINARY = graphshow.jar
+GRAPHMINIMIZE_BINARY = graphminimize.jar
 TIFTRANSLATOR_BINARY = tiftranslator.jar
 TMLTRANSLATOR_BINARY = tmltranslator.jar
 GSCORE_BINARY = gs-core-1.3.jar
@@ -36,6 +37,7 @@ RUNDSE_JAR_TXT  = rundse.txt
 TTOOL_JAR_TXT = ttool.txt
 LAUNCHER_JAR_TXT = launcher.txt
 GRAPHSHOW_JAR_TXT = graphshow.txt
+GRAPHMINIMIZE_JAR_TXT = graphminimize.txt
 TIFTRANSLATOR_JAR_TXT = tiftranslator.txt
 TMLTRANSLATOR_JAR_TXT = tmltranslator.txt
 WEBCRAWLER_SERVER_JAR_TXT = webcrawler.txt
@@ -98,7 +100,7 @@ RELEASE_STD_FILES_WINDIWS_EXE = ttool_windows.bat
 
 RELEASE_STD_FILES_XML = TURTLE/manual-HW.xml AVATAR/DrinkMachineV10.xml TURTLE/WebV01.xml TURTLE/Protocol_example1.xml TURTLE/BasicExchange.xml DIPLODOCUS/SmartCardProtocol.xml TURTLE/ProtocolPatterns.xml CTTool/COCOME_V50.xml AVATAR/CoffeeMachine_Avatar.xml AVATAR/Network_Avatar.xml AVATAR/MicroWaveOven_SafetySecurity_fullMethodo.xml
 RELEASE_STD_FILES_LIB =  TURTLE/TClock1.lib TURTLE/TTimerv01.lib
-RELEASE_STD_FILES_BIN = $(LAUNCHER_BINARY) $(TTOOL_BINARY) $(TIFTRANSLATOR_BINARY) $(TMLTRANSLATOR_BINARY) $(REMOTESIMULATOR_BINARY) $(RUNDSE_BINARY) $(WEBCRAWLER_SERVER_BINARY) $(WEBCRAWLER_CLIENT_BINARY) $(GRAPHSHOW_BINARY)
+RELEASE_STD_FILES_BIN = $(LAUNCHER_BINARY) $(TTOOL_BINARY) $(TIFTRANSLATOR_BINARY) $(TMLTRANSLATOR_BINARY) $(REMOTESIMULATOR_BINARY) $(RUNDSE_BINARY) $(WEBCRAWLER_SERVER_BINARY) $(WEBCRAWLER_CLIENT_BINARY) $(GRAPHSHOW_BINARY) $(GRAPHMINIMIZE_BINARY)
 RELEASE_STD_FILES_LICENSES = LICENSE LICENSE_CECILL_ENG LICENSE_CECILL_FR
 
 TEST_DIR        = $(TTOOL_PATH)/tests
@@ -165,7 +167,7 @@ basic:
 
 jarttool:  launcher ttooljar
 
-jar: launcher ttooljar tiftranslator tmltranslator rundse remotesimulator webcrawler graphshow
+jar: launcher ttooljar tiftranslator tmltranslator rundse remotesimulator webcrawler graphshow graphminimize
 
 ttooljar:
 	rm -f $(TTOOL_BIN)/$(TTOOL_BINARY)
@@ -176,8 +178,12 @@ launcher:
 	rm -f $(TTOOL_BIN)/$(LAUNCHER_BINARY)
 	cd $(TTOOL_SRC);$(JAR) cmf $(LAUNCHER_JAR_TXT) $(TTOOL_BIN)/$(LAUNCHER_BINARY)  RTLLauncher.class launcher/*.class myutil/*.class
 
+graphminimize:
+	rm -f $(TTOOL_BIN)/$(GRAPHMINIMIZE_BINARY)
+	cd $(TTOOL_SRC);$(JAR) cmf $(GRAPHMINIMIZE_JAR_TXT) $(TTOOL_BIN)/$(GRAPHMINIMIZE_BINARY)  GraphMinimize.class myutil/*.class ui/graph/*.class
+
 graphshow:
-	rm -f $(TTOOL_BIN)/$(TIFTRANSLATOR_BINARY)
+	rm -f $(TTOOL_BIN)/$(GRAPHSHOW_BINARY)
 	cd $(TTOOL_SRC);$(JAR) cmf $(GRAPHSHOW_JAR_TXT) $(TTOOL_BIN)/$(GRAPHSHOW_BINARY)  GraphShow.class myutil/*.class ui/graph/*.class ui/IconManager.class ui/file/PNGFilter.class
 
 tiftranslator:
diff --git a/modeling/AVATAR/CoffeeMachine_Avatar.xml b/modeling/AVATAR/CoffeeMachine_Avatar.xml
index adc157a422..03acf3e5a9 100644
--- a/modeling/AVATAR/CoffeeMachine_Avatar.xml
+++ b/modeling/AVATAR/CoffeeMachine_Avatar.xml
@@ -578,7 +578,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from TGComponent to TGComponent" value="" />
 <TGConnectingPoint num="0" id="337" />
-<P1  x="313" y="261" id="368" />
+<P1  x="313" y="261" id="381" />
 <P2  x="361" y="261" id="356" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR>
@@ -596,7 +596,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from TGComponent to TGComponent" value="" />
 <TGConnectingPoint num="0" id="341" />
-<P1  x="309" y="211" id="381" />
+<P1  x="309" y="211" id="368" />
 <P2  x="361" y="211" id="355" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR>
@@ -685,11 +685,11 @@
 </COMPONENT>
 <SUBCOMPONENT type="5304" id="378" >
 <father id="416" num="0" />
-<cdparam x="165" y="241" />
-<sizeparam width="148" height="40" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="170" y="191" />
+<sizeparam width="139" height="40" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="20" minY="0" maxY="114" />
-<infoparam name="TGComponent" value="WaitingForFirstCoin_enter" />
+<cdrectangleparam minX="0" maxX="29" minY="0" maxY="114" />
+<infoparam name="TGComponent" value="WaitingForFirstCoin_exit" />
 <TGConnectingPoint num="0" id="366" />
 <TGConnectingPoint num="1" id="367" />
 <TGConnectingPoint num="2" id="368" />
@@ -705,11 +705,11 @@
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5304" id="391" >
 <father id="416" num="1" />
-<cdparam x="170" y="191" />
-<sizeparam width="139" height="40" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="165" y="241" />
+<sizeparam width="148" height="40" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="29" minY="0" maxY="114" />
-<infoparam name="TGComponent" value="WaitingForFirstCoin_exit" />
+<cdrectangleparam minX="0" maxX="20" minY="0" maxY="114" />
+<infoparam name="TGComponent" value="WaitingForFirstCoin_enter" />
 <TGConnectingPoint num="0" id="379" />
 <TGConnectingPoint num="1" id="380" />
 <TGConnectingPoint num="2" id="381" />
@@ -839,7 +839,7 @@
 <TGConnectingPoint num="0" id="475" />
 <TGConnectingPoint num="1" id="476" />
 <TGConnectingPoint num="2" id="477" />
-<P1  x="581" y="154" id="564" />
+<P1  x="581" y="154" id="551" />
 <P2  x="546" y="305" id="621" />
 <Point x="518" y="154" />
 <Point x="518" y="305" />
@@ -867,7 +867,7 @@
 <infoparam name="connector from TGComponent to TGComponent" value="" />
 <TGConnectingPoint num="0" id="480" />
 <TGConnectingPoint num="1" id="481" />
-<P1  x="631" y="164" id="559" />
+<P1  x="631" y="164" id="546" />
 <P2  x="667" y="310" id="608" />
 <Point x="631" y="310" />
 <AutomaticDrawing  data="true" />
@@ -895,7 +895,7 @@
 <infoparam name="connector from TGComponent to TGComponent" value="" />
 <TGConnectingPoint num="0" id="486" />
 <TGConnectingPoint num="1" id="487" />
-<P1  x="721" y="158" id="544" />
+<P1  x="721" y="158" id="557" />
 <P2  x="700" y="204" id="598" />
 <Point x="700" y="158" />
 <AutomaticDrawing  data="true" />
@@ -1050,13 +1050,13 @@
 <TGConnectingPoint num="22" id="591" />
 <TGConnectingPoint num="23" id="592" />
 </COMPONENT>
-<SUBCOMPONENT type="5303" id="555" >
+<SUBCOMPONENT type="5304" id="555" >
 <father id="593" num="0" />
-<cdparam x="721" y="133" />
-<sizeparam width="100" height="50" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="581" y="125" />
+<sizeparam width="100" height="39" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="168" minY="0" maxY="65" />
-<infoparam name="TGComponent" value="nbOfCoins" />
+<cdrectangleparam minX="0" maxX="168" minY="0" maxY="76" />
+<infoparam name="TGComponent" value="Start" />
 <TGConnectingPoint num="0" id="543" />
 <TGConnectingPoint num="1" id="544" />
 <TGConnectingPoint num="2" id="545" />
@@ -1069,17 +1069,14 @@
 <TGConnectingPoint num="9" id="552" />
 <TGConnectingPoint num="10" id="553" />
 <TGConnectingPoint num="11" id="554" />
-<extraparam>
-<Toggle value="" />
-</extraparam>
 </SUBCOMPONENT>
-<SUBCOMPONENT type="5304" id="568" >
+<SUBCOMPONENT type="5303" id="568" >
 <father id="593" num="1" />
-<cdparam x="581" y="125" />
-<sizeparam width="100" height="39" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="721" y="133" />
+<sizeparam width="100" height="50" minWidth="100" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="168" minY="0" maxY="76" />
-<infoparam name="TGComponent" value="Start" />
+<cdrectangleparam minX="0" maxX="168" minY="0" maxY="65" />
+<infoparam name="TGComponent" value="nbOfCoins" />
 <TGConnectingPoint num="0" id="556" />
 <TGConnectingPoint num="1" id="557" />
 <TGConnectingPoint num="2" id="558" />
@@ -1092,6 +1089,9 @@
 <TGConnectingPoint num="9" id="565" />
 <TGConnectingPoint num="10" id="566" />
 <TGConnectingPoint num="11" id="567" />
+<extraparam>
+<Toggle value="" />
+</extraparam>
 </SUBCOMPONENT>
 
 <COMPONENT type="5306" id="605" >
@@ -1221,7 +1221,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from Block1 to Block0" value="" />
 <TGConnectingPoint num="0" id="658" />
-<P1  x="559" y="330" id="695" />
+<P1  x="559" y="330" id="720" />
 <P2  x="560" y="377" id="753" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -1251,7 +1251,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from Block1 to Block0" value="" />
 <TGConnectingPoint num="0" id="662" />
-<P1  x="789" y="326" id="720" />
+<P1  x="789" y="326" id="695" />
 <P2  x="790" y="377" id="754" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -1350,11 +1350,11 @@
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="713" >
 <father id="763" num="0" />
-<cdparam x="464" y="228" />
-<sizeparam width="190" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="695" y="224" />
+<sizeparam width="189" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="271" minY="0" maxY="256" />
-<infoparam name="Block1" value="CoffeeButton" />
+<cdrectangleparam minX="0" maxX="272" minY="0" maxY="256" />
+<infoparam name="Block1" value="TeaButton" />
 <TGConnectingPoint num="0" id="689" />
 <TGConnectingPoint num="1" id="690" />
 <TGConnectingPoint num="2" id="691" />
@@ -1381,17 +1381,17 @@
 <TGConnectingPoint num="23" id="712" />
 <extraparam>
 <CryptoBlock value="false" />
-<Attribute access="0" id="mechanicalDelay" value="80" type="8" typeOther="" />
+<Attribute access="0" id="mechanicalDelay" value="10" type="8" typeOther="" />
 <Signal value="out push()" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="738" >
 <father id="763" num="1" />
-<cdparam x="695" y="224" />
-<sizeparam width="189" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="464" y="228" />
+<sizeparam width="190" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="272" minY="0" maxY="256" />
-<infoparam name="Block1" value="TeaButton" />
+<cdrectangleparam minX="0" maxX="271" minY="0" maxY="256" />
+<infoparam name="Block1" value="CoffeeButton" />
 <TGConnectingPoint num="0" id="714" />
 <TGConnectingPoint num="1" id="715" />
 <TGConnectingPoint num="2" id="716" />
@@ -1418,7 +1418,7 @@
 <TGConnectingPoint num="23" id="737" />
 <extraparam>
 <CryptoBlock value="false" />
-<Attribute access="0" id="mechanicalDelay" value="10" type="8" typeOther="" />
+<Attribute access="0" id="mechanicalDelay" value="80" type="8" typeOther="" />
 <Signal value="out push()" />
 </extraparam>
 </SUBCOMPONENT>
@@ -1804,7 +1804,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from Send signal to stop state" value="null" />
 <TGConnectingPoint num="0" id="958" />
-<P1  x="437" y="525" id="1357" />
+<P1  x="437" y="525" id="1292" />
 <P2  x="323" y="748" id="1218" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="957" >
@@ -1833,8 +1833,8 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from state0 to Send signal" value="null" />
 <TGConnectingPoint num="0" id="965" />
-<P1  x="321" y="455" id="1306" />
-<P2  x="437" y="495" id="1356" />
+<P1  x="321" y="455" id="1319" />
+<P2  x="437" y="495" id="1291" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="964" >
 <father id="966" num="0" />
@@ -1861,7 +1861,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from Send signal to stop state" value="null" />
 <TGConnectingPoint num="0" id="972" />
-<P1  x="293" y="552" id="1292" />
+<P1  x="293" y="552" id="1357" />
 <P2  x="289" y="748" id="1210" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="971" >
@@ -1891,8 +1891,8 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from state0 to Send signal" value="null" />
 <TGConnectingPoint num="0" id="979" />
-<P1  x="288" y="475" id="1317" />
-<P2  x="293" y="522" id="1291" />
+<P1  x="288" y="475" id="1330" />
+<P2  x="293" y="522" id="1356" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="978" >
 <father id="980" num="0" />
@@ -1919,7 +1919,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from Send signal to stop state" value="null" />
 <TGConnectingPoint num="0" id="986" />
-<P1  x="121" y="552" id="1346" />
+<P1  x="121" y="552" id="1303" />
 <P2  x="255" y="748" id="1217" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="985" >
@@ -1949,8 +1949,8 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from state0 to Send signal" value="null" />
 <TGConnectingPoint num="0" id="993" />
-<P1  x="222" y="475" id="1316" />
-<P2  x="121" y="522" id="1345" />
+<P1  x="222" y="475" id="1329" />
+<P2  x="121" y="522" id="1302" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="992" >
 <father id="994" num="0" />
@@ -1977,8 +1977,8 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from start state to state0" value="null" />
 <TGConnectingPoint num="0" id="1000" />
-<P1  x="256" y="419" id="1343" />
-<P2  x="255" y="435" id="1303" />
+<P1  x="256" y="419" id="1313" />
+<P2  x="255" y="435" id="1316" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="999" >
 <father id="1001" num="0" />
@@ -2561,13 +2561,13 @@
 <extraparam>
 </extraparam>
 </COMPONENT>
-<SUBCOMPONENT type="5104" id="1301" >
+<SUBCOMPONENT type="5103" id="1301" >
 <father id="1407" num="0" />
-<cdparam x="231" y="527" />
-<sizeparam width="124" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="367" y="500" />
+<sizeparam width="141" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="465" minY="0" maxY="334" />
-<infoparam name="Send signal" value="pushTeaButton()" />
+<cdrectangleparam minX="0" maxX="447" minY="0" maxY="334" />
+<infoparam name="Send signal" value="ejectCoin(nbOfCoins)" />
 <TGConnectingPoint num="0" id="1291" />
 <TGConnectingPoint num="1" id="1292" />
 <TGConnectingPoint num="2" id="1293" />
@@ -2580,13 +2580,13 @@
 <TGConnectingPoint num="9" id="1300" />
 <accessibility />
 </SUBCOMPONENT>
-<SUBCOMPONENT type="5106" id="1342" >
+<SUBCOMPONENT type="5104" id="1312" >
 <father id="1407" num="1" />
-<cdparam x="189" y="435" />
-<sizeparam width="132" height="40" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="51" y="527" />
+<sizeparam width="141" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="445" minY="0" maxY="314" />
-<infoparam name="state0" value="WaitingForSelection" />
+<cdrectangleparam minX="0" maxX="450" minY="0" maxY="334" />
+<infoparam name="Send signal" value="pushCoffeeButton()" />
 <TGConnectingPoint num="0" id="1302" />
 <TGConnectingPoint num="1" id="1303" />
 <TGConnectingPoint num="2" id="1304" />
@@ -2597,74 +2597,74 @@
 <TGConnectingPoint num="7" id="1309" />
 <TGConnectingPoint num="8" id="1310" />
 <TGConnectingPoint num="9" id="1311" />
-<TGConnectingPoint num="10" id="1312" />
-<TGConnectingPoint num="11" id="1313" />
-<TGConnectingPoint num="12" id="1314" />
-<TGConnectingPoint num="13" id="1315" />
-<TGConnectingPoint num="14" id="1316" />
-<TGConnectingPoint num="15" id="1317" />
-<TGConnectingPoint num="16" id="1318" />
-<TGConnectingPoint num="17" id="1319" />
-<TGConnectingPoint num="18" id="1320" />
-<TGConnectingPoint num="19" id="1321" />
-<TGConnectingPoint num="20" id="1322" />
-<TGConnectingPoint num="21" id="1323" />
-<TGConnectingPoint num="22" id="1324" />
-<TGConnectingPoint num="23" id="1325" />
-<TGConnectingPoint num="24" id="1326" />
-<TGConnectingPoint num="25" id="1327" />
-<TGConnectingPoint num="26" id="1328" />
-<TGConnectingPoint num="27" id="1329" />
-<TGConnectingPoint num="28" id="1330" />
-<TGConnectingPoint num="29" id="1331" />
-<TGConnectingPoint num="30" id="1332" />
-<TGConnectingPoint num="31" id="1333" />
-<TGConnectingPoint num="32" id="1334" />
-<TGConnectingPoint num="33" id="1335" />
-<TGConnectingPoint num="34" id="1336" />
-<TGConnectingPoint num="35" id="1337" />
-<TGConnectingPoint num="36" id="1338" />
-<TGConnectingPoint num="37" id="1339" />
-<TGConnectingPoint num="38" id="1340" />
-<TGConnectingPoint num="39" id="1341" />
-<extraparam>
-</extraparam>
+<accessibility />
 </SUBCOMPONENT>
-<SUBCOMPONENT type="5100" id="1344" >
+<SUBCOMPONENT type="5100" id="1314" >
 <father id="1407" num="2" />
 <cdparam x="249" y="399" />
 <sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="0" maxX="562" minY="0" maxY="339" />
 <infoparam name="start state" value="null" />
-<TGConnectingPoint num="0" id="1343" />
+<TGConnectingPoint num="0" id="1313" />
 </SUBCOMPONENT>
-<SUBCOMPONENT type="5104" id="1355" >
+<SUBCOMPONENT type="5106" id="1355" >
 <father id="1407" num="3" />
-<cdparam x="51" y="527" />
-<sizeparam width="141" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="189" y="435" />
+<sizeparam width="132" height="40" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="450" minY="0" maxY="334" />
-<infoparam name="Send signal" value="pushCoffeeButton()" />
-<TGConnectingPoint num="0" id="1345" />
-<TGConnectingPoint num="1" id="1346" />
-<TGConnectingPoint num="2" id="1347" />
-<TGConnectingPoint num="3" id="1348" />
-<TGConnectingPoint num="4" id="1349" />
-<TGConnectingPoint num="5" id="1350" />
-<TGConnectingPoint num="6" id="1351" />
-<TGConnectingPoint num="7" id="1352" />
-<TGConnectingPoint num="8" id="1353" />
-<TGConnectingPoint num="9" id="1354" />
-<accessibility />
+<cdrectangleparam minX="0" maxX="445" minY="0" maxY="314" />
+<infoparam name="state0" value="WaitingForSelection" />
+<TGConnectingPoint num="0" id="1315" />
+<TGConnectingPoint num="1" id="1316" />
+<TGConnectingPoint num="2" id="1317" />
+<TGConnectingPoint num="3" id="1318" />
+<TGConnectingPoint num="4" id="1319" />
+<TGConnectingPoint num="5" id="1320" />
+<TGConnectingPoint num="6" id="1321" />
+<TGConnectingPoint num="7" id="1322" />
+<TGConnectingPoint num="8" id="1323" />
+<TGConnectingPoint num="9" id="1324" />
+<TGConnectingPoint num="10" id="1325" />
+<TGConnectingPoint num="11" id="1326" />
+<TGConnectingPoint num="12" id="1327" />
+<TGConnectingPoint num="13" id="1328" />
+<TGConnectingPoint num="14" id="1329" />
+<TGConnectingPoint num="15" id="1330" />
+<TGConnectingPoint num="16" id="1331" />
+<TGConnectingPoint num="17" id="1332" />
+<TGConnectingPoint num="18" id="1333" />
+<TGConnectingPoint num="19" id="1334" />
+<TGConnectingPoint num="20" id="1335" />
+<TGConnectingPoint num="21" id="1336" />
+<TGConnectingPoint num="22" id="1337" />
+<TGConnectingPoint num="23" id="1338" />
+<TGConnectingPoint num="24" id="1339" />
+<TGConnectingPoint num="25" id="1340" />
+<TGConnectingPoint num="26" id="1341" />
+<TGConnectingPoint num="27" id="1342" />
+<TGConnectingPoint num="28" id="1343" />
+<TGConnectingPoint num="29" id="1344" />
+<TGConnectingPoint num="30" id="1345" />
+<TGConnectingPoint num="31" id="1346" />
+<TGConnectingPoint num="32" id="1347" />
+<TGConnectingPoint num="33" id="1348" />
+<TGConnectingPoint num="34" id="1349" />
+<TGConnectingPoint num="35" id="1350" />
+<TGConnectingPoint num="36" id="1351" />
+<TGConnectingPoint num="37" id="1352" />
+<TGConnectingPoint num="38" id="1353" />
+<TGConnectingPoint num="39" id="1354" />
+<extraparam>
+</extraparam>
 </SUBCOMPONENT>
-<SUBCOMPONENT type="5103" id="1366" >
+<SUBCOMPONENT type="5104" id="1366" >
 <father id="1407" num="4" />
-<cdparam x="367" y="500" />
-<sizeparam width="141" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="231" y="527" />
+<sizeparam width="124" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="447" minY="0" maxY="334" />
-<infoparam name="Send signal" value="ejectCoin(nbOfCoins)" />
+<cdrectangleparam minX="0" maxX="465" minY="0" maxY="334" />
+<infoparam name="Send signal" value="pushTeaButton()" />
 <TGConnectingPoint num="0" id="1356" />
 <TGConnectingPoint num="1" id="1357" />
 <TGConnectingPoint num="2" id="1358" />
@@ -2681,19 +2681,19 @@
 
 </AVATARStateMachineDiagramPanel>
 
-<AVATARStateMachineDiagramPanel name="TeaButton" minX="10" maxX="1400" minY="10" maxY="900" >
+<AVATARStateMachineDiagramPanel name="CoffeeButton" minX="10" maxX="1400" minY="10" maxY="900" >
 <CONNECTOR type="5102" id="1414" >
-<cdparam x="363" y="193" />
+<cdparam x="177" y="199" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from Send signal to state0" value="null" />
+<infoparam name="connector from start state to Send signal" value="null" />
 <TGConnectingPoint num="0" id="1413" />
-<P1  x="363" y="204" id="1430" />
-<P2  x="362" y="257" id="1441" />
+<P1  x="340" y="233" id="1520" />
+<P2  x="353" y="252" id="1522" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="1412" >
 <father id="1414" num="0" />
-<cdparam x="380" y="228" />
-<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="177" y="239" />
+<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
@@ -2703,7 +2703,7 @@
 <TGConnectingPoint num="3" id="1411" />
 <extraparam>
 <guard value="[ ]" />
-<afterMin value="mechanicalDelay" />
+<afterMin value="" />
 <afterMax value="" />
 <computeMin value="" />
 <computeMax value="" />
@@ -2711,16 +2711,16 @@
 </SUBCOMPONENT>
 
 <CONNECTOR type="5102" id="1421" >
-<cdparam x="363" y="150" />
+<cdparam x="322" y="69" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from state0 to Send signal" value="null" />
+<infoparam name="connector from start state to state0" value="null" />
 <TGConnectingPoint num="0" id="1420" />
-<P1  x="363" y="150" id="1487" />
-<P2  x="363" y="174" id="1429" />
+<P1  x="322" y="69" id="1518" />
+<P2  x="323" y="88" id="1478" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="1419" >
 <father id="1421" num="0" />
-<cdparam x="363" y="190" />
+<cdparam x="322" y="109" />
 <sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -2739,16 +2739,16 @@
 </SUBCOMPONENT>
 
 <CONNECTOR type="5102" id="1428" >
-<cdparam x="362" y="101" />
+<cdparam x="377" y="144" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from start state to state0" value="null" />
+<infoparam name="connector from state0 to Send signal" value="null" />
 <TGConnectingPoint num="0" id="1427" />
-<P1  x="362" y="101" id="1522" />
-<P2  x="363" y="120" id="1482" />
+<P1  x="323" y="118" id="1483" />
+<P2  x="356" y="174" id="1534" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="1426" >
 <father id="1428" num="0" />
-<cdparam x="362" y="141" />
+<cdparam x="377" y="184" />
 <sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -2766,184 +2766,271 @@
 </extraparam>
 </SUBCOMPONENT>
 
-<COMPONENT type="5103" id="1439" >
-<cdparam x="338" y="179" />
-<sizeparam width="51" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<CONNECTOR type="5102" id="1435" >
+<cdparam x="377" y="187" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector from Send signal to state0" value="null" />
+<TGConnectingPoint num="0" id="1434" />
+<P1  x="353" y="282" id="1523" />
+<P2  x="399" y="352" id="1437" />
+<AutomaticDrawing  data="true" />
+</CONNECTOR><SUBCOMPONENT type="-1" id="1433" >
+<father id="1435" num="0" />
+<cdparam x="417" y="335" />
+<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="Send signal" value="push()" />
+<infoparam name="List of all parameters of an Avatar SMD transition" value="" />
 <TGConnectingPoint num="0" id="1429" />
 <TGConnectingPoint num="1" id="1430" />
 <TGConnectingPoint num="2" id="1431" />
 <TGConnectingPoint num="3" id="1432" />
-<TGConnectingPoint num="4" id="1433" />
-<TGConnectingPoint num="5" id="1434" />
-<TGConnectingPoint num="6" id="1435" />
-<TGConnectingPoint num="7" id="1436" />
-<TGConnectingPoint num="8" id="1437" />
-<TGConnectingPoint num="9" id="1438" />
-</COMPONENT>
+<extraparam>
+<guard value="[ ]" />
+<afterMin value="mechanicalDelay" />
+<afterMax value="" />
+<computeMin value="" />
+<computeMax value="" />
+</extraparam>
+</SUBCOMPONENT>
 
-<COMPONENT type="5106" id="1480" >
-<cdparam x="337" y="257" />
+<COMPONENT type="5106" id="1476" >
+<cdparam x="374" y="352" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="state0" value="main" />
-<TGConnectingPoint num="0" id="1440" />
-<TGConnectingPoint num="1" id="1441" />
-<TGConnectingPoint num="2" id="1442" />
-<TGConnectingPoint num="3" id="1443" />
-<TGConnectingPoint num="4" id="1444" />
-<TGConnectingPoint num="5" id="1445" />
-<TGConnectingPoint num="6" id="1446" />
-<TGConnectingPoint num="7" id="1447" />
-<TGConnectingPoint num="8" id="1448" />
-<TGConnectingPoint num="9" id="1449" />
-<TGConnectingPoint num="10" id="1450" />
-<TGConnectingPoint num="11" id="1451" />
-<TGConnectingPoint num="12" id="1452" />
-<TGConnectingPoint num="13" id="1453" />
-<TGConnectingPoint num="14" id="1454" />
-<TGConnectingPoint num="15" id="1455" />
-<TGConnectingPoint num="16" id="1456" />
-<TGConnectingPoint num="17" id="1457" />
-<TGConnectingPoint num="18" id="1458" />
-<TGConnectingPoint num="19" id="1459" />
-<TGConnectingPoint num="20" id="1460" />
-<TGConnectingPoint num="21" id="1461" />
-<TGConnectingPoint num="22" id="1462" />
-<TGConnectingPoint num="23" id="1463" />
-<TGConnectingPoint num="24" id="1464" />
-<TGConnectingPoint num="25" id="1465" />
-<TGConnectingPoint num="26" id="1466" />
-<TGConnectingPoint num="27" id="1467" />
-<TGConnectingPoint num="28" id="1468" />
-<TGConnectingPoint num="29" id="1469" />
-<TGConnectingPoint num="30" id="1470" />
-<TGConnectingPoint num="31" id="1471" />
-<TGConnectingPoint num="32" id="1472" />
-<TGConnectingPoint num="33" id="1473" />
-<TGConnectingPoint num="34" id="1474" />
-<TGConnectingPoint num="35" id="1475" />
-<TGConnectingPoint num="36" id="1476" />
-<TGConnectingPoint num="37" id="1477" />
-<TGConnectingPoint num="38" id="1478" />
-<TGConnectingPoint num="39" id="1479" />
+<TGConnectingPoint num="0" id="1436" />
+<TGConnectingPoint num="1" id="1437" />
+<TGConnectingPoint num="2" id="1438" />
+<TGConnectingPoint num="3" id="1439" />
+<TGConnectingPoint num="4" id="1440" />
+<TGConnectingPoint num="5" id="1441" />
+<TGConnectingPoint num="6" id="1442" />
+<TGConnectingPoint num="7" id="1443" />
+<TGConnectingPoint num="8" id="1444" />
+<TGConnectingPoint num="9" id="1445" />
+<TGConnectingPoint num="10" id="1446" />
+<TGConnectingPoint num="11" id="1447" />
+<TGConnectingPoint num="12" id="1448" />
+<TGConnectingPoint num="13" id="1449" />
+<TGConnectingPoint num="14" id="1450" />
+<TGConnectingPoint num="15" id="1451" />
+<TGConnectingPoint num="16" id="1452" />
+<TGConnectingPoint num="17" id="1453" />
+<TGConnectingPoint num="18" id="1454" />
+<TGConnectingPoint num="19" id="1455" />
+<TGConnectingPoint num="20" id="1456" />
+<TGConnectingPoint num="21" id="1457" />
+<TGConnectingPoint num="22" id="1458" />
+<TGConnectingPoint num="23" id="1459" />
+<TGConnectingPoint num="24" id="1460" />
+<TGConnectingPoint num="25" id="1461" />
+<TGConnectingPoint num="26" id="1462" />
+<TGConnectingPoint num="27" id="1463" />
+<TGConnectingPoint num="28" id="1464" />
+<TGConnectingPoint num="29" id="1465" />
+<TGConnectingPoint num="30" id="1466" />
+<TGConnectingPoint num="31" id="1467" />
+<TGConnectingPoint num="32" id="1468" />
+<TGConnectingPoint num="33" id="1469" />
+<TGConnectingPoint num="34" id="1470" />
+<TGConnectingPoint num="35" id="1471" />
+<TGConnectingPoint num="36" id="1472" />
+<TGConnectingPoint num="37" id="1473" />
+<TGConnectingPoint num="38" id="1474" />
+<TGConnectingPoint num="39" id="1475" />
 <extraparam>
 </extraparam>
 </COMPONENT>
 
-<COMPONENT type="5106" id="1521" >
-<cdparam x="338" y="120" />
+<COMPONENT type="5106" id="1517" >
+<cdparam x="298" y="88" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="state0" value="main" />
-<TGConnectingPoint num="0" id="1481" />
-<TGConnectingPoint num="1" id="1482" />
-<TGConnectingPoint num="2" id="1483" />
-<TGConnectingPoint num="3" id="1484" />
-<TGConnectingPoint num="4" id="1485" />
-<TGConnectingPoint num="5" id="1486" />
-<TGConnectingPoint num="6" id="1487" />
-<TGConnectingPoint num="7" id="1488" />
-<TGConnectingPoint num="8" id="1489" />
-<TGConnectingPoint num="9" id="1490" />
-<TGConnectingPoint num="10" id="1491" />
-<TGConnectingPoint num="11" id="1492" />
-<TGConnectingPoint num="12" id="1493" />
-<TGConnectingPoint num="13" id="1494" />
-<TGConnectingPoint num="14" id="1495" />
-<TGConnectingPoint num="15" id="1496" />
-<TGConnectingPoint num="16" id="1497" />
-<TGConnectingPoint num="17" id="1498" />
-<TGConnectingPoint num="18" id="1499" />
-<TGConnectingPoint num="19" id="1500" />
-<TGConnectingPoint num="20" id="1501" />
-<TGConnectingPoint num="21" id="1502" />
-<TGConnectingPoint num="22" id="1503" />
-<TGConnectingPoint num="23" id="1504" />
-<TGConnectingPoint num="24" id="1505" />
-<TGConnectingPoint num="25" id="1506" />
-<TGConnectingPoint num="26" id="1507" />
-<TGConnectingPoint num="27" id="1508" />
-<TGConnectingPoint num="28" id="1509" />
-<TGConnectingPoint num="29" id="1510" />
-<TGConnectingPoint num="30" id="1511" />
-<TGConnectingPoint num="31" id="1512" />
-<TGConnectingPoint num="32" id="1513" />
-<TGConnectingPoint num="33" id="1514" />
-<TGConnectingPoint num="34" id="1515" />
-<TGConnectingPoint num="35" id="1516" />
-<TGConnectingPoint num="36" id="1517" />
-<TGConnectingPoint num="37" id="1518" />
-<TGConnectingPoint num="38" id="1519" />
-<TGConnectingPoint num="39" id="1520" />
+<TGConnectingPoint num="0" id="1477" />
+<TGConnectingPoint num="1" id="1478" />
+<TGConnectingPoint num="2" id="1479" />
+<TGConnectingPoint num="3" id="1480" />
+<TGConnectingPoint num="4" id="1481" />
+<TGConnectingPoint num="5" id="1482" />
+<TGConnectingPoint num="6" id="1483" />
+<TGConnectingPoint num="7" id="1484" />
+<TGConnectingPoint num="8" id="1485" />
+<TGConnectingPoint num="9" id="1486" />
+<TGConnectingPoint num="10" id="1487" />
+<TGConnectingPoint num="11" id="1488" />
+<TGConnectingPoint num="12" id="1489" />
+<TGConnectingPoint num="13" id="1490" />
+<TGConnectingPoint num="14" id="1491" />
+<TGConnectingPoint num="15" id="1492" />
+<TGConnectingPoint num="16" id="1493" />
+<TGConnectingPoint num="17" id="1494" />
+<TGConnectingPoint num="18" id="1495" />
+<TGConnectingPoint num="19" id="1496" />
+<TGConnectingPoint num="20" id="1497" />
+<TGConnectingPoint num="21" id="1498" />
+<TGConnectingPoint num="22" id="1499" />
+<TGConnectingPoint num="23" id="1500" />
+<TGConnectingPoint num="24" id="1501" />
+<TGConnectingPoint num="25" id="1502" />
+<TGConnectingPoint num="26" id="1503" />
+<TGConnectingPoint num="27" id="1504" />
+<TGConnectingPoint num="28" id="1505" />
+<TGConnectingPoint num="29" id="1506" />
+<TGConnectingPoint num="30" id="1507" />
+<TGConnectingPoint num="31" id="1508" />
+<TGConnectingPoint num="32" id="1509" />
+<TGConnectingPoint num="33" id="1510" />
+<TGConnectingPoint num="34" id="1511" />
+<TGConnectingPoint num="35" id="1512" />
+<TGConnectingPoint num="36" id="1513" />
+<TGConnectingPoint num="37" id="1514" />
+<TGConnectingPoint num="38" id="1515" />
+<TGConnectingPoint num="39" id="1516" />
 <extraparam>
 </extraparam>
 </COMPONENT>
 
-<COMPONENT type="5100" id="1523" >
-<cdparam x="355" y="81" />
+<COMPONENT type="5100" id="1519" >
+<cdparam x="315" y="49" />
 <sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="start state" value="null" />
-<TGConnectingPoint num="0" id="1522" />
+<TGConnectingPoint num="0" id="1518" />
+</COMPONENT>
+
+<COMPONENT type="5106" id="1573" >
+<cdparam x="264" y="174" />
+<sizeparam width="184" height="130" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="state0" value="state0" />
+<TGConnectingPoint num="0" id="1533" />
+<TGConnectingPoint num="1" id="1534" />
+<TGConnectingPoint num="2" id="1535" />
+<TGConnectingPoint num="3" id="1536" />
+<TGConnectingPoint num="4" id="1537" />
+<TGConnectingPoint num="5" id="1538" />
+<TGConnectingPoint num="6" id="1539" />
+<TGConnectingPoint num="7" id="1540" />
+<TGConnectingPoint num="8" id="1541" />
+<TGConnectingPoint num="9" id="1542" />
+<TGConnectingPoint num="10" id="1543" />
+<TGConnectingPoint num="11" id="1544" />
+<TGConnectingPoint num="12" id="1545" />
+<TGConnectingPoint num="13" id="1546" />
+<TGConnectingPoint num="14" id="1547" />
+<TGConnectingPoint num="15" id="1548" />
+<TGConnectingPoint num="16" id="1549" />
+<TGConnectingPoint num="17" id="1550" />
+<TGConnectingPoint num="18" id="1551" />
+<TGConnectingPoint num="19" id="1552" />
+<TGConnectingPoint num="20" id="1553" />
+<TGConnectingPoint num="21" id="1554" />
+<TGConnectingPoint num="22" id="1555" />
+<TGConnectingPoint num="23" id="1556" />
+<TGConnectingPoint num="24" id="1557" />
+<TGConnectingPoint num="25" id="1558" />
+<TGConnectingPoint num="26" id="1559" />
+<TGConnectingPoint num="27" id="1560" />
+<TGConnectingPoint num="28" id="1561" />
+<TGConnectingPoint num="29" id="1562" />
+<TGConnectingPoint num="30" id="1563" />
+<TGConnectingPoint num="31" id="1564" />
+<TGConnectingPoint num="32" id="1565" />
+<TGConnectingPoint num="33" id="1566" />
+<TGConnectingPoint num="34" id="1567" />
+<TGConnectingPoint num="35" id="1568" />
+<TGConnectingPoint num="36" id="1569" />
+<TGConnectingPoint num="37" id="1570" />
+<TGConnectingPoint num="38" id="1571" />
+<TGConnectingPoint num="39" id="1572" />
+<extraparam>
+</extraparam>
 </COMPONENT>
+<SUBCOMPONENT type="5100" id="1521" >
+<father id="1573" num="0" />
+<cdparam x="333" y="213" />
+<sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="0" maxX="169" minY="0" maxY="115" />
+<infoparam name="start state" value="null" />
+<TGConnectingPoint num="0" id="1520" />
+</SUBCOMPONENT>
+<SUBCOMPONENT type="5103" id="1532" >
+<father id="1573" num="1" />
+<cdparam x="328" y="257" />
+<sizeparam width="51" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="0" maxX="138" minY="0" maxY="110" />
+<infoparam name="Send signal" value="push()" />
+<TGConnectingPoint num="0" id="1522" />
+<TGConnectingPoint num="1" id="1523" />
+<TGConnectingPoint num="2" id="1524" />
+<TGConnectingPoint num="3" id="1525" />
+<TGConnectingPoint num="4" id="1526" />
+<TGConnectingPoint num="5" id="1527" />
+<TGConnectingPoint num="6" id="1528" />
+<TGConnectingPoint num="7" id="1529" />
+<TGConnectingPoint num="8" id="1530" />
+<TGConnectingPoint num="9" id="1531" />
+</SUBCOMPONENT>
 
 
 </AVATARStateMachineDiagramPanel>
 
-<AVATARStateMachineDiagramPanel name="CoffeeButton" minX="10" maxX="1400" minY="10" maxY="900" >
-<CONNECTOR type="5102" id="1530" >
-<cdparam x="177" y="199" />
+<AVATARStateMachineDiagramPanel name="TeaButton" minX="10" maxX="1400" minY="10" maxY="900" >
+<CONNECTOR type="5102" id="1580" >
+<cdparam x="363" y="193" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from start state to Send signal" value="null" />
-<TGConnectingPoint num="0" id="1529" />
-<P1  x="340" y="233" id="1647" />
-<P2  x="353" y="252" id="1636" />
+<infoparam name="connector from Send signal to state0" value="null" />
+<TGConnectingPoint num="0" id="1579" />
+<P1  x="363" y="204" id="1596" />
+<P2  x="362" y="257" id="1607" />
 <AutomaticDrawing  data="true" />
-</CONNECTOR><SUBCOMPONENT type="-1" id="1528" >
-<father id="1530" num="0" />
-<cdparam x="177" y="239" />
-<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+</CONNECTOR><SUBCOMPONENT type="-1" id="1578" >
+<father id="1580" num="0" />
+<cdparam x="380" y="228" />
+<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
-<TGConnectingPoint num="0" id="1524" />
-<TGConnectingPoint num="1" id="1525" />
-<TGConnectingPoint num="2" id="1526" />
-<TGConnectingPoint num="3" id="1527" />
+<TGConnectingPoint num="0" id="1574" />
+<TGConnectingPoint num="1" id="1575" />
+<TGConnectingPoint num="2" id="1576" />
+<TGConnectingPoint num="3" id="1577" />
 <extraparam>
 <guard value="[ ]" />
-<afterMin value="" />
+<afterMin value="mechanicalDelay" />
 <afterMax value="" />
 <computeMin value="" />
 <computeMax value="" />
 </extraparam>
 </SUBCOMPONENT>
 
-<CONNECTOR type="5102" id="1537" >
-<cdparam x="322" y="69" />
+<CONNECTOR type="5102" id="1587" >
+<cdparam x="363" y="150" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from start state to state0" value="null" />
-<TGConnectingPoint num="0" id="1536" />
-<P1  x="322" y="69" id="1634" />
-<P2  x="323" y="88" id="1594" />
+<infoparam name="connector from state0 to Send signal" value="null" />
+<TGConnectingPoint num="0" id="1586" />
+<P1  x="363" y="150" id="1653" />
+<P2  x="363" y="174" id="1595" />
 <AutomaticDrawing  data="true" />
-</CONNECTOR><SUBCOMPONENT type="-1" id="1535" >
-<father id="1537" num="0" />
-<cdparam x="322" y="109" />
+</CONNECTOR><SUBCOMPONENT type="-1" id="1585" >
+<father id="1587" num="0" />
+<cdparam x="363" y="190" />
 <sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
-<TGConnectingPoint num="0" id="1531" />
-<TGConnectingPoint num="1" id="1532" />
-<TGConnectingPoint num="2" id="1533" />
-<TGConnectingPoint num="3" id="1534" />
+<TGConnectingPoint num="0" id="1581" />
+<TGConnectingPoint num="1" id="1582" />
+<TGConnectingPoint num="2" id="1583" />
+<TGConnectingPoint num="3" id="1584" />
 <extraparam>
 <guard value="[ ]" />
 <afterMin value="" />
@@ -2953,25 +3040,25 @@
 </extraparam>
 </SUBCOMPONENT>
 
-<CONNECTOR type="5102" id="1544" >
-<cdparam x="377" y="144" />
+<CONNECTOR type="5102" id="1594" >
+<cdparam x="362" y="101" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from state0 to Send signal" value="null" />
-<TGConnectingPoint num="0" id="1543" />
-<P1  x="323" y="118" id="1599" />
-<P2  x="356" y="174" id="1650" />
+<infoparam name="connector from start state to state0" value="null" />
+<TGConnectingPoint num="0" id="1593" />
+<P1  x="362" y="101" id="1688" />
+<P2  x="363" y="120" id="1648" />
 <AutomaticDrawing  data="true" />
-</CONNECTOR><SUBCOMPONENT type="-1" id="1542" >
-<father id="1544" num="0" />
-<cdparam x="377" y="184" />
+</CONNECTOR><SUBCOMPONENT type="-1" id="1592" >
+<father id="1594" num="0" />
+<cdparam x="362" y="141" />
 <sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
-<TGConnectingPoint num="0" id="1538" />
-<TGConnectingPoint num="1" id="1539" />
-<TGConnectingPoint num="2" id="1540" />
-<TGConnectingPoint num="3" id="1541" />
+<TGConnectingPoint num="0" id="1588" />
+<TGConnectingPoint num="1" id="1589" />
+<TGConnectingPoint num="2" id="1590" />
+<TGConnectingPoint num="3" id="1591" />
 <extraparam>
 <guard value="[ ]" />
 <afterMin value="" />
@@ -2981,220 +3068,133 @@
 </extraparam>
 </SUBCOMPONENT>
 
-<CONNECTOR type="5102" id="1551" >
-<cdparam x="377" y="187" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from Send signal to state0" value="null" />
-<TGConnectingPoint num="0" id="1550" />
-<P1  x="353" y="282" id="1637" />
-<P2  x="399" y="352" id="1553" />
-<AutomaticDrawing  data="true" />
-</CONNECTOR><SUBCOMPONENT type="-1" id="1549" >
-<father id="1551" num="0" />
-<cdparam x="417" y="335" />
-<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<COMPONENT type="5103" id="1605" >
+<cdparam x="338" y="179" />
+<sizeparam width="51" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="List of all parameters of an Avatar SMD transition" value="" />
-<TGConnectingPoint num="0" id="1545" />
-<TGConnectingPoint num="1" id="1546" />
-<TGConnectingPoint num="2" id="1547" />
-<TGConnectingPoint num="3" id="1548" />
-<extraparam>
-<guard value="[ ]" />
-<afterMin value="mechanicalDelay" />
-<afterMax value="" />
-<computeMin value="" />
-<computeMax value="" />
-</extraparam>
-</SUBCOMPONENT>
+<infoparam name="Send signal" value="push()" />
+<TGConnectingPoint num="0" id="1595" />
+<TGConnectingPoint num="1" id="1596" />
+<TGConnectingPoint num="2" id="1597" />
+<TGConnectingPoint num="3" id="1598" />
+<TGConnectingPoint num="4" id="1599" />
+<TGConnectingPoint num="5" id="1600" />
+<TGConnectingPoint num="6" id="1601" />
+<TGConnectingPoint num="7" id="1602" />
+<TGConnectingPoint num="8" id="1603" />
+<TGConnectingPoint num="9" id="1604" />
+</COMPONENT>
 
-<COMPONENT type="5106" id="1592" >
-<cdparam x="374" y="352" />
+<COMPONENT type="5106" id="1646" >
+<cdparam x="337" y="257" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="state0" value="main" />
-<TGConnectingPoint num="0" id="1552" />
-<TGConnectingPoint num="1" id="1553" />
-<TGConnectingPoint num="2" id="1554" />
-<TGConnectingPoint num="3" id="1555" />
-<TGConnectingPoint num="4" id="1556" />
-<TGConnectingPoint num="5" id="1557" />
-<TGConnectingPoint num="6" id="1558" />
-<TGConnectingPoint num="7" id="1559" />
-<TGConnectingPoint num="8" id="1560" />
-<TGConnectingPoint num="9" id="1561" />
-<TGConnectingPoint num="10" id="1562" />
-<TGConnectingPoint num="11" id="1563" />
-<TGConnectingPoint num="12" id="1564" />
-<TGConnectingPoint num="13" id="1565" />
-<TGConnectingPoint num="14" id="1566" />
-<TGConnectingPoint num="15" id="1567" />
-<TGConnectingPoint num="16" id="1568" />
-<TGConnectingPoint num="17" id="1569" />
-<TGConnectingPoint num="18" id="1570" />
-<TGConnectingPoint num="19" id="1571" />
-<TGConnectingPoint num="20" id="1572" />
-<TGConnectingPoint num="21" id="1573" />
-<TGConnectingPoint num="22" id="1574" />
-<TGConnectingPoint num="23" id="1575" />
-<TGConnectingPoint num="24" id="1576" />
-<TGConnectingPoint num="25" id="1577" />
-<TGConnectingPoint num="26" id="1578" />
-<TGConnectingPoint num="27" id="1579" />
-<TGConnectingPoint num="28" id="1580" />
-<TGConnectingPoint num="29" id="1581" />
-<TGConnectingPoint num="30" id="1582" />
-<TGConnectingPoint num="31" id="1583" />
-<TGConnectingPoint num="32" id="1584" />
-<TGConnectingPoint num="33" id="1585" />
-<TGConnectingPoint num="34" id="1586" />
-<TGConnectingPoint num="35" id="1587" />
-<TGConnectingPoint num="36" id="1588" />
-<TGConnectingPoint num="37" id="1589" />
-<TGConnectingPoint num="38" id="1590" />
-<TGConnectingPoint num="39" id="1591" />
+<TGConnectingPoint num="0" id="1606" />
+<TGConnectingPoint num="1" id="1607" />
+<TGConnectingPoint num="2" id="1608" />
+<TGConnectingPoint num="3" id="1609" />
+<TGConnectingPoint num="4" id="1610" />
+<TGConnectingPoint num="5" id="1611" />
+<TGConnectingPoint num="6" id="1612" />
+<TGConnectingPoint num="7" id="1613" />
+<TGConnectingPoint num="8" id="1614" />
+<TGConnectingPoint num="9" id="1615" />
+<TGConnectingPoint num="10" id="1616" />
+<TGConnectingPoint num="11" id="1617" />
+<TGConnectingPoint num="12" id="1618" />
+<TGConnectingPoint num="13" id="1619" />
+<TGConnectingPoint num="14" id="1620" />
+<TGConnectingPoint num="15" id="1621" />
+<TGConnectingPoint num="16" id="1622" />
+<TGConnectingPoint num="17" id="1623" />
+<TGConnectingPoint num="18" id="1624" />
+<TGConnectingPoint num="19" id="1625" />
+<TGConnectingPoint num="20" id="1626" />
+<TGConnectingPoint num="21" id="1627" />
+<TGConnectingPoint num="22" id="1628" />
+<TGConnectingPoint num="23" id="1629" />
+<TGConnectingPoint num="24" id="1630" />
+<TGConnectingPoint num="25" id="1631" />
+<TGConnectingPoint num="26" id="1632" />
+<TGConnectingPoint num="27" id="1633" />
+<TGConnectingPoint num="28" id="1634" />
+<TGConnectingPoint num="29" id="1635" />
+<TGConnectingPoint num="30" id="1636" />
+<TGConnectingPoint num="31" id="1637" />
+<TGConnectingPoint num="32" id="1638" />
+<TGConnectingPoint num="33" id="1639" />
+<TGConnectingPoint num="34" id="1640" />
+<TGConnectingPoint num="35" id="1641" />
+<TGConnectingPoint num="36" id="1642" />
+<TGConnectingPoint num="37" id="1643" />
+<TGConnectingPoint num="38" id="1644" />
+<TGConnectingPoint num="39" id="1645" />
 <extraparam>
 </extraparam>
 </COMPONENT>
 
-<COMPONENT type="5106" id="1633" >
-<cdparam x="298" y="88" />
+<COMPONENT type="5106" id="1687" >
+<cdparam x="338" y="120" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="state0" value="main" />
-<TGConnectingPoint num="0" id="1593" />
-<TGConnectingPoint num="1" id="1594" />
-<TGConnectingPoint num="2" id="1595" />
-<TGConnectingPoint num="3" id="1596" />
-<TGConnectingPoint num="4" id="1597" />
-<TGConnectingPoint num="5" id="1598" />
-<TGConnectingPoint num="6" id="1599" />
-<TGConnectingPoint num="7" id="1600" />
-<TGConnectingPoint num="8" id="1601" />
-<TGConnectingPoint num="9" id="1602" />
-<TGConnectingPoint num="10" id="1603" />
-<TGConnectingPoint num="11" id="1604" />
-<TGConnectingPoint num="12" id="1605" />
-<TGConnectingPoint num="13" id="1606" />
-<TGConnectingPoint num="14" id="1607" />
-<TGConnectingPoint num="15" id="1608" />
-<TGConnectingPoint num="16" id="1609" />
-<TGConnectingPoint num="17" id="1610" />
-<TGConnectingPoint num="18" id="1611" />
-<TGConnectingPoint num="19" id="1612" />
-<TGConnectingPoint num="20" id="1613" />
-<TGConnectingPoint num="21" id="1614" />
-<TGConnectingPoint num="22" id="1615" />
-<TGConnectingPoint num="23" id="1616" />
-<TGConnectingPoint num="24" id="1617" />
-<TGConnectingPoint num="25" id="1618" />
-<TGConnectingPoint num="26" id="1619" />
-<TGConnectingPoint num="27" id="1620" />
-<TGConnectingPoint num="28" id="1621" />
-<TGConnectingPoint num="29" id="1622" />
-<TGConnectingPoint num="30" id="1623" />
-<TGConnectingPoint num="31" id="1624" />
-<TGConnectingPoint num="32" id="1625" />
-<TGConnectingPoint num="33" id="1626" />
-<TGConnectingPoint num="34" id="1627" />
-<TGConnectingPoint num="35" id="1628" />
-<TGConnectingPoint num="36" id="1629" />
-<TGConnectingPoint num="37" id="1630" />
-<TGConnectingPoint num="38" id="1631" />
-<TGConnectingPoint num="39" id="1632" />
+<TGConnectingPoint num="0" id="1647" />
+<TGConnectingPoint num="1" id="1648" />
+<TGConnectingPoint num="2" id="1649" />
+<TGConnectingPoint num="3" id="1650" />
+<TGConnectingPoint num="4" id="1651" />
+<TGConnectingPoint num="5" id="1652" />
+<TGConnectingPoint num="6" id="1653" />
+<TGConnectingPoint num="7" id="1654" />
+<TGConnectingPoint num="8" id="1655" />
+<TGConnectingPoint num="9" id="1656" />
+<TGConnectingPoint num="10" id="1657" />
+<TGConnectingPoint num="11" id="1658" />
+<TGConnectingPoint num="12" id="1659" />
+<TGConnectingPoint num="13" id="1660" />
+<TGConnectingPoint num="14" id="1661" />
+<TGConnectingPoint num="15" id="1662" />
+<TGConnectingPoint num="16" id="1663" />
+<TGConnectingPoint num="17" id="1664" />
+<TGConnectingPoint num="18" id="1665" />
+<TGConnectingPoint num="19" id="1666" />
+<TGConnectingPoint num="20" id="1667" />
+<TGConnectingPoint num="21" id="1668" />
+<TGConnectingPoint num="22" id="1669" />
+<TGConnectingPoint num="23" id="1670" />
+<TGConnectingPoint num="24" id="1671" />
+<TGConnectingPoint num="25" id="1672" />
+<TGConnectingPoint num="26" id="1673" />
+<TGConnectingPoint num="27" id="1674" />
+<TGConnectingPoint num="28" id="1675" />
+<TGConnectingPoint num="29" id="1676" />
+<TGConnectingPoint num="30" id="1677" />
+<TGConnectingPoint num="31" id="1678" />
+<TGConnectingPoint num="32" id="1679" />
+<TGConnectingPoint num="33" id="1680" />
+<TGConnectingPoint num="34" id="1681" />
+<TGConnectingPoint num="35" id="1682" />
+<TGConnectingPoint num="36" id="1683" />
+<TGConnectingPoint num="37" id="1684" />
+<TGConnectingPoint num="38" id="1685" />
+<TGConnectingPoint num="39" id="1686" />
 <extraparam>
 </extraparam>
 </COMPONENT>
 
-<COMPONENT type="5100" id="1635" >
-<cdparam x="315" y="49" />
+<COMPONENT type="5100" id="1689" >
+<cdparam x="355" y="81" />
 <sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="start state" value="null" />
-<TGConnectingPoint num="0" id="1634" />
+<TGConnectingPoint num="0" id="1688" />
 </COMPONENT>
 
-<COMPONENT type="5106" id="1689" >
-<cdparam x="264" y="174" />
-<sizeparam width="184" height="130" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
-<infoparam name="state0" value="state0" />
-<TGConnectingPoint num="0" id="1649" />
-<TGConnectingPoint num="1" id="1650" />
-<TGConnectingPoint num="2" id="1651" />
-<TGConnectingPoint num="3" id="1652" />
-<TGConnectingPoint num="4" id="1653" />
-<TGConnectingPoint num="5" id="1654" />
-<TGConnectingPoint num="6" id="1655" />
-<TGConnectingPoint num="7" id="1656" />
-<TGConnectingPoint num="8" id="1657" />
-<TGConnectingPoint num="9" id="1658" />
-<TGConnectingPoint num="10" id="1659" />
-<TGConnectingPoint num="11" id="1660" />
-<TGConnectingPoint num="12" id="1661" />
-<TGConnectingPoint num="13" id="1662" />
-<TGConnectingPoint num="14" id="1663" />
-<TGConnectingPoint num="15" id="1664" />
-<TGConnectingPoint num="16" id="1665" />
-<TGConnectingPoint num="17" id="1666" />
-<TGConnectingPoint num="18" id="1667" />
-<TGConnectingPoint num="19" id="1668" />
-<TGConnectingPoint num="20" id="1669" />
-<TGConnectingPoint num="21" id="1670" />
-<TGConnectingPoint num="22" id="1671" />
-<TGConnectingPoint num="23" id="1672" />
-<TGConnectingPoint num="24" id="1673" />
-<TGConnectingPoint num="25" id="1674" />
-<TGConnectingPoint num="26" id="1675" />
-<TGConnectingPoint num="27" id="1676" />
-<TGConnectingPoint num="28" id="1677" />
-<TGConnectingPoint num="29" id="1678" />
-<TGConnectingPoint num="30" id="1679" />
-<TGConnectingPoint num="31" id="1680" />
-<TGConnectingPoint num="32" id="1681" />
-<TGConnectingPoint num="33" id="1682" />
-<TGConnectingPoint num="34" id="1683" />
-<TGConnectingPoint num="35" id="1684" />
-<TGConnectingPoint num="36" id="1685" />
-<TGConnectingPoint num="37" id="1686" />
-<TGConnectingPoint num="38" id="1687" />
-<TGConnectingPoint num="39" id="1688" />
-<extraparam>
-</extraparam>
-</COMPONENT>
-<SUBCOMPONENT type="5103" id="1646" >
-<father id="1689" num="0" />
-<cdparam x="328" y="257" />
-<sizeparam width="51" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="0" maxX="138" minY="0" maxY="110" />
-<infoparam name="Send signal" value="push()" />
-<TGConnectingPoint num="0" id="1636" />
-<TGConnectingPoint num="1" id="1637" />
-<TGConnectingPoint num="2" id="1638" />
-<TGConnectingPoint num="3" id="1639" />
-<TGConnectingPoint num="4" id="1640" />
-<TGConnectingPoint num="5" id="1641" />
-<TGConnectingPoint num="6" id="1642" />
-<TGConnectingPoint num="7" id="1643" />
-<TGConnectingPoint num="8" id="1644" />
-<TGConnectingPoint num="9" id="1645" />
-</SUBCOMPONENT>
-<SUBCOMPONENT type="5100" id="1648" >
-<father id="1689" num="1" />
-<cdparam x="333" y="213" />
-<sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<hidden value="false" />
-<cdrectangleparam minX="0" maxX="169" minY="0" maxY="115" />
-<infoparam name="start state" value="null" />
-<TGConnectingPoint num="0" id="1647" />
-</SUBCOMPONENT>
-
 
 </AVATARStateMachineDiagramPanel>
 
@@ -3208,7 +3208,7 @@
 <MainCode value="void __user_init() {"/>
 <MainCode value="}"/>
 <Optimized value="true" />
-<Validated value="Wallet;CoffeeMachine;CoffeeButton;TeaButton;" />
+<Validated value="" />
 <Ignored value="" />
 
 <CONNECTOR type="5002" id="1691" >
@@ -3216,7 +3216,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from Block1 to Block0" value="" />
 <TGConnectingPoint num="0" id="1690" />
-<P1  x="559" y="330" id="1752" />
+<P1  x="559" y="330" id="1727" />
 <P2  x="560" y="377" id="1785" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -3246,7 +3246,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector from Block1 to Block0" value="" />
 <TGConnectingPoint num="0" id="1694" />
-<P1  x="789" y="326" id="1727" />
+<P1  x="789" y="326" id="1752" />
 <P2  x="790" y="377" id="1786" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -3345,11 +3345,11 @@
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="1745" >
 <father id="1795" num="0" />
-<cdparam x="695" y="224" />
-<sizeparam width="189" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="464" y="228" />
+<sizeparam width="190" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="272" minY="0" maxY="256" />
-<infoparam name="Block1" value="TeaButton" />
+<cdrectangleparam minX="0" maxX="271" minY="0" maxY="256" />
+<infoparam name="Block1" value="CoffeeButton" />
 <TGConnectingPoint num="0" id="1721" />
 <TGConnectingPoint num="1" id="1722" />
 <TGConnectingPoint num="2" id="1723" />
@@ -3376,17 +3376,17 @@
 <TGConnectingPoint num="23" id="1744" />
 <extraparam>
 <CryptoBlock value="false" />
-<Attribute access="0" id="mechanicalDelay" value="10" type="8" typeOther="" />
+<Attribute access="0" id="mechanicalDelay" value="80" type="8" typeOther="" />
 <Signal value="out push()" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1770" >
 <father id="1795" num="1" />
-<cdparam x="464" y="228" />
-<sizeparam width="190" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="695" y="224" />
+<sizeparam width="189" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="271" minY="0" maxY="256" />
-<infoparam name="Block1" value="CoffeeButton" />
+<cdrectangleparam minX="0" maxX="272" minY="0" maxY="256" />
+<infoparam name="Block1" value="TeaButton" />
 <TGConnectingPoint num="0" id="1746" />
 <TGConnectingPoint num="1" id="1747" />
 <TGConnectingPoint num="2" id="1748" />
@@ -3413,7 +3413,7 @@
 <TGConnectingPoint num="23" id="1769" />
 <extraparam>
 <CryptoBlock value="false" />
-<Attribute access="0" id="mechanicalDelay" value="80" type="8" typeOther="" />
+<Attribute access="0" id="mechanicalDelay" value="10" type="8" typeOther="" />
 <Signal value="out push()" />
 </extraparam>
 </SUBCOMPONENT>
@@ -4589,19 +4589,19 @@
 
 </AVATARStateMachineDiagramPanel>
 
-<AVATARStateMachineDiagramPanel name="CoffeeButton" minX="10" maxX="1400" minY="10" maxY="900" >
+<AVATARStateMachineDiagramPanel name="TeaButton" minX="10" maxX="1400" minY="10" maxY="900" >
 <CONNECTOR type="5102" id="2396" >
-<cdparam x="323" y="118" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector" value="null" />
+<cdparam x="363" y="193" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector from Send signal to state0" value="null" />
 <TGConnectingPoint num="0" id="2395" />
-<P1  x="323" y="118" id="2469" />
-<P2  x="341" y="200" id="2411" />
+<P1  x="363" y="204" id="2412" />
+<P2  x="362" y="257" id="2423" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="2394" >
 <father id="2396" num="0" />
-<cdparam x="323" y="158" />
-<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="380" y="228" />
+<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
@@ -4611,7 +4611,7 @@
 <TGConnectingPoint num="3" id="2393" />
 <extraparam>
 <guard value="[ ]" />
-<afterMin value="" />
+<afterMin value="mechanicalDelay" />
 <afterMax value="" />
 <computeMin value="" />
 <computeMax value="" />
@@ -4619,16 +4619,16 @@
 </SUBCOMPONENT>
 
 <CONNECTOR type="5102" id="2403" >
-<cdparam x="322" y="69" />
+<cdparam x="363" y="150" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from start state to state0" value="null" />
+<infoparam name="connector from state0 to Send signal" value="null" />
 <TGConnectingPoint num="0" id="2402" />
-<P1  x="322" y="69" id="2504" />
-<P2  x="323" y="88" id="2464" />
+<P1  x="363" y="150" id="2469" />
+<P2  x="363" y="174" id="2411" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="2401" >
 <father id="2403" num="0" />
-<cdparam x="322" y="109" />
+<cdparam x="363" y="190" />
 <sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4647,17 +4647,17 @@
 </SUBCOMPONENT>
 
 <CONNECTOR type="5102" id="2410" >
-<cdparam x="365" y="135" />
+<cdparam x="362" y="101" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from Send signal to state0" value="null" />
+<infoparam name="connector from start state to state0" value="null" />
 <TGConnectingPoint num="0" id="2409" />
-<P1  x="341" y="230" id="2412" />
-<P2  x="387" y="300" id="2423" />
+<P1  x="362" y="101" id="2504" />
+<P2  x="363" y="120" id="2464" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="2408" >
 <father id="2410" num="0" />
-<cdparam x="405" y="283" />
-<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="362" y="141" />
+<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
@@ -4667,7 +4667,7 @@
 <TGConnectingPoint num="3" id="2407" />
 <extraparam>
 <guard value="[ ]" />
-<afterMin value="mechanicalDelay" />
+<afterMin value="" />
 <afterMax value="" />
 <computeMin value="" />
 <computeMax value="" />
@@ -4675,7 +4675,7 @@
 </SUBCOMPONENT>
 
 <COMPONENT type="5103" id="2421" >
-<cdparam x="316" y="205" />
+<cdparam x="338" y="179" />
 <sizeparam width="51" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4693,7 +4693,7 @@
 </COMPONENT>
 
 <COMPONENT type="5106" id="2462" >
-<cdparam x="362" y="300" />
+<cdparam x="337" y="257" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4743,7 +4743,7 @@
 </COMPONENT>
 
 <COMPONENT type="5106" id="2503" >
-<cdparam x="298" y="88" />
+<cdparam x="338" y="120" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4793,7 +4793,7 @@
 </COMPONENT>
 
 <COMPONENT type="5100" id="2505" >
-<cdparam x="315" y="49" />
+<cdparam x="355" y="81" />
 <sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4804,19 +4804,19 @@
 
 </AVATARStateMachineDiagramPanel>
 
-<AVATARStateMachineDiagramPanel name="TeaButton" minX="10" maxX="1400" minY="10" maxY="900" >
+<AVATARStateMachineDiagramPanel name="CoffeeButton" minX="10" maxX="1400" minY="10" maxY="900" >
 <CONNECTOR type="5102" id="2512" >
-<cdparam x="363" y="193" />
-<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from Send signal to state0" value="null" />
+<cdparam x="323" y="118" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="null" />
 <TGConnectingPoint num="0" id="2511" />
-<P1  x="363" y="204" id="2528" />
-<P2  x="362" y="257" id="2539" />
+<P1  x="323" y="118" id="2585" />
+<P2  x="341" y="200" id="2527" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="2510" >
 <father id="2512" num="0" />
-<cdparam x="380" y="228" />
-<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="323" y="158" />
+<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
@@ -4826,7 +4826,7 @@
 <TGConnectingPoint num="3" id="2509" />
 <extraparam>
 <guard value="[ ]" />
-<afterMin value="mechanicalDelay" />
+<afterMin value="" />
 <afterMax value="" />
 <computeMin value="" />
 <computeMax value="" />
@@ -4834,16 +4834,16 @@
 </SUBCOMPONENT>
 
 <CONNECTOR type="5102" id="2519" >
-<cdparam x="363" y="150" />
+<cdparam x="322" y="69" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from state0 to Send signal" value="null" />
+<infoparam name="connector from start state to state0" value="null" />
 <TGConnectingPoint num="0" id="2518" />
-<P1  x="363" y="150" id="2585" />
-<P2  x="363" y="174" id="2527" />
+<P1  x="322" y="69" id="2620" />
+<P2  x="323" y="88" id="2580" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="2517" >
 <father id="2519" num="0" />
-<cdparam x="363" y="190" />
+<cdparam x="322" y="109" />
 <sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4862,17 +4862,17 @@
 </SUBCOMPONENT>
 
 <CONNECTOR type="5102" id="2526" >
-<cdparam x="362" y="101" />
+<cdparam x="365" y="135" />
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
-<infoparam name="connector from start state to state0" value="null" />
+<infoparam name="connector from Send signal to state0" value="null" />
 <TGConnectingPoint num="0" id="2525" />
-<P1  x="362" y="101" id="2620" />
-<P2  x="363" y="120" id="2580" />
+<P1  x="341" y="230" id="2528" />
+<P2  x="387" y="300" id="2539" />
 <AutomaticDrawing  data="true" />
 </CONNECTOR><SUBCOMPONENT type="-1" id="2524" >
 <father id="2526" num="0" />
-<cdparam x="362" y="141" />
-<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="405" y="283" />
+<sizeparam width="149" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
 <infoparam name="List of all parameters of an Avatar SMD transition" value="" />
@@ -4882,7 +4882,7 @@
 <TGConnectingPoint num="3" id="2523" />
 <extraparam>
 <guard value="[ ]" />
-<afterMin value="" />
+<afterMin value="mechanicalDelay" />
 <afterMax value="" />
 <computeMin value="" />
 <computeMax value="" />
@@ -4890,7 +4890,7 @@
 </SUBCOMPONENT>
 
 <COMPONENT type="5103" id="2537" >
-<cdparam x="338" y="179" />
+<cdparam x="316" y="205" />
 <sizeparam width="51" height="20" minWidth="30" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4908,7 +4908,7 @@
 </COMPONENT>
 
 <COMPONENT type="5106" id="2578" >
-<cdparam x="337" y="257" />
+<cdparam x="362" y="300" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -4958,7 +4958,7 @@
 </COMPONENT>
 
 <COMPONENT type="5106" id="2619" >
-<cdparam x="338" y="120" />
+<cdparam x="298" y="88" />
 <sizeparam width="50" height="30" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
@@ -5008,7 +5008,7 @@
 </COMPONENT>
 
 <COMPONENT type="5100" id="2621" >
-<cdparam x="355" y="81" />
+<cdparam x="315" y="49" />
 <sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
 <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
diff --git a/src/graphminimize.txt b/src/graphminimize.txt
new file mode 100755
index 0000000000..4d9391cdb6
--- /dev/null
+++ b/src/graphminimize.txt
@@ -0,0 +1,2 @@
+Main-Class: GraphShow
+Class-Path: ./gs-core-1.3.jar ./gs-ui-1.3.jar
diff --git a/src/ui/graph/AUTGraph.java b/src/ui/graph/AUTGraph.java
index 6eaa128f4c..78ada9570d 100755
--- a/src/ui/graph/AUTGraph.java
+++ b/src/ui/graph/AUTGraph.java
@@ -86,10 +86,10 @@ public class AUTGraph implements myutil.Graph {
     }
 
     public AUTGraph(ArrayList<AUTState> _st, ArrayList<AUTTransition> _tr) {
-	states = _st;
-	transitions = _tr;
-	nbState = states.size();
-	statesComputed = true;
+        states = _st;
+        transitions = _tr;
+        nbState = states.size();
+        statesComputed = true;
     }
 
     public void stopBuildGraph() {
@@ -290,16 +290,16 @@ public class AUTGraph implements myutil.Graph {
     }
 
     public boolean hasEntryTransition(int state) {
-	if (hasEntryTransition == null) {
-	    computeEntryExitTransitions();
-	}
+        if (hasEntryTransition == null) {
+            computeEntryExitTransitions();
+        }
         return hasEntryTransition[state];
     }
 
     public boolean hasExitTransition(int state) {
-	if (hasExitTransition == null) {
-	    computeEntryExitTransitions();
-	}
+        if (hasExitTransition == null) {
+            computeEntryExitTransitions();
+        }
         return hasExitTransition[state];
     }
 
@@ -380,16 +380,16 @@ public class AUTGraph implements myutil.Graph {
 
 
     public String toFullString() {
-	StringBuffer graph = new StringBuffer("Transitions:");
-	for(AUTTransition aut1 : transitions) {
-	    graph.append(aut1.toString());
-	}
-	graph.append("\nstates:\n");
-	for(AUTState str: states) {
-	    graph.append(str.toString());
-	}
-	return graph.toString();
-	
+        StringBuffer graph = new StringBuffer("Transitions:");
+        for(AUTTransition aut1 : transitions) {
+            graph.append(aut1.toString());
+        }
+        graph.append("\nstates:\n");
+        for(AUTState str: states) {
+            graph.append(str.toString());
+        }
+        return graph.toString();
+
     }
 
     public void computeStates() {
@@ -418,9 +418,9 @@ public class AUTGraph implements myutil.Graph {
     }
 
     public void setStates(ArrayList<AUTState> _states) {
-	states = _states;
-	nbState = states.size();
-	statesComputed = true;
+        states = _states;
+        nbState = states.size();
+        statesComputed = true;
     }
 
     public HashSet<String> getAllActions() {
@@ -468,9 +468,9 @@ public class AUTGraph implements myutil.Graph {
     }
 
     public void display() {
-	display(false);
+        display(false);
     }
-    
+
     public void display(boolean exitOnClose) {
         AUTGraphDisplay display = new AUTGraphDisplay(this, exitOnClose);
         display.display();
@@ -489,7 +489,7 @@ public class AUTGraph implements myutil.Graph {
     }
 
 
-    public void minimizeRemoveInternal() {
+    public void minimizeRemoveInternal(boolean tauOnly) {
         String s = "tau";
 
         // mark all transitions as non tau
@@ -507,11 +507,11 @@ public class AUTGraph implements myutil.Graph {
 
         }
 
-        minimizeTau();
+        minimizeTau(tauOnly);
     }
 
 
-    public void minimize(String [] tauTransitions) {
+    public void minimize(String [] tauTransitions, boolean tauOnly) {
         String s = "tau";
 
         // mark all transitions as non tau
@@ -529,34 +529,37 @@ public class AUTGraph implements myutil.Graph {
             }
         }
 
-        minimizeTau();
+        minimizeTau(tauOnly);
 
     }
 
-    public void minimizeTau() {
+    public void minimizeTau(boolean tauOnly) {
         boolean modif = true;
 
-	//TraceManager.addDev(toFullString());
-	
-	factorizeNonTauTransitions();
+        //TraceManager.addDev(toFullString());
+
+        factorizeNonTauTransitions();
+
+        if (tauOnly) {
+            return;
+        }
+
 
-	
         /*while(modif) {
-            modif = removeOnlyOneTauTr();
-            if (! modif) {
-                modif = removeMultipleTauOutputTr();
-                if (! modif) {
-                    modif = removeTauWithOneFollower();
-                    if (! modif) {
-                        modif = removeSimilarTransitions();
-                    }
-                }
-            }
-	    }*/
+          modif = removeOnlyOneTauTr();
+          if (! modif) {
+          modif = removeMultipleTauOutputTr();
+          if (! modif) {
+          modif = removeTauWithOneFollower();
+          if (! modif) {
+          modif = removeSimilarTransitions();
+          }
+          }
+          }
+          }*/
+
+        partitionGraph();
 
-	partitionGraph();
-	
-        statesComputed = false;
     }
 
     // Remove transition going from one state with only one tau transition as output
@@ -701,7 +704,7 @@ public class AUTGraph implements myutil.Graph {
 
         return modif;
     }
-    
+
 
     private boolean removeSimilarTransitions() {
         boolean modif = false;
@@ -709,8 +712,8 @@ public class AUTGraph implements myutil.Graph {
         // Remove tr if it is duplicated
         for(AUTState st: states) {
 
-	    // May modify the outTransitions list, and result in exception.
-	    // The try .. catch clause protects from this
+            // May modify the outTransitions list, and result in exception.
+            // The try .. catch clause protects from this
             try {
                 if (st.outTransitions.size() > 1) {
                     for(int i=0; i<st.outTransitions.size(); i++) {
@@ -741,30 +744,30 @@ public class AUTGraph implements myutil.Graph {
 
     private void removeStates(ArrayList<AUTState> toRemoveStates) {
 
-	if (toRemoveStates.size() > 0) {
-	    hasExitTransition = null;
-	    hasEntryTransition = null;
-	}
-	
+        if (toRemoveStates.size() > 0) {
+            hasExitTransition = null;
+            hasEntryTransition = null;
+        }
+
         // Remove all states and adapt the id in the graph
-	//TraceManager.addDev("nbState=" + nbState + " states size = " + states.size());
-	
+        //TraceManager.addDev("nbState=" + nbState + " states size = " + states.size());
+
         for(AUTState str: toRemoveStates) {
-	    // We need to remove all transitions of the removed state
-	    //TraceManager.addDev("Removing transitions of state:" + str.id + "\n" + toFullString());
-	    for(AUTTransition trin: str.inTransitions) {
-		transitions.remove(trin);
-	    }
-	    for(AUTTransition trout: str.outTransitions) {
-		transitions.remove(trout);
-	    }
-
-	    for(AUTState state: states) {
-		state.removeAllTransitionsWithId(str.id);
-	    }
-
-	    //TraceManager.addDev("Done removing transitions of state:" + str.id + "\n" + toFullString());
-	    
+            // We need to remove all transitions of the removed state
+            //TraceManager.addDev("Removing transitions of state:" + str.id + "\n" + toFullString());
+            for(AUTTransition trin: str.inTransitions) {
+                transitions.remove(trin);
+            }
+            for(AUTTransition trout: str.outTransitions) {
+                transitions.remove(trout);
+            }
+
+            for(AUTState state: states) {
+                state.removeAllTransitionsWithId(str.id);
+            }
+
+            //TraceManager.addDev("Done removing transitions of state:" + str.id + "\n" + toFullString());
+
             // Last state of the array?
             if (str.id == (nbState - 1)) {
                 //TraceManager.addDev("Last state " + str.id);
@@ -773,165 +776,195 @@ public class AUTGraph implements myutil.Graph {
 
                 // str not at the end: we replace it with the last state
                 // We need to accordingly update
-            } else {
+            }  else  {
 
                 AUTState moved = states.get(nbState-1);
                 //TraceManager.addDev("Moving state " + moved.id +  " to index " + str.id);
                 states.set(str.id, moved);
                 states.remove(nbState-1);
                 nbState --;
-		//TraceManager.addDev("nbState=" + nbState + " states size = " + states.size());
-		/*AUTTransition tt = findTransitionWithId(nbState);
-		if (tt != null) {
-                    TraceManager.addDev("1) Transition with id not normal" + tt);
-		    }*/
-		//TraceManager.addDev("Update id\n" + toAUTStringFormat());
-		moved.updateID(str.id);
+                //TraceManager.addDev("nbState=" + nbState + " states size = " + states.size());
+                /*AUTTransition tt = findTransitionWithId(nbState);
+                  if (tt != null) {
+                  TraceManager.addDev("1) Transition with id not normal" + tt);
+                  }*/
+                //TraceManager.addDev("Update id\n" + toAUTStringFormat());
+                moved.updateID(str.id);
                 /*tt = findTransitionWithId(nbState);
-                if (tt != null) {
-                    TraceManager.addDev("2) Transition with id not normal" + tt);
-		    }*/
+                  if (tt != null) {
+                  TraceManager.addDev("2) Transition with id not normal" + tt);
+                  }*/
             }
-	    //TraceManager.addDev(toFullString());
 
         }
     }
 
     // Removes all tau transition of a state, replacing them with reachable non tau transitions
-    // A tau transition reaching a end state cannot be removed but can be replaced with a unique transition
+    // A tau transition reaching an end state cannot be removed but can be replaced with a unique transition
     private void factorizeNonTauTransitions() {
-	boolean modif = false;
-	boolean endState = false;
-	// met is used to specify states that have a tau-path to a termination state
-	for(AUTState st1: states) {
-	    st1.met = false;
-	}
-	
+        boolean modif = false;
+        boolean endState = false;
+        // met is used to specify states that have a tau-path to a termination state
+        for(AUTState st1: states) {
+            st1.met = false;
+        }
+
+        for (AUTState st: states) {
+            if ((st.id == 0) || (st.getNbInTransitions() > 0)) {
+                //TraceManager.addDev("  1. state " + st.id);
+                if (st.hasOutputTauTransition()) {
+                    //TraceManager.addDev("  2. state " + st.id);
+                    LinkedList<AUTTransition> nonTauTransitions = new LinkedList<AUTTransition>();
+                    boolean canReachAnEndStateWithTau = getAllNonTauTransitionsFrom(st, nonTauTransitions);
+
+                    //TraceManager.addDev("State " + st.id + " has the following real transitions:");
+                    /*for(AUTTransition tr: nonTauTransitions) {
+                      TraceManager.addDev("\t" + tr);
+                      }*/
+
+		    //TraceManager.addDev("State " + st.id + " can reach an end state with tau tr only?" + canReachAnEndStateWithTau);
+                    st.met = canReachAnEndStateWithTau;
+                    endState = endState || canReachAnEndStateWithTau;
+                }
+            }
+        }
+
         // Remove tr if it is duplicated
         for(AUTState st: states) {
-	    // We ignore states with no input tr apart from the start state (id 0)
-	    //TraceManager.addDev("0. state " + st.id);
-	    if ((st.id == 0) || (st.getNbInTransitions() > 0)) {
-		//TraceManager.addDev("  1. state " + st.id);
-		if (st.hasOutputTauTransition()) {
-		    //TraceManager.addDev("  2. state " + st.id);
-		    LinkedList<AUTTransition> nonTauTransitions = new LinkedList<AUTTransition>();
-		    boolean canReachAnEndStateWithTau = getAllNonTauTransitionsFrom(st, nonTauTransitions);
-
-		    //TraceManager.addDev("State " + st.id + " has the following real transitions:");
-		    /*for(AUTTransition tr: nonTauTransitions) {
-			TraceManager.addDev("\t" + tr);
-			}*/
-		    
-		    st.met = canReachAnEndStateWithTau;
-		    endState = endState || canReachAnEndStateWithTau;
-		    
-		    // Create these transitions in st if not yet existing
-		    //TraceManager.addDev("Remove tau\n" + toFullString());
-		    st.removeAllOutTauTransitions(transitions, states);
-		    //TraceManager.addDev("Done remove tau. create trans\n" + toFullString());
-		    st.createTransitionsButNotDuplicate(nonTauTransitions, states, transitions);
-		    //TraceManager.addDev("Done create trans\n" + toFullString());
-		}
-	    }
-	}
-
-	// If end state: we must create a new end state, and all "met" states should have a tau transition
-	// to this state
-	if (endState) {
-	    int newId = states.size();
-	    AUTState endSt = new AUTState(newId);
-	    states.add(endSt);
-	    nbState = states.size();
-	    for(AUTState st: states) {
-		if (st.met) {
-		    AUTTransition tr = new AUTTransition(st.id, "tau", endSt.id);
-		    tr.isTau = true;
-		    transitions.add(tr);
-		    st.addOutTransition(tr);
-		    endSt.addInTransition(tr);
-		}
-		st.met = false;
-	    }
-	}
-	//TraceManager.addDev(toFullString());
-
-	// Remove all non reachable state
-	removeAllNonReachableStates();
-
-
-	// Print graph in AUT
-	//TraceManager.addDev(toAUTStringFormat());
-
-	
+            // We ignore states with no input tr apart from the start state (id 0)
+            //TraceManager.addDev("0. state " + st.id);
+            if ((st.id == 0) || (st.getNbInTransitions() > 0)) {
+                //TraceManager.addDev("  1. state " + st.id);
+                if (st.hasOutputTauTransition()) {
+                    //TraceManager.addDev("  2. state " + st.id);
+                    LinkedList<AUTTransition> nonTauTransitions = new LinkedList<AUTTransition>();
+		     getAllNonTauTransitionsFrom(st, nonTauTransitions);
+
+                    // Create these transitions in st if not yet existing
+                    //TraceManager.addDev("Remove tau\n" + toFullString());
+                    st.removeAllOutTauTransitions(transitions, states);
+                    //TraceManager.addDev("Done remove tau. create trans\n" + toFullString());
+                    st.createTransitionsButNotDuplicate(nonTauTransitions, states, transitions);
+                    //TraceManager.addDev("Done create trans\n" + toFullString());
+                }
+            }
+        }
+
+        // Remove all non reachable state
+        //removeAllNonReachableStates();
+
+        // If end state: we must create a new end state, and all "met" states should have a tau transition
+        // to this state
+        if (endState) {
+            // We must see if at least one met state has output transitions
+            boolean hasEndState = false;
+            for(AUTState st: states) {
+                if (st.met) {
+                    if (st.outTransitions.size() > 0) {
+                        hasEndState = true;
+                        break;
+                    }
+
+                }
+            }
+            if (hasEndState) {
+                int newId = states.size();
+                AUTState endSt = new AUTState(newId);
+                states.add(endSt);
+                nbState = states.size();
+                for(AUTState st1: states) {
+                    if (st1.met) {
+                        if (st1.outTransitions.size() > 0) {
+			    TraceManager.addDev("Adding an end tau to state " + st1.id);
+                            AUTTransition tr = new AUTTransition(st1.id, "tau", endSt.id);
+                            tr.isTau = true;
+                            transitions.add(tr);
+                            st1.addOutTransition(tr);
+                            endSt.addInTransition(tr);
+                        }
+                    }
+                    st1.met = false;
+                }
+            }
+        }
+        //TraceManager.addDev(toFullString());
+
+        // Remove all non reachable state
+        removeAllNonReachableStates();
+
+
+        // Print graph in AUT
+        //TraceManager.addDev(toAUTStringFormat());
+
+
     }
 
     private boolean getAllNonTauTransitionsFrom(AUTState st, LinkedList<AUTTransition> nonTauTransitions) {
-	LinkedList<AUTState> metStates = new LinkedList<AUTState>();
-	//metStates.add(st);
+        LinkedList<AUTState> metStates = new LinkedList<AUTState>();
+        //metStates.add(st);
 
-	return getAllNonTauTransitionsIterative(st, metStates, nonTauTransitions);
-	//return getAllNonTauTransitionsRecursive(st, metStates, nonTauTransitions);
+        return getAllNonTauTransitionsIterative(st, metStates, nonTauTransitions);
+        //return getAllNonTauTransitionsRecursive(st, metStates, nonTauTransitions);
     }
 
 
     private boolean getAllNonTauTransitionsRecursive(AUTState st, LinkedList<AUTState> metStates, LinkedList<AUTTransition> nonTauTransitions) {
-	if (metStates.contains(st)) {
-	    return false;
-	}
-
-	if (st.getNbOutTransitions() == 0) {
-	    return true;
-	}
-
-	boolean ret = false;
-	for(AUTTransition at: st.outTransitions) {
-	    if (!(at.isTau)) {
-		nonTauTransitions.add(at);		
-	    } else {
-		ret = ret || getAllNonTauTransitionsRecursive(states.get(at.destination), metStates, nonTauTransitions);
-	    }
-	}
-	
-	return ret;
+        if (metStates.contains(st)) {
+            return false;
+        }
+
+        if (st.getNbOutTransitions() == 0) {
+            return true;
+        }
+
+        boolean ret = false;
+        for(AUTTransition at: st.outTransitions) {
+            if (!(at.isTau)) {
+                nonTauTransitions.add(at);
+            } else {
+                ret = ret || getAllNonTauTransitionsRecursive(states.get(at.destination), metStates, nonTauTransitions);
+            }
+        }
+
+        return ret;
     }
 
 
     private boolean getAllNonTauTransitionsIterative(AUTState _st, LinkedList<AUTState> metStates, LinkedList<AUTTransition> nonTauTransitions) {
 
-	boolean ret = false;
-	
-	LinkedList<AUTState> toExplore = new LinkedList<AUTState>();
-	LinkedList<AUTState> toExploreTmp = new LinkedList<AUTState>();
-	toExplore.add(_st);
-	
-	while (toExplore.size() > 0) {
-	    toExploreTmp.clear();
-	    for(AUTState st: toExplore) {
-		if (!(metStates.contains(st))) {
-		    metStates.add(st);
-		    if (st.getNbOutTransitions() == 0) {
-			ret = true;
-		    } else {
-			for(AUTTransition at: st.outTransitions) {
-			    if (!(at.isTau)) {
-				nonTauTransitions.add(at);		
-			    } else {
-				toExploreTmp.add(states.get(at.destination));
-			    }
-			}
-		    }
-		    
-		}
-	    } // for
-	    toExplore.clear();
-	    toExplore.addAll(toExploreTmp);
-	    
-	}// While
-
-	return ret;
+        boolean ret = false;
+
+        LinkedList<AUTState> toExplore = new LinkedList<AUTState>();
+        LinkedList<AUTState> toExploreTmp = new LinkedList<AUTState>();
+        toExplore.add(_st);
+
+        while (toExplore.size() > 0) {
+            toExploreTmp.clear();
+            for(AUTState st: toExplore) {
+                if (!(metStates.contains(st))) {
+                    metStates.add(st);
+                    if (st.getNbOutTransitions() == 0) {
+                        ret = true;
+                    } else {
+                        for(AUTTransition at: st.outTransitions) {
+                            if (!(at.isTau)) {
+                                nonTauTransitions.add(at);
+                            } else {
+                                toExploreTmp.add(states.get(at.destination));
+                            }
+                        }
+                    }
+
+                }
+            } // for
+            toExplore.clear();
+            toExplore.addAll(toExploreTmp);
+
+        }// While
+
+        return ret;
     }
-    
+
     private AUTTransition findTransitionWithId(int id) {
         for (AUTTransition tr: transitions) {
             if ((tr.origin == id) || (tr.destination == id)) {
@@ -943,364 +976,369 @@ public class AUTGraph implements myutil.Graph {
 
 
     private void removeAllNonReachableStates() {
-	// reset met of states
-	for(AUTState st1: states) {
-	    st1.met = false;
-	}
-
-	int cpt = 0;
-
-	LinkedList<AUTState> statesToConsider = new LinkedList<AUTState>();
-	LinkedList<AUTState> nextStatesToConsider = new LinkedList<AUTState>();
-	statesToConsider.add(states.get(0));
-
-	while(statesToConsider.size() > 0) {
-	    nextStatesToConsider.clear();
-	    for(AUTState st: statesToConsider) {
-		st.met = true;
-		cpt ++;
-		for(AUTTransition tr: st.outTransitions) {
-		    AUTState s = states.get(tr.destination);
-		    if (!(s.met)) {
-			nextStatesToConsider.add(s);
-		    }
-		}
-	    }
-	    statesToConsider.clear();
-	    statesToConsider.addAll(nextStatesToConsider);
-	}
-
-	//TraceManager.addDev("Found " + cpt + " reachable states");
-	ArrayList<AUTState> toRemoveStates = new ArrayList<AUTState>();
-	for(AUTState st2: states) {
-	    if (!(st2.met)) {
-		toRemoveStates.add(st2);
-		//TraceManager.addDev("Removing state: " + st2.id);
-	    }
-	}
-
-	removeStates(toRemoveStates);
-	
+        // reset met of states
+        for(AUTState st1: states) {
+            st1.met = false;
+        }
+
+        int cpt = 0;
+
+        LinkedList<AUTState> statesToConsider = new LinkedList<AUTState>();
+        LinkedList<AUTState> nextStatesToConsider = new LinkedList<AUTState>();
+        statesToConsider.add(states.get(0));
+
+        while(statesToConsider.size() > 0) {
+            nextStatesToConsider.clear();
+            for(AUTState st: statesToConsider) {
+                st.met = true;
+                cpt ++;
+                for(AUTTransition tr: st.outTransitions) {
+                    AUTState s = states.get(tr.destination);
+                    if (!(s.met)) {
+                        nextStatesToConsider.add(s);
+                    }
+                }
+            }
+            statesToConsider.clear();
+            statesToConsider.addAll(nextStatesToConsider);
+        }
+
+        TraceManager.addDev("Found " + cpt + " reachable states");
+        ArrayList<AUTState> toRemoveStates = new ArrayList<AUTState>();
+        for(AUTState st2: states) {
+            if (!(st2.met)) {
+                toRemoveStates.add(st2);
+                //TraceManager.addDev("Removing state: " + st2.id);
+            }
+        }
+
+        //TraceManager.addDev(toFullString());
+        removeStates(toRemoveStates);
+        //TraceManager.addDev(toFullString());
+
+        //statesComputed = false;
+        //states = null;
+        //computeStates();
+
     }
 
 
     private void computeEntryExitTransitions() {
-	hasExitTransition = new boolean[nbState];
+        hasExitTransition = new boolean[nbState];
         hasEntryTransition = new boolean[nbState];
 
-	for(AUTTransition t: transitions) {
-	    hasExitTransition[t.origin] = true;
-	    hasEntryTransition[t.destination] = true;
-	}
+        for(AUTTransition t: transitions) {
+            hasExitTransition[t.origin] = true;
+            hasEntryTransition[t.destination] = true;
+        }
     }
 
 
     public void partitionGraph() {
-	
-	// Create the alphabet
-	HashMap<String, AUTElement> alphabet = new HashMap<String, AUTElement>();
-	for(AUTTransition tr: transitions) {
-	    AUTElement tmp = alphabet.get(tr.transition);
-	    if (tmp == null) {
-		AUTElement elt = new AUTElement(tr.transition);
-		alphabet.put(tr.transition, elt);
-		tr.elt = elt;
-	    } else {
-		tr.elt = tmp;
-	    }
-	    //TraceManager.addDev("Transition "+ tr + " has element " + tr.elt);
-	}
-
-	List<AUTElement> sortedAlphabet = new ArrayList<AUTElement>(alphabet.values());
-	Collections.sort(sortedAlphabet);
-	
-	TraceManager.addDev("Alphabet size:" + alphabet.size());
-
-
-	Map<Integer, AUTBlock> allBlocks = Collections.synchronizedMap(new HashMap<Integer, AUTBlock>());
-	
-	// Create the first block that contains all states
-	AUTBlock b0 = new AUTBlock();
-	for(AUTState st: states) {
-	    b0.addState(st);
-	}
-	b0.computeHash();
-	allBlocks.put(new Integer(b0.hashValue), b0);
-
-	
-	AUTBlock b0Test = new AUTBlock();
-	for(AUTState st: states) {
-	    b0Test.addState(st);
-	}
-	b0Test.computeHash();
-
-	AUTBlock B0Ret = allBlocks.get(new Integer(b0Test.hashValue));
-	if (B0Ret == null) {
-	    TraceManager.addDev("ERROR: hash not working for blocks");
-	} else {
-	    TraceManager.addDev("Hash working for blocks");
-	}
-	
-	
-
-	// Create the first partition containing only block B0
-	AUTPartition partition = new AUTPartition();
-	partition.addBlock(b0);
-
-	// Create the splitter that contains partitions
-	
-	AUTPartition partitionForSplitter = new AUTPartition();
-	partitionForSplitter.addBlock(b0);
-	AUTSplitter w = new AUTSplitter();
-	w.addPartition(partitionForSplitter);
-
-	printConfiguration(partition, w);
-
-	int maxIte = 1000;
-
-	AUTPartition currentP;
-	while((w.size()>0) && (maxIte >0)) {
-	    maxIte --;
-	    currentP = w.partitions.get(0);
-	    w.partitions.remove(0);
-
-	    // Simple splitter?
-	    if (currentP.blocks.size() == 1) {
-		TraceManager.addDev("Simple splitter = " + currentP);
-		AUTBlock currentBlock = currentP.blocks.get(0);
-		//List<AUTElement> sortedAlphabet = new ArrayList<AUTElement>(alphabet.values());
-		//Collections.sort(sortedAlphabet);
-		for(AUTElement elt: sortedAlphabet) {
-		    TraceManager.addDev("\n*** Considering alphabet element = " + elt.value); 
-		    printConfiguration(partition, w);
-		    // Look for states of the leading to another state by a = T
-		    // Construct I = all blocks of P that have at least an element in T
-		    AUTBlock T_minus1_elt_B = currentBlock.getMinus1(elt, states);
-
-		    TraceManager.addDev("T_minus1_elt_B=" + T_minus1_elt_B);
-		    
-		    LinkedList<AUTBlock> I = partition.getI(elt, T_minus1_elt_B);
-		    printI(I);
-		    for(AUTBlock blockX: I) {
-			AUTBlock blockX1 = blockX.getStateIntersectWith(T_minus1_elt_B);
-			blockX1.computeHash();
-			AUTBlock blockX2 = blockX.getStateDifferenceWith(T_minus1_elt_B);
-			blockX2.computeHash();
-			TraceManager.addDev("X1=" + blockX1);
-			TraceManager.addDev("X2=" + blockX2);
-
-			if (blockX1.isEmpty() || blockX2.isEmpty()) {
-			    TraceManager.addDev("Nothing to do");
-			    // Nothing to do!
-			} else {
-			    boolean b = partition.removeBlock(blockX);
-			    if (!b) {
-				TraceManager.addDev("Block " + blockX + " could not be removed from partition");
-			    }
-			    partition.addBlock(blockX1);
-			    partition.addBlock(blockX2);
-			    AUTPartition X_X1_X2 = new AUTPartition();
-			    X_X1_X2.addBlock(blockX);
-			    X_X1_X2.addBlock(blockX1);
-			    X_X1_X2.addBlock(blockX2);
-			    TraceManager.addDev("Test concat X1+X2=" + AUTBlock.concat(blockX1, blockX2));
-			    w.addPartition( X_X1_X2);
-			    TraceManager.addDev("Modifying P and W:");
-			    printConfiguration(partition, w);
-			    TraceManager.addDev("-----------------\n");
-			}
-			
-		    }
-<<<<<<< Upstream, based on aa363fe017f226394c627b60189e75002e6b1199
-=======
-		    TraceManager.addDev("-----------------\n");
->>>>>>> d0df681 Update on algo management
-		    
-		}
-		
-	    }
-	    
-	    // Compound splitter
-	    else if (currentP.blocks.size() == 3){
-		TraceManager.addDev("Complexe splitter (b, bi, bii) =" + currentP);
-		AUTBlock b = currentP.blocks.get(0);
-		AUTBlock bi = currentP.blocks.get(1);
-		AUTBlock bii = currentP.blocks.get(2);
-
-		if (bi.size() > bii.size()) {
-		    bi = currentP.blocks.get(2);
-		    bii = currentP.blocks.get(1);
-		}
-
-		TraceManager.addDev("B= " + b +  " bi=" + bi + " bii=" + bii);
-
-		for(AUTElement elt: sortedAlphabet) {
-		    TraceManager.addDev("\n*** Considering alphabet element = " + elt.value);
-		    printConfiguration(partition, w);
-		    AUTBlock T_minus1_elt_B = b.getMinus1(elt, states);
-		    TraceManager.addDev("T_minus1_elt_B=" + T_minus1_elt_B);
-		    LinkedList<AUTBlock> I = partition.getI(elt, T_minus1_elt_B);
-		    printI(I);
-		    for(AUTBlock blockX: I) {
-			// Compute block X1 = set of states in blockX that goes to Bi, but not to Bii
-			// with current action
-			AUTBlock blockX1 = new AUTBlock();
-			
-			// Compute block X2 = set of states in blockX that goes to Bii, but not to Bi
-			// with current action
-			AUTBlock blockX2 = new AUTBlock();
-
-			// Compute block X3 = set of states in blockX that goes to both Bi and Bii
-			// with current action
-			boolean b1, b2;
-			AUTBlock blockX3 = new AUTBlock();
-			for(AUTState st: blockX.states) {
-			    b1 = blockX.leadsTo(bi, elt);
-			    b2 = blockX.leadsTo(bii, elt);
-			    if (b1 && !b2) {
-				blockX1.addState(st);
-			    } else if (!b1 && b2) {
-				blockX2.addState(st);
-			    } else {
-				blockX3.addState(st);
-			    }
-			}
-			TraceManager.addDev("Block X = " + blockX + " Block1,2,3 computed\n\tX1 = " + blockX1 + "\n\tX2 = " + blockX2 + "\n\tX3 = " + blockX3);
-			
-			if ((blockX.compareTo(blockX1) == 0) || (blockX.compareTo(blockX2) == 0) || (blockX.compareTo(blockX2) == 0)) {
-			    // do nothing
-			    TraceManager.addDev("Identical blocks! X");
-			}  else  {
-			    TraceManager.addDev("Non Identical blocks! X");
-			    // Modifying partition
-			    partition.removeBlock(blockX);
-			    partition.addIfNonEmpty(blockX1);
-			    partition.addIfNonEmpty(blockX2);
-			    partition.addIfNonEmpty(blockX3);
-
-
-			    // Add two splitter to W if all are non null
-			    if (!(blockX1.isEmpty()) && !(blockX2.isEmpty()) && !(blockX3.isEmpty())) {
-				// Add splitter (X, X1, X23) && (X23, X2, X3)
-				AUTPartition tmpP = new AUTPartition();
-				tmpP.addBlock(blockX);
-				tmpP.addBlock(blockX1);
-				tmpP.addBlock(AUTBlock.concat(blockX2, blockX3));
-				w.addPartition(tmpP);
-				tmpP = new AUTPartition();
-				tmpP.addBlock(AUTBlock.concat(blockX2, blockX3));
-				tmpP.addBlock(blockX2);
-				tmpP.addBlock(blockX3);
-				w.addPartition(tmpP);
-				
-				    
-			    } else {
-				// Add non empty individual block to W
-				AUTPartition tmpP;
-				if (!(blockX1.isEmpty())) {
-				    tmpP = new AUTPartition();
-				    tmpP.addBlock(blockX1);
-				    w.addPartition(tmpP);
-				}
-				if (!(blockX2.isEmpty())) {
-				    tmpP = new AUTPartition();
-				    tmpP.addBlock(blockX2);
-				    w.addPartition(tmpP);
-				}
-				if (!(blockX3.isEmpty())) {
-				    tmpP = new AUTPartition();
-				    tmpP.addBlock(blockX3);
-				    w.addPartition(tmpP);
-				}
-			    }
-			    
-			}
-		    }
-		    
-		}
-		
-	    }
-	}
-	
-	TraceManager.addDev("\nAll done:\n---------");
-	printConfiguration(partition, w);
-	TraceManager.addDev("------------------");
- 
-	// Generating new graph
-	generateGraph(partition, alphabet);
-	
+
+        // Create the alphabet
+        HashMap<String, AUTElement> alphabet = new HashMap<String, AUTElement>();
+        for(AUTTransition tr: transitions) {
+            AUTElement tmp = alphabet.get(tr.transition);
+            if (tmp == null) {
+                AUTElement elt = new AUTElement(tr.transition);
+                alphabet.put(tr.transition, elt);
+                tr.elt = elt;
+            } else {
+                tr.elt = tmp;
+            }
+            //TraceManager.addDev("Transition "+ tr + " has element " + tr.elt);
+        }
+
+        List<AUTElement> sortedAlphabet = new ArrayList<AUTElement>(alphabet.values());
+        Collections.sort(sortedAlphabet);
+
+        TraceManager.addDev("Alphabet size:" + alphabet.size());
+
+
+        Map<Integer, AUTBlock> allBlocks = Collections.synchronizedMap(new HashMap<Integer, AUTBlock>());
+
+        // Create the first block that contains all states
+        AUTBlock b0 = new AUTBlock();
+        for(AUTState st: states) {
+            b0.addState(st);
+        }
+        b0.computeHash();
+        allBlocks.put(new Integer(b0.hashValue), b0);
+
+
+        AUTBlock b0Test = new AUTBlock();
+        for(AUTState st: states) {
+            b0Test.addState(st);
+        }
+        b0Test.computeHash();
+
+        AUTBlock B0Ret = allBlocks.get(new Integer(b0Test.hashValue));
+        if (B0Ret == null) {
+            TraceManager.addDev("ERROR: hash not working for blocks");
+        } else {
+            TraceManager.addDev("Hash working for blocks");
+        }
+
+
+
+        // Create the first partition containing only block B0
+        AUTPartition partition = new AUTPartition();
+        partition.addBlock(b0);
+
+        // Create the splitter that contains partitions
+
+        AUTPartition partitionForSplitter = new AUTPartition();
+        partitionForSplitter.addBlock(b0);
+        AUTSplitter w = new AUTSplitter();
+        w.addPartition(partitionForSplitter);
+
+        printConfiguration(partition, w);
+
+        int maxIte = 1000;
+
+        AUTPartition currentP;
+        while((w.size()>0) && (maxIte >0)) {
+            maxIte --;
+            currentP = w.partitions.get(0);
+            w.partitions.remove(0);
+
+            // Simple splitter?
+            if (currentP.blocks.size() == 1) {
+                TraceManager.addDev("Simple splitter = " + currentP);
+                AUTBlock currentBlock = currentP.blocks.get(0);
+                //List<AUTElement> sortedAlphabet = new ArrayList<AUTElement>(alphabet.values());
+                //Collections.sort(sortedAlphabet);
+                for(AUTElement elt: sortedAlphabet) {
+                    TraceManager.addDev("\n*** Considering alphabet element = " + elt.value);
+                    printConfiguration(partition, w);
+                    // Look for states of the leading to another state by a = T
+                    // Construct I = all blocks of P that have at least an element in T
+                    AUTBlock T_minus1_elt_B = currentBlock.getMinus1(elt, states);
+
+                    TraceManager.addDev("T_minus1_elt_B=" + T_minus1_elt_B);
+
+                    LinkedList<AUTBlock> I = partition.getI(elt, T_minus1_elt_B);
+                    printI(I);
+                    for(AUTBlock blockX: I) {
+                        AUTBlock blockX1 = blockX.getStateIntersectWith(T_minus1_elt_B);
+                        blockX1.computeHash();
+                        AUTBlock blockX2 = blockX.getStateDifferenceWith(T_minus1_elt_B);
+                        blockX2.computeHash();
+                        TraceManager.addDev("X1=" + blockX1);
+                        TraceManager.addDev("X2=" + blockX2);
+
+                        if (blockX1.isEmpty() || blockX2.isEmpty()) {
+                            TraceManager.addDev("Nothing to do");
+                            // Nothing to do!
+                        } else {
+                            boolean b = partition.removeBlock(blockX);
+                            if (!b) {
+                                TraceManager.addDev("Block " + blockX + " could not be removed from partition");
+                            }
+                            partition.addBlock(blockX1);
+                            partition.addBlock(blockX2);
+                            AUTPartition X_X1_X2 = new AUTPartition();
+                            X_X1_X2.addBlock(blockX);
+                            X_X1_X2.addBlock(blockX1);
+                            X_X1_X2.addBlock(blockX2);
+                            TraceManager.addDev("Test concat X1+X2=" + AUTBlock.concat(blockX1, blockX2));
+                            w.addPartition( X_X1_X2);
+                            TraceManager.addDev("Modifying P and W:");
+                            printConfiguration(partition, w);
+                            TraceManager.addDev("-----------------\n");
+                        }
+
+                    }
+                    TraceManager.addDev("-----------------\n");
+
+                }
+
+            }
+
+            // Compound splitter
+            else if (currentP.blocks.size() == 3){
+                TraceManager.addDev("Complexe splitter (b, bi, bii) =" + currentP);
+                AUTBlock b = currentP.blocks.get(0);
+                AUTBlock bi = currentP.blocks.get(1);
+                AUTBlock bii = currentP.blocks.get(2);
+
+                if (bi.size() > bii.size()) {
+                    bi = currentP.blocks.get(2);
+                    bii = currentP.blocks.get(1);
+                }
+
+                TraceManager.addDev("B= " + b +  " bi=" + bi + " bii=" + bii);
+
+                for(AUTElement elt: sortedAlphabet) {
+                    TraceManager.addDev("\n*** Considering alphabet element = " + elt.value);
+                    printConfiguration(partition, w);
+                    AUTBlock T_minus1_elt_B = b.getMinus1(elt, states);
+                    TraceManager.addDev("T_minus1_elt_B=" + T_minus1_elt_B);
+                    LinkedList<AUTBlock> I = partition.getI(elt, T_minus1_elt_B);
+                    printI(I);
+                    for(AUTBlock blockX: I) {
+                        // Compute block X1 = set of states in blockX that goes to Bi, but not to Bii
+                        // with current action
+                        AUTBlock blockX1 = new AUTBlock();
+
+                        // Compute block X2 = set of states in blockX that goes to Bii, but not to Bi
+                        // with current action
+                        AUTBlock blockX2 = new AUTBlock();
+
+                        // Compute block X3 = set of states in blockX that goes to both Bi and Bii
+                        // with current action
+                        boolean b1, b2;
+                        AUTBlock blockX3 = new AUTBlock();
+                        for(AUTState st: blockX.states) {
+                            b1 = blockX.leadsTo(bi, elt);
+                            b2 = blockX.leadsTo(bii, elt);
+                            if (b1 && !b2) {
+                                blockX1.addState(st);
+                            } else if (!b1 && b2) {
+                                blockX2.addState(st);
+                            } else {
+                                blockX3.addState(st);
+                            }
+                        }
+                        TraceManager.addDev("Block X = " + blockX + " Block1,2,3 computed\n\tX1 = " + blockX1 + "\n\tX2 = " + blockX2 + "\n\tX3 = " + blockX3);
+
+                        if ((blockX.compareTo(blockX1) == 0) || (blockX.compareTo(blockX2) == 0) || (blockX.compareTo(blockX2) == 0)) {
+                            // do nothing
+                            TraceManager.addDev("Identical blocks! X");
+                        }  else  {
+                            TraceManager.addDev("Non Identical blocks! X");
+                            // Modifying partition
+                            partition.removeBlock(blockX);
+                            partition.addIfNonEmpty(blockX1);
+                            partition.addIfNonEmpty(blockX2);
+                            partition.addIfNonEmpty(blockX3);
+
+
+                            // Add two splitter to W if all are non null
+                            if (!(blockX1.isEmpty()) && !(blockX2.isEmpty()) && !(blockX3.isEmpty())) {
+                                // Add splitter (X, X1, X23) && (X23, X2, X3)
+                                AUTPartition tmpP = new AUTPartition();
+                                tmpP.addBlock(blockX);
+                                tmpP.addBlock(blockX1);
+                                tmpP.addBlock(AUTBlock.concat(blockX2, blockX3));
+                                w.addPartition(tmpP);
+                                tmpP = new AUTPartition();
+                                tmpP.addBlock(AUTBlock.concat(blockX2, blockX3));
+                                tmpP.addBlock(blockX2);
+                                tmpP.addBlock(blockX3);
+                                w.addPartition(tmpP);
+
+
+                            } else {
+                                // Add non empty individual block to W
+                                AUTPartition tmpP;
+                                if (!(blockX1.isEmpty())) {
+                                    tmpP = new AUTPartition();
+                                    tmpP.addBlock(blockX1);
+                                    w.addPartition(tmpP);
+                                }
+                                if (!(blockX2.isEmpty())) {
+                                    tmpP = new AUTPartition();
+                                    tmpP.addBlock(blockX2);
+                                    w.addPartition(tmpP);
+                                }
+                                if (!(blockX3.isEmpty())) {
+                                    tmpP = new AUTPartition();
+                                    tmpP.addBlock(blockX3);
+                                    w.addPartition(tmpP);
+                                }
+                            }
+
+                        }
+                    }
+
+                }
+
+            }
+        }
+
+        TraceManager.addDev("\nAll done:\n---------");
+        printConfiguration(partition, w);
+        TraceManager.addDev("------------------");
+
+        // Generating new graph
+        generateGraph(partition, alphabet);
+
     }
 
     // Assumes AUTElement have been added to transitions
-    public AUTGraph generateGraph(AUTPartition partition, HashMap<String, AUTElement> _alphabet) {
-	ArrayList<AUTState> sts = new ArrayList<AUTState>();
-	ArrayList<AUTTransition> trs = new ArrayList<AUTTransition>();
-	HashMap<AUTBlock, AUTState> blockToNewStates = new HashMap<AUTBlock, AUTState>();
-	
-	int stID = 1;
-	// We create one state per block
-	// We look to the block that contains state 0 and we create the state id = 0
-	for(AUTBlock bl: partition.blocks) {
-	    if (bl.hasState(0)) {
-		AUTState st0 = new AUTState(0);
-		blockToNewStates.put(bl, st0);
-		sts.add(0, st0);
-	    } else {
-		AUTState st = new AUTState(stID);
-		stID ++;
-		blockToNewStates.put(bl, st);
-		sts.add(st);
-	    }
-	}
-
-	// We now need to create the transitions
-	// We parse all states in blocks, and consider their transition
-	// We look for the destination and create a transition accordingly
-	for(AUTBlock bl: partition.blocks) {
-	    AUTState newOrigin =  blockToNewStates.get(bl);
-	    for(AUTState src: bl.states) {
-		for(AUTTransition tr: src.outTransitions) {
-		    AUTState newDestination = blockToNewStates.get(partition.getBlockWithState(tr.destination));
-
-		    boolean foundSimilar = false;
-		    AUTTransition newT = new AUTTransition(newOrigin.id, tr.transition, newDestination.id);
-		    newT.elt = tr.elt;
-		    for(AUTTransition testT: trs) {
-			if (testT.compareTo(newT) == 0) {
-			    foundSimilar = true;
-			    break;
-			}
-		    }
-		    if (!foundSimilar) {
-			trs.add(newT);
-			newOrigin.outTransitions.add(newT);
-			newDestination.inTransitions.add(newT);
-		    }
-		}
-	    }
-	}
-       	
-	AUTGraph newGraph = new AUTGraph(sts, trs);
-	TraceManager.addDev("New graph: " + newGraph.toFullString());
-	return newGraph;
-	
+    public void generateGraph(AUTPartition partition, HashMap<String, AUTElement> _alphabet) {
+        ArrayList<AUTState> sts = new ArrayList<AUTState>();
+        ArrayList<AUTTransition> trs = new ArrayList<AUTTransition>();
+        HashMap<AUTBlock, AUTState> blockToNewStates = new HashMap<AUTBlock, AUTState>();
+
+        int stID = 1;
+        // We create one state per block
+        // We look to the block that contains state 0 and we create the state id = 0
+        for(AUTBlock bl: partition.blocks) {
+            if (bl.hasState(0)) {
+                AUTState st0 = new AUTState(0);
+                blockToNewStates.put(bl, st0);
+                sts.add(0, st0);
+            } else {
+                AUTState st = new AUTState(stID);
+                stID ++;
+                blockToNewStates.put(bl, st);
+                sts.add(st);
+            }
+        }
+
+        // We now need to create the transitions
+        // We parse all states in blocks, and consider their transition
+        // We look for the destination and create a transition accordingly
+        for(AUTBlock bl: partition.blocks) {
+            AUTState newOrigin =  blockToNewStates.get(bl);
+            for(AUTState src: bl.states) {
+                for(AUTTransition tr: src.outTransitions) {
+                    AUTState newDestination = blockToNewStates.get(partition.getBlockWithState(tr.destination));
+
+                    boolean foundSimilar = false;
+                    AUTTransition newT = new AUTTransition(newOrigin.id, tr.transition, newDestination.id);
+                    newT.elt = tr.elt;
+                    for(AUTTransition testT: trs) {
+                        if (testT.compareTo(newT) == 0) {
+                            foundSimilar = true;
+                            break;
+                        }
+                    }
+                    if (!foundSimilar) {
+                        trs.add(newT);
+                        newOrigin.outTransitions.add(newT);
+                        newDestination.inTransitions.add(newT);
+                    }
+                }
+            }
+        }
+
+        states = sts;
+        transitions = trs;
+        nbState = sts.size();
+
+        TraceManager.addDev("New graph: " + toFullString());
+
     }
-    
+
 
     private void printConfiguration(AUTPartition _part, AUTSplitter _w) {
-	TraceManager.addDev("P={" + _part.toString() + "}");
-	TraceManager.addDev("W={" + _w.toString() + "}");
+        TraceManager.addDev("P={" + _part.toString() + "}");
+        TraceManager.addDev("W={" + _w.toString() + "}");
     }
 
     private void printI(LinkedList<AUTBlock> I) {
-	StringBuffer sb = new StringBuffer("I:");
-	for(AUTBlock b: I) {
-	    sb.append(" " + b);
-	}
-	TraceManager.addDev(sb.toString());
-	
+        StringBuffer sb = new StringBuffer("I:");
+        for(AUTBlock b: I) {
+            sb.append(" " + b);
+        }
+        TraceManager.addDev(sb.toString());
+
     }
-    
+
 
 
 
diff --git a/src/ui/graph/AUTState.java b/src/ui/graph/AUTState.java
index aa89be6482..77f6b7570f 100755
--- a/src/ui/graph/AUTState.java
+++ b/src/ui/graph/AUTState.java
@@ -178,7 +178,7 @@ public class AUTState implements Comparable<AUTState> {
 	ArrayList<AUTTransition> outTransitions2 = new ArrayList<AUTTransition>();
 	for(AUTTransition tr: outTransitions) {
 	    if (!(tr.isTau)) {
-		outTransitions.add(tr);
+		outTransitions2.add(tr);
 	    } else {
 		_transitions.remove(tr);
 		_states.get(tr.destination).removeInTransition(tr);
@@ -215,6 +215,7 @@ public class AUTState implements Comparable<AUTState> {
 	    outTransitions.remove(tr);
 	}
 	toBeRemoved.clear();
+	
 	for(AUTTransition tr: inTransitions) {
 	    if (tr.origin == id) {
 		toBeRemoved.add(tr);
diff --git a/src/ui/window/JFrameMinimize.java b/src/ui/window/JFrameMinimize.java
index 2471a7398f..41dbd97908 100755
--- a/src/ui/window/JFrameMinimize.java
+++ b/src/ui/window/JFrameMinimize.java
@@ -93,7 +93,8 @@ public class JFrameMinimize extends javax.swing.JFrame implements ActionListener
     protected JTextArea jta;
     
     private JCheckBox removeInternalActions;
-
+    private JRadioButton tauOnly;
+    private JRadioButton allMinimization;
     
     
     // Main Panel
@@ -168,7 +169,14 @@ public class JFrameMinimize extends javax.swing.JFrame implements ActionListener
         panel4.setBorder(new javax.swing.border.TitledBorder("Minimization: tools and options"));
         removeInternalActions = new JCheckBox("Remove internal actions");
         removeInternalActions.setEnabled(true);
-        
+	tauOnly = new JRadioButton("Only remove tau transitions");
+	tauOnly.setEnabled(true);
+	allMinimization = new JRadioButton("Complete minimization [Experimental]");
+	allMinimization.setEnabled(true);
+	ButtonGroup bt = new ButtonGroup();
+	bt.add(tauOnly);
+	bt.add(allMinimization);
+	allMinimization.setSelected(true);
 
         //c4.anchor = GridBagConstraints.EAST;
         c4.weighty = 1.0;
@@ -177,6 +185,8 @@ public class JFrameMinimize extends javax.swing.JFrame implements ActionListener
         c4.fill = GridBagConstraints.HORIZONTAL;
         c4.gridheight = 1;
         panel4.add(removeInternalActions, c4);
+	panel4.add(tauOnly, c4);
+	panel4.add(allMinimization, c4);
 
         panelTop.add(panel4, BorderLayout.SOUTH);
         
@@ -365,7 +375,7 @@ public class JFrameMinimize extends javax.swing.JFrame implements ActionListener
                 listProjected.setEnabled(true);
                 listIgnored.setEnabled(true);
                 setButtonsList();
-                start.setEnabled(sortedListIgnored.size() > 0);
+                start.setEnabled(true);
                 stop.setEnabled(false);
                 close.setEnabled(true);
                 getGlassPane().setVisible(false);
@@ -508,7 +518,31 @@ public class JFrameMinimize extends javax.swing.JFrame implements ActionListener
 	jta.append("\nMinimizing graph...\n");
 	String[] strarray = new String[sortedListIgnored.size()];
 	sortedListIgnored.toArray(strarray );
-	newRG.graph.minimize(strarray);
+	if (removeInternalActions.isSelected()) {
+	    int toBeRemoved = 0;
+	    for(String s: sortedListProjected) {
+		if (s.startsWith("i(")) {
+		    toBeRemoved ++;
+		}
+	    }
+	    if (toBeRemoved > 0) {
+		String[] allstr = new String[strarray.length + toBeRemoved];
+		for(int i=0; i<strarray.length; i++) {
+		    allstr[i] = strarray[i];
+		}
+		int index = strarray.length;
+		for(String s: sortedListProjected) {
+		    if (s.startsWith("i(")) {
+			allstr[index] = s;
+			index++;
+		    }
+		    
+		}
+		strarray = allstr;
+		
+	    }
+	}
+	newRG.graph.minimize(strarray, tauOnly.isSelected());
 	newRG.nbOfStates = newRG.graph.getNbOfStates();
 	newRG.nbOfTransitions = newRG.graph.getTransitions().size();
 	mgui.addRG(newRG);
-- 
GitLab