From 4ce3679890218af3377295811e5943cd30f5c379 Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Mon, 16 Feb 2015 12:21:10 +0000
Subject: [PATCH] Update on TMLCPLib management

---
 src/tmltranslator/TMLCPLib.java         |   88 ++
 src/tmltranslator/TMLCPLibArtifact.java |   70 ++
 src/tmltranslator/TMLMapping.java       | 1178 ++++++++++++-----------
 src/ui/tmldd/TMLArchiPortArtifact.java  |  378 ++++----
 4 files changed, 937 insertions(+), 777 deletions(-)
 create mode 100755 src/tmltranslator/TMLCPLib.java
 create mode 100755 src/tmltranslator/TMLCPLibArtifact.java

diff --git a/src/tmltranslator/TMLCPLib.java b/src/tmltranslator/TMLCPLib.java
new file mode 100755
index 0000000000..734a32b25d
--- /dev/null
+++ b/src/tmltranslator/TMLCPLib.java
@@ -0,0 +1,88 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici
+
+   ludovic.apvrille AT telecom-paristech.fr
+   andrea.enrici AT telecom-paristech.fr
+
+   This software is a computer program whose purpose is to allow the
+   edition of TURTLE analysis, design and deployment diagrams, to
+   allow the generation of RT-LOTOS or Java code from this diagram,
+   and at last to allow the analysis of formal validation traces
+   obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+   from INRIA Rhone-Alpes.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+
+   /**
+   * Class TMLCPLib: data structure for librairies of TMLCP
+   * Creation: 16/02/2015
+   * @version 1.0 16/01/2015
+   * @author Ludovic APVRILLE
+   * @see
+   */
+
+package tmltranslator;
+
+import java.util.*;
+import myutil.*;
+
+public class TMLCPLib extends TMLElement {
+
+    private ArrayList<TMLCPLibArtifact> artifacts;
+    private Vector<String> mappedUnits = new Vector<String>();
+
+
+    public TMLCPLib( String _name, Object _referenceObject ) {
+        super( _name, _referenceObject );
+        init();
+    }
+
+    public TMLCPLib() {
+        super( "DefaultCP", null );     //no reference to any object in the default constructor
+        init();
+    }
+
+    private void setMappedUnits(Vector<String> _mappedUnits) {
+	mappedUnits = _mappedUnits;
+    }
+
+    private void init() {
+	artifacts = new  ArrayList<TMLCPLibArtifact>();
+    }
+
+    public void addArtifact(TMLCPLibArtifact _arti) {
+	artifacts.add(_arti);
+    }
+
+    public ArrayList<TMLCPLibArtifact> getArtifacts() {
+	return artifacts;
+    }
+
+    public Vector<String> getMappedUnits() {
+	return mappedUnits;
+    }
+
+}       //End of the class
diff --git a/src/tmltranslator/TMLCPLibArtifact.java b/src/tmltranslator/TMLCPLibArtifact.java
new file mode 100755
index 0000000000..820e355d26
--- /dev/null
+++ b/src/tmltranslator/TMLCPLibArtifact.java
@@ -0,0 +1,70 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici
+
+   ludovic.apvrille AT telecom-paristech.fr
+   andrea.enrici AT telecom-paristech.fr
+
+   This software is a computer program whose purpose is to allow the
+   edition of TURTLE analysis, design and deployment diagrams, to
+   allow the generation of RT-LOTOS or Java code from this diagram,
+   and at last to allow the analysis of formal validation traces
+   obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+   from INRIA Rhone-Alpes.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+
+   /**
+   * Class TMLCPLibArtifact: Artifact mapped on a TMLCPLib
+   * Creation: 16/02/2015
+   * @version 1.0 16/02/2015
+   * @author Ludovic APVRILLE
+   * @see
+   */
+
+package tmltranslator;
+
+import java.util.*;
+import tmltranslator.tmlcp.*;
+import myutil.*;
+
+public class TMLCPLibArtifact extends TMLElement {
+    public String taskName;
+    public String portName;
+    public String memoryName;
+
+    public TMLCPLibArtifact(String _name, Object _referenceObject, String _taskName, String _portName, String _memoryName) {
+        super( _name, _referenceObject );
+        taskName = _taskName;
+	portName = _portName;
+	memoryName = _memoryName;
+    }
+
+    public TMLCPLibArtifact() {
+        super( "DefaultCP", null );     //no reference to any object in the default constructor
+    }
+
+ 
+}       //End of the class
diff --git a/src/tmltranslator/TMLMapping.java b/src/tmltranslator/TMLMapping.java
index a5d6e1ee9f..15e2eaa2d0 100755
--- a/src/tmltranslator/TMLMapping.java
+++ b/src/tmltranslator/TMLMapping.java
@@ -1,48 +1,48 @@
 /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici
 
-ludovic.apvrille AT telecom-paristech.fr
-andrea.enrici AT telecom-paristech.fr
-
-This software is a computer program whose purpose is to allow the 
-edition of TURTLE analysis, design and deployment diagrams, to 
-allow the generation of RT-LOTOS or Java code from this diagram, 
-and at last to allow the analysis of formal validation traces 
-obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
-from INRIA Rhone-Alpes.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-
-/**
- * Class TMLMapping
- * Creation: 05/09/2007
- * @version 1.1 10/06/2014
- * @author Ludovic APVRILLE, Andrea ENRICI
- * @see
- */
+   ludovic.apvrille AT telecom-paristech.fr
+   andrea.enrici AT telecom-paristech.fr
+
+   This software is a computer program whose purpose is to allow the
+   edition of TURTLE analysis, design and deployment diagrams, to
+   allow the generation of RT-LOTOS or Java code from this diagram,
+   and at last to allow the analysis of formal validation traces
+   obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+   from INRIA Rhone-Alpes.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+
+   /**
+   * Class TMLMapping
+   * Creation: 05/09/2007
+   * @version 1.1 10/06/2014
+   * @author Ludovic APVRILLE, Andrea ENRICI
+   * @see
+   */
 
 package tmltranslator;
 
@@ -51,549 +51,551 @@ import java.util.*;
 
 public class TMLMapping {
 
-	private TMLModeling tmlm;
-  private TMLArchitecture tmla;
-	private TMLCP tmlcp;
-
-	private ArrayList<HwExecutionNode> onnodes;
-	private ArrayList<TMLTask> mappedtasks;
-	private ArrayList<HwCommunicationNode> oncommnodes;
-	private ArrayList<TMLElement> mappedcommelts;
-	
-	private ArrayList<TMLCP> mappedCPs;
-	private ArrayList<TMLElement> commEltsMappedOnCPs;
-	
-	
-	private boolean optimized = false;
-	
-	private int hashCode;
-	private boolean hashCodeComputed = false;
-    
-  public TMLMapping(TMLModeling _tmlm, TMLArchitecture _tmla, boolean reset) {
-  	
-		tmlm = _tmlm;
-		tmla = _tmla;
-		init();
-		
-		if( reset ) {
-			DIPLOElement.resetID();
-		}
-	}
-
-  public TMLMapping( TMLModeling _tmlm, TMLArchitecture _tmla, TMLCP _tmlcp, boolean reset ) {
-  	
-		tmlm = _tmlm;
-		tmla = _tmla;
-		tmlcp = _tmlcp;
-		init();
-		
-		if( reset ) {
-			DIPLOElement.resetID();
-		}
-	}
-	
-	public void makeMinimumMapping() {
-		HwCPU cpu;
-		HwMemory mem;
-		HwBus bus;
-		HwLink link0, link1;
-		TMLTask t;
-		TMLChannel ch;
-		ListIterator iterator;
-		int cpt;
-		
-		if (tmla == null) {
-			tmla = new TMLArchitecture();
-		}
-		
-		if (!tmla.hasCPU()) {
-			cpu = new HwCPU("defaultCPU");
-			cpu.byteDataSize = 4;
-			cpu.pipelineSize = 1;
-			cpu.goIdleTime = 0;
-			cpu.taskSwitchingTime = 1;
-			cpu.branchingPredictionPenalty = 0;
-			cpu.execiTime = 1;
-			tmla.addHwNode(cpu);
-			
-			// tasks
-			iterator = tmlm.getTasks().listIterator();
-			while(iterator.hasNext()) {
-				t = (TMLTask)(iterator.next());
-				addTaskToHwExecutionNode(t, cpu);
-			}
-		}
-		
-
-		
-		if (!tmla.hasBus()) {
-			bus = new HwBus("defaultBus");
-			tmla.addHwNode(bus);
-			// Connect all possible nodes to that bus
-			cpt = 0;
-			for(HwNode node: tmla.getHwNodes()) {
-				link0 = new HwLink("to_bus_" + cpt);
-				cpt ++;
-				link0.bus = bus;
-				link0.hwnode = node;
-				tmla.addHwLink(link0);
-			}
-			
-			// Add all channels on that bus
-			iterator = tmlm.getChannels().listIterator();
-			while(iterator.hasNext()) {
-				ch = (TMLChannel)(iterator.next());
-				addCommToHwCommNode(ch, bus);
-			}
-		} else {
-			mapAllChannelsOnBus();
-		}
-		
-		// Is there a memory?
-		/*if (!tmla.hasMemory()) {
-			mem = new HwMemory("defaultMemory");
-			tmla.addHwNode(mem);
-			
-			// Connect this memory to al buses
-			
-			
-			iterator = tmlm.getChannels().listIterator();
-			
-			while(iterator.hasNext()) {
-				ch = (TMLChannel)(iterator.next());
-				addCommToHwCommNode(ch, mem);
-			}
-		} else {
-			mapAllChannelsOnMemory();
-		}*/
-	}
-	
-	// If only one bus -> map all channels on it;
-	private void mapAllChannelsOnBus() {
-		// Check if only one bus
-		if (getNbOfBusses() != 1) {
-			return;
-		}
-		
-		HwBus bus = tmla.getFirstBus();
-		
-		int index;
-		boolean mapped;
-		for(TMLChannel cha: tmlm.getChannels()) {
-			index = 0;
-			mapped = false;
-			for(TMLElement el: mappedcommelts) {
-				if (el == cha) {
-					if (oncommnodes.get(index) instanceof HwBus) {
-						mapped = true;
-						break;
-					}
-				}
-				index ++;
-			}
-			if (!mapped) {
-				addCommToHwCommNode(cha, bus);
-			}
-		}
-	}
-	
-	// If only one memory -> map all channels on it;
-	private void mapAllChannelsOnMemory() {
-		// Check if only one bus
-		if (getNbOfMemories() != 1) {
-			return;
-		}
-		
-		HwMemory mem = tmla.getFirstMemory();
-		
-		int index;
-		boolean mapped;
-		for(TMLChannel cha: tmlm.getChannels()) {
-			index = 0;
-			mapped = false;
-			for(TMLElement el: mappedcommelts) {
-				if (el == cha) {
-					if (oncommnodes.get(index) instanceof HwMemory) {
-						mapped = true;
-						break;
-					}
-				}
-				index ++;
-			}
-			if (!mapped) {
-				addCommToHwCommNode(cha, mem);
-			}
-		}
-	}
-	
-	public int getNbOfBusses() {
-		if (tmla == null) {
-			return 0;
-		}
-		return tmla.getNbOfBusses();
-	}
-	
-	public int getNbOfMemories() {
-		if (tmla == null) {
-			return 0;
-		}
-		return tmla.getNbOfMemories();
-	}
-	
-	private void init() {
-
-		mappedtasks = new ArrayList<TMLTask>();
-		onnodes = new ArrayList<HwExecutionNode>();
-		oncommnodes = new ArrayList<HwCommunicationNode>();
-		mappedcommelts = new ArrayList<TMLElement>();
-		mappedCPs = new ArrayList<TMLCP>();
-		commEltsMappedOnCPs = new ArrayList<TMLElement>();
-	}
-	
-	public TMLTask getTMLTaskByCommandID(int id) {
-		if (tmlm == null) {
-			return null;
-		}
-		
-		return tmlm.getTMLTaskByCommandID(id);
-	}
-	
-	public String[] getTasksIDs() {
-		if (tmlm == null) {
-			return null;
-		}
-		
-		return tmlm.getTasksIDs();
-	}
-	
-	public String[] getChanIDs() {
-		if (tmlm == null) {
-			return null;
-		}
-		
-		return tmlm.getChanIDs();
-	}
-	
-	public String[] getCPUIDs() {
-		if (tmla == null) {
-			return null;
-		}
-		
-		return tmla.getCPUIDs();
-	}
-	
-	public String[] getCPUandHwAIDs() {
-		if (tmla == null) {
-			return null;
-		}
-		
-		return tmla.getCPUandHwAIDs();
-	}
-	
-	
-	public String[] getBusIDs() {
-		if (tmla == null) {
-			return null;
-		}
-		
-		return tmla.getBusIDs();
-	}
-	
-	public String[] getMemIDs() {
-		if (tmla == null) {
-			return null;
-		}
-		
-		return tmla.getMemIDs();
-	}
-	
-	public String[] makeCommandIDs(int index) {
-		if (tmlm == null) {
-			return null;
-		}
-		
-		return tmlm.makeCommandIDs(index);
-	}
-	
-	public String[] makeVariableIDs(int index) {
-		if (tmlm == null) {
-			return null;
-		}
-		
-		return tmlm.makeVariableIDs(index);
-	}
-	
-	
-	
-	public void addTaskToHwExecutionNode(TMLTask _task, HwExecutionNode _hwnode) {
-		onnodes.add(_hwnode);
-		mappedtasks.add(_task);
-	}
-	
-	public void addCommToHwCommNode(TMLElement _elt, HwCommunicationNode _hwcommnode) {
-		oncommnodes.add(_hwcommnode);
-		mappedcommelts.add(_elt);
-	}
-	
-	public TMLModeling getTMLModeling() {
-		return tmlm;
-	}
-	public TMLArchitecture getTMLArchitecture() {
-		return tmla;
-	}
-	
-	private void computeHashCode() {
-		hashCode = tmlm.getHashCode() + tmla.getHashCode();
-		TMLMappingTextSpecification tmaptxt = new TMLMappingTextSpecification("spec.tmap");
-		hashCode += tmaptxt.toTextFormat(this).hashCode();
-	}
-	
-	public int getHashCode() {
-		if (!hashCodeComputed) {
-			computeHashCode();
-			hashCodeComputed = true;
-		}
-		return hashCode;
-	}
-	
-	public ArrayList<HwExecutionNode> getNodes(){
-		return onnodes;
-	}
-	
-	public ArrayList<TMLTask> getMappedTasks(){
-		return mappedtasks;
-	}
-	
-	public ArrayList<HwCommunicationNode> getCommunicationNodes(){
-		return oncommnodes;
-	}
-	
-	public ArrayList<TMLElement> getMappedCommunicationElement(){
-		return mappedcommelts;
-	}
-	
-	
-	public TMLTask getTaskByName(String _name) {
-		return tmlm.getTMLTaskByName(_name);
-	}
-	
-	public TMLChannel getChannelByName(String _name) {
-		TMLElement tmle = tmlm.getCommunicationElementByName(_name);
-		if (tmle instanceof TMLChannel) {
-			return (TMLChannel)tmle;
-		}
-		return null;
-	}
-	
-	public HwExecutionNode getHwExecutionNodeByName(String _name) {
-		HwNode node = tmla.getHwNodeByName(_name);
-		if (node instanceof HwExecutionNode) {
-			return (HwExecutionNode)(node);
-		}
-		return null;
-	}
-	
-	public HwCommunicationNode getHwCommunicationNodeByName(String _name) {
-		HwNode node = tmla.getHwNodeByName(_name);
-		if (node instanceof HwCommunicationNode) {
-			return (HwCommunicationNode)(node);
-		}
-		return null;
-	}
-	
-	public TMLElement getCommunicationElementByName(String _name) {
-		return tmlm.getCommunicationElementByName(_name);
-	}
-	
-	public boolean isTaskMapped(TMLTask _task) {
-		return (mappedtasks.contains(_task));
-	}
-	
-	public HwNode getHwNodeOf(TMLTask _task) {
-		int index = mappedtasks.indexOf(_task);
-		if (index == -1) {
-			return null;
-		}
-		
-		return onnodes.get(index);
-	}
-	
-	public boolean isAUsedHwNode(HwNode _node) {
-		return (onnodes.contains(_node));
-	}
-	
-	public boolean isTaskMappedOn(TMLTask _task, HwNode _node) {
-		 for(int i=0; i<onnodes.size(); i++) {
-			 if (onnodes.get(i) == _node) {
-				 if (mappedtasks.get(i) == _task) {
-					 return true;
-				 }
-			 }
-		 }
-		 return false;
-	}
-
-	public boolean isCommNodeMappedOn(TMLElement _channel, HwCommunicationNode _node) {
-		 for(int i=0; i<oncommnodes.size(); i++) {
-			 if ((_node==null || oncommnodes.get(i) == _node) && mappedcommelts.get(i) == _channel) return true;
-		 }
-		 return false;
-	}
-	
-	public boolean oneTaskMappedOn(TMLRequest _request, HwNode _node) {
-		TMLTask task;
-		ListIterator iterator = _request.getOriginTasks().listIterator();
-		while(iterator.hasNext()) {
-			task = (TMLTask)(iterator.next());
-			if (isTaskMappedOn(task, _node)) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	public HwBus getFirstHwBusOf(TMLElement _tmle) {
-		int index = mappedcommelts.indexOf(_tmle);
-		if (index == -1) {
-			return null;
-		}
-		
-		index = 0;
-		for(HwCommunicationNode node: oncommnodes) {
-			if (node instanceof HwBus) {
-				if (mappedcommelts.get(index) == _tmle) {
-					return (HwBus)node;
-				}
-			}
-			index ++;
-		}
-		
-		return null;
-		
-	}
-	
-	public int getMaxClockRatio() {
-		int ret = 1;
-		for(HwCommunicationNode node: oncommnodes) {
-			ret = Math.max(node.clockRatio, ret);
-		}
-		
-		for(HwExecutionNode node1: onnodes) {
-			ret = Math.max(node1.clockRatio, ret);
-		}
-		
-		return ret;
-	}
-	
-	public ArrayList<TMLError> optimize() {
-		ArrayList<TMLError> list = new ArrayList<TMLError>();
-		if (!optimized) {
-			optimized = true;
-			list.addAll(tmlm.optimize());
-		}
-		return list;
-	}
-
-	public LinkedList<HwCommunicationNode> findNodesForElement(TMLElement _elementToFind){
-		LinkedList<HwCommunicationNode> list = new LinkedList<HwCommunicationNode>();
-		int index=0;
-		for(TMLElement tmlelem: mappedcommelts) {
-			if (tmlelem == _elementToFind) list.add(oncommnodes.get(index));
-			index++;
-		}
-		return list;
-	}
-
-	public HwNode getHwNodeByTask(TMLTask cmpTask){
-		int i=0;
-		for(TMLTask task: mappedtasks) {
-			 if (task==cmpTask) break; else i++;
-		}
-		return onnodes.get(i);
-	}
-	
-	public void removeAllRandomSequences() {
-		if (tmlm != null) {
-			tmlm.removeAllRandomSequences();
-		}
-	}
-	
-	public ArrayList<String> getSummaryTaskMapping() {
-		StringBuffer sb = new StringBuffer("");
-		ArrayList<String> list = new ArrayList<String>();
-		int cpt = 0;
-		int found = 0;
-		
-		for (HwNode node: tmla.getHwNodes()) {
-			if (node instanceof HwCPU) {
-				sb.append(node.getName() + "(");
-				found = 0;
-				cpt = 0;
-				for(HwExecutionNode ex: onnodes) {
-					if (ex == node) {
-						if (found > 0) {
-							sb.append(", ");
-						}
-						found = 1;
-						sb.append(mappedtasks.get(cpt).getName());
-					}
-					cpt ++;
-				}
-				sb.append(") ");
-				list.add( sb.toString() );
-				sb = new StringBuffer("");
-			}
-		}
-		
-		return list;
-		
-	}
-
-	public ArrayList<String> getSummaryCPMapping() {
-		ArrayList<String> list = new ArrayList<String>();
-		return list;
-	}
-
-	public ArrayList<String> getSummaryCommMapping() {
-		StringBuffer sb = new StringBuffer("");
-		ArrayList<String> list = new ArrayList<String>();
-		int cpt = 0;
-		int found = 0;
-		
-		for (HwNode node: tmla.getHwNodes()) {
-			if (node instanceof HwCommunicationNode) {
-				sb.append(node.getName() + "(");
-				found = 0;
-				cpt = 0;
-				for(HwCommunicationNode ex: oncommnodes) {
-					if (ex == node) {
-						if (found > 0) {
-							sb.append(", ");
-						}
-						found = 1;
-						sb.append(mappedcommelts.get(cpt).getName());
-					}
-					cpt ++;
-				}
-				sb.append(") ");
-				list.add( sb.toString() );
-				sb = new StringBuffer("");
-			}
-		}
-		
-		return list;
-		
-	}
-	
-	public TMLMapping cloneMappingArchitecture() {
-		return null;
-	}
-	
-	public int getArchitectureComplexity() {
-		if (tmla == null) {
-			return 0;
-		}
-		
-		return tmla.getArchitectureComplexity();
-	}
+    private TMLModeling tmlm;
+    private TMLArchitecture tmla;
+    private TMLCP tmlcp;
+
+    private ArrayList<HwExecutionNode> onnodes;
+    private ArrayList<TMLTask> mappedtasks;
+    private ArrayList<HwCommunicationNode> oncommnodes;
+    private ArrayList<TMLElement> mappedcommelts;
+
+    private ArrayList<TMLCP> mappedCPs;
+    private ArrayList<TMLElement> commEltsMappedOnCPs;
+
+    private ArrayList<TMLCPLib> mappedCPLibs;
+
+
+    private boolean optimized = false;
+
+    private int hashCode;
+    private boolean hashCodeComputed = false;
+
+    public TMLMapping(TMLModeling _tmlm, TMLArchitecture _tmla, boolean reset) {
+
+        tmlm = _tmlm;
+        tmla = _tmla;
+        init();
+
+        if( reset ) {
+            DIPLOElement.resetID();
+        }
+    }
+
+    public TMLMapping( TMLModeling _tmlm, TMLArchitecture _tmla, TMLCP _tmlcp, boolean reset ) {
+
+        tmlm = _tmlm;
+        tmla = _tmla;
+        tmlcp = _tmlcp;
+        init();
+
+        if( reset ) {
+            DIPLOElement.resetID();
+        }
+    }
+
+    public void makeMinimumMapping() {
+        HwCPU cpu;
+        HwMemory mem;
+        HwBus bus;
+        HwLink link0, link1;
+        TMLTask t;
+        TMLChannel ch;
+        ListIterator iterator;
+        int cpt;
+
+        if (tmla == null) {
+            tmla = new TMLArchitecture();
+        }
+
+        if (!tmla.hasCPU()) {
+            cpu = new HwCPU("defaultCPU");
+            cpu.byteDataSize = 4;
+            cpu.pipelineSize = 1;
+            cpu.goIdleTime = 0;
+            cpu.taskSwitchingTime = 1;
+            cpu.branchingPredictionPenalty = 0;
+            cpu.execiTime = 1;
+            tmla.addHwNode(cpu);
+
+            // tasks
+            iterator = tmlm.getTasks().listIterator();
+            while(iterator.hasNext()) {
+                t = (TMLTask)(iterator.next());
+                addTaskToHwExecutionNode(t, cpu);
+            }
+        }
+
+
+
+        if (!tmla.hasBus()) {
+            bus = new HwBus("defaultBus");
+            tmla.addHwNode(bus);
+            // Connect all possible nodes to that bus
+            cpt = 0;
+            for(HwNode node: tmla.getHwNodes()) {
+                link0 = new HwLink("to_bus_" + cpt);
+                cpt ++;
+                link0.bus = bus;
+                link0.hwnode = node;
+                tmla.addHwLink(link0);
+            }
+
+            // Add all channels on that bus
+            iterator = tmlm.getChannels().listIterator();
+            while(iterator.hasNext()) {
+                ch = (TMLChannel)(iterator.next());
+                addCommToHwCommNode(ch, bus);
+            }
+        } else {
+            mapAllChannelsOnBus();
+        }
+
+        // Is there a memory?
+        /*if (!tmla.hasMemory()) {
+          mem = new HwMemory("defaultMemory");
+          tmla.addHwNode(mem);
+
+          // Connect this memory to al buses
+
+
+          iterator = tmlm.getChannels().listIterator();
+
+          while(iterator.hasNext()) {
+          ch = (TMLChannel)(iterator.next());
+          addCommToHwCommNode(ch, mem);
+          }
+          } else {
+          mapAllChannelsOnMemory();
+          }*/
+    }
+
+    // If only one bus -> map all channels on it;
+    private void mapAllChannelsOnBus() {
+        // Check if only one bus
+        if (getNbOfBusses() != 1) {
+            return;
+        }
+
+        HwBus bus = tmla.getFirstBus();
+
+        int index;
+        boolean mapped;
+        for(TMLChannel cha: tmlm.getChannels()) {
+            index = 0;
+            mapped = false;
+            for(TMLElement el: mappedcommelts) {
+                if (el == cha) {
+                    if (oncommnodes.get(index) instanceof HwBus) {
+                        mapped = true;
+                        break;
+                    }
+                }
+                index ++;
+            }
+            if (!mapped) {
+                addCommToHwCommNode(cha, bus);
+            }
+        }
+    }
+
+    // If only one memory -> map all channels on it;
+    private void mapAllChannelsOnMemory() {
+        // Check if only one bus
+        if (getNbOfMemories() != 1) {
+            return;
+        }
+
+        HwMemory mem = tmla.getFirstMemory();
+
+        int index;
+        boolean mapped;
+        for(TMLChannel cha: tmlm.getChannels()) {
+            index = 0;
+            mapped = false;
+            for(TMLElement el: mappedcommelts) {
+                if (el == cha) {
+                    if (oncommnodes.get(index) instanceof HwMemory) {
+                        mapped = true;
+                        break;
+                    }
+                }
+                index ++;
+            }
+            if (!mapped) {
+                addCommToHwCommNode(cha, mem);
+            }
+        }
+    }
+
+    public int getNbOfBusses() {
+        if (tmla == null) {
+            return 0;
+        }
+        return tmla.getNbOfBusses();
+    }
+
+    public int getNbOfMemories() {
+        if (tmla == null) {
+            return 0;
+        }
+        return tmla.getNbOfMemories();
+    }
+
+    private void init() {
+        mappedtasks = new ArrayList<TMLTask>();
+        onnodes = new ArrayList<HwExecutionNode>();
+        oncommnodes = new ArrayList<HwCommunicationNode>();
+        mappedcommelts = new ArrayList<TMLElement>();
+        mappedCPs = new ArrayList<TMLCP>();
+        commEltsMappedOnCPs = new ArrayList<TMLElement>();
+	mappedCPLibs = new ArrayList<TMLCPLib>();
+    }
+
+    public TMLTask getTMLTaskByCommandID(int id) {
+        if (tmlm == null) {
+            return null;
+        }
+
+        return tmlm.getTMLTaskByCommandID(id);
+    }
+
+    public String[] getTasksIDs() {
+        if (tmlm == null) {
+            return null;
+        }
+
+        return tmlm.getTasksIDs();
+    }
+
+    public String[] getChanIDs() {
+        if (tmlm == null) {
+            return null;
+        }
+
+        return tmlm.getChanIDs();
+    }
+
+    public String[] getCPUIDs() {
+        if (tmla == null) {
+            return null;
+        }
+
+        return tmla.getCPUIDs();
+    }
+
+    public String[] getCPUandHwAIDs() {
+        if (tmla == null) {
+            return null;
+        }
+
+        return tmla.getCPUandHwAIDs();
+    }
+
+
+    public String[] getBusIDs() {
+        if (tmla == null) {
+            return null;
+        }
+
+        return tmla.getBusIDs();
+    }
+
+    public String[] getMemIDs() {
+        if (tmla == null) {
+            return null;
+        }
+
+        return tmla.getMemIDs();
+    }
+
+    public String[] makeCommandIDs(int index) {
+        if (tmlm == null) {
+            return null;
+        }
+
+        return tmlm.makeCommandIDs(index);
+    }
+
+    public String[] makeVariableIDs(int index) {
+        if (tmlm == null) {
+            return null;
+        }
+
+        return tmlm.makeVariableIDs(index);
+    }
+
+
+
+    public void addTaskToHwExecutionNode(TMLTask _task, HwExecutionNode _hwnode) {
+        onnodes.add(_hwnode);
+        mappedtasks.add(_task);
+    }
+
+    public void addCommToHwCommNode(TMLElement _elt, HwCommunicationNode _hwcommnode) {
+        oncommnodes.add(_hwcommnode);
+        mappedcommelts.add(_elt);
+    }
+
+    public TMLModeling getTMLModeling() {
+        return tmlm;
+    }
+    public TMLArchitecture getTMLArchitecture() {
+        return tmla;
+    }
+
+    private void computeHashCode() {
+        hashCode = tmlm.getHashCode() + tmla.getHashCode();
+        TMLMappingTextSpecification tmaptxt = new TMLMappingTextSpecification("spec.tmap");
+        hashCode += tmaptxt.toTextFormat(this).hashCode();
+    }
+
+    public int getHashCode() {
+        if (!hashCodeComputed) {
+            computeHashCode();
+            hashCodeComputed = true;
+        }
+        return hashCode;
+    }
+
+    public ArrayList<HwExecutionNode> getNodes(){
+        return onnodes;
+    }
+
+    public ArrayList<TMLTask> getMappedTasks(){
+        return mappedtasks;
+    }
+
+    public ArrayList<HwCommunicationNode> getCommunicationNodes(){
+        return oncommnodes;
+    }
+
+    public ArrayList<TMLElement> getMappedCommunicationElement(){
+        return mappedcommelts;
+    }
+
+
+    public TMLTask getTaskByName(String _name) {
+        return tmlm.getTMLTaskByName(_name);
+    }
+
+    public TMLChannel getChannelByName(String _name) {
+        TMLElement tmle = tmlm.getCommunicationElementByName(_name);
+        if (tmle instanceof TMLChannel) {
+            return (TMLChannel)tmle;
+        }
+        return null;
+    }
+
+    public HwExecutionNode getHwExecutionNodeByName(String _name) {
+        HwNode node = tmla.getHwNodeByName(_name);
+        if (node instanceof HwExecutionNode) {
+            return (HwExecutionNode)(node);
+        }
+        return null;
+    }
+
+    public HwCommunicationNode getHwCommunicationNodeByName(String _name) {
+        HwNode node = tmla.getHwNodeByName(_name);
+        if (node instanceof HwCommunicationNode) {
+            return (HwCommunicationNode)(node);
+        }
+        return null;
+    }
+
+    public TMLElement getCommunicationElementByName(String _name) {
+        return tmlm.getCommunicationElementByName(_name);
+    }
+
+    public boolean isTaskMapped(TMLTask _task) {
+        return (mappedtasks.contains(_task));
+    }
+
+    public HwNode getHwNodeOf(TMLTask _task) {
+        int index = mappedtasks.indexOf(_task);
+        if (index == -1) {
+            return null;
+        }
+
+        return onnodes.get(index);
+    }
+
+    public boolean isAUsedHwNode(HwNode _node) {
+        return (onnodes.contains(_node));
+    }
+
+    public boolean isTaskMappedOn(TMLTask _task, HwNode _node) {
+        for(int i=0; i<onnodes.size(); i++) {
+            if (onnodes.get(i) == _node) {
+                if (mappedtasks.get(i) == _task) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public boolean isCommNodeMappedOn(TMLElement _channel, HwCommunicationNode _node) {
+        for(int i=0; i<oncommnodes.size(); i++) {
+            if ((_node==null || oncommnodes.get(i) == _node) && mappedcommelts.get(i) == _channel) return true;
+        }
+        return false;
+    }
+
+    public boolean oneTaskMappedOn(TMLRequest _request, HwNode _node) {
+        TMLTask task;
+        ListIterator iterator = _request.getOriginTasks().listIterator();
+        while(iterator.hasNext()) {
+            task = (TMLTask)(iterator.next());
+            if (isTaskMappedOn(task, _node)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public HwBus getFirstHwBusOf(TMLElement _tmle) {
+        int index = mappedcommelts.indexOf(_tmle);
+        if (index == -1) {
+            return null;
+        }
+
+        index = 0;
+        for(HwCommunicationNode node: oncommnodes) {
+            if (node instanceof HwBus) {
+                if (mappedcommelts.get(index) == _tmle) {
+                    return (HwBus)node;
+                }
+            }
+            index ++;
+        }
+
+        return null;
+
+    }
+
+    public int getMaxClockRatio() {
+        int ret = 1;
+        for(HwCommunicationNode node: oncommnodes) {
+            ret = Math.max(node.clockRatio, ret);
+        }
+
+        for(HwExecutionNode node1: onnodes) {
+            ret = Math.max(node1.clockRatio, ret);
+        }
+
+        return ret;
+    }
+
+    public ArrayList<TMLError> optimize() {
+        ArrayList<TMLError> list = new ArrayList<TMLError>();
+        if (!optimized) {
+            optimized = true;
+            list.addAll(tmlm.optimize());
+        }
+        return list;
+    }
+
+    public LinkedList<HwCommunicationNode> findNodesForElement(TMLElement _elementToFind){
+        LinkedList<HwCommunicationNode> list = new LinkedList<HwCommunicationNode>();
+        int index=0;
+        for(TMLElement tmlelem: mappedcommelts) {
+            if (tmlelem == _elementToFind) list.add(oncommnodes.get(index));
+            index++;
+        }
+        return list;
+    }
+
+    public HwNode getHwNodeByTask(TMLTask cmpTask){
+        int i=0;
+        for(TMLTask task: mappedtasks) {
+            if (task==cmpTask) break; else i++;
+        }
+        return onnodes.get(i);
+    }
+
+    public void removeAllRandomSequences() {
+        if (tmlm != null) {
+            tmlm.removeAllRandomSequences();
+        }
+    }
+
+    public ArrayList<String> getSummaryTaskMapping() {
+        StringBuffer sb = new StringBuffer("");
+        ArrayList<String> list = new ArrayList<String>();
+        int cpt = 0;
+        int found = 0;
+
+        for (HwNode node: tmla.getHwNodes()) {
+            if (node instanceof HwCPU) {
+                sb.append(node.getName() + "(");
+                found = 0;
+                cpt = 0;
+                for(HwExecutionNode ex: onnodes) {
+                    if (ex == node) {
+                        if (found > 0) {
+                            sb.append(", ");
+                        }
+                        found = 1;
+                        sb.append(mappedtasks.get(cpt).getName());
+                    }
+                    cpt ++;
+                }
+                sb.append(") ");
+                list.add( sb.toString() );
+                sb = new StringBuffer("");
+            }
+        }
+
+        return list;
+
+    }
+
+    public ArrayList<String> getSummaryCPMapping() {
+        ArrayList<String> list = new ArrayList<String>();
+        return list;
+    }
+
+    public ArrayList<String> getSummaryCommMapping() {
+        StringBuffer sb = new StringBuffer("");
+        ArrayList<String> list = new ArrayList<String>();
+        int cpt = 0;
+        int found = 0;
+
+        for (HwNode node: tmla.getHwNodes()) {
+            if (node instanceof HwCommunicationNode) {
+                sb.append(node.getName() + "(");
+                found = 0;
+                cpt = 0;
+                for(HwCommunicationNode ex: oncommnodes) {
+                    if (ex == node) {
+                        if (found > 0) {
+                            sb.append(", ");
+                        }
+                        found = 1;
+                        sb.append(mappedcommelts.get(cpt).getName());
+                    }
+                    cpt ++;
+                }
+                sb.append(") ");
+                list.add( sb.toString() );
+                sb = new StringBuffer("");
+            }
+        }
+
+        return list;
+
+    }
+
+    public TMLMapping cloneMappingArchitecture() {
+        return null;
+    }
+
+    public int getArchitectureComplexity() {
+        if (tmla == null) {
+            return 0;
+        }
+
+        return tmla.getArchitectureComplexity();
+    }
 }
diff --git a/src/ui/tmldd/TMLArchiPortArtifact.java b/src/ui/tmldd/TMLArchiPortArtifact.java
index c536f57670..695394dfe0 100644
--- a/src/ui/tmldd/TMLArchiPortArtifact.java
+++ b/src/ui/tmldd/TMLArchiPortArtifact.java
@@ -1,48 +1,48 @@
 /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
 
-ludovic.apvrille AT enst.fr
-
-This software is a computer program whose purpose is to allow the 
-edition of TURTLE analysis, design and deployment diagrams, to 
-allow the generation of RT-LOTOS or Java code from this diagram, 
-and at last to allow the analysis of formal validation traces 
-obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
-from INRIA Rhone-Alpes.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-
-/**
- * Class TMLArchiPortArtifact
- * Communication Artifact of a deployment diagram
- * Creation: 22/11/2007
- * @version 1.0 22/11/2007
- * @author Ludovic APVRILLE
- * @see
- */
+   ludovic.apvrille AT enst.fr
+
+   This software is a computer program whose purpose is to allow the
+   edition of TURTLE analysis, design and deployment diagrams, to
+   allow the generation of RT-LOTOS or Java code from this diagram,
+   and at last to allow the analysis of formal validation traces
+   obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+   from INRIA Rhone-Alpes.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+
+   /**
+   * Class TMLArchiPortArtifact
+   * Communication Artifact of a deployment diagram
+   * Creation: 22/11/2007
+   * @version 1.0 22/11/2007
+   * @author Ludovic APVRILLE
+   * @see
+   */
 
 package ui.tmldd;
 
@@ -65,57 +65,57 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
     protected int fileX = 20;
     protected int fileY = 25;
     protected int cran = 5;
-		protected String mappedMemory = "VOID";
+    protected String mappedMemory = "VOID";
     protected String oldValue = "";
     protected String referenceCommunicationName = "TMLCommunication";
-	protected String portName = "name";
-	protected String typeName = "port";
-	protected String startAddress = "";
-	protected String endAddress = "";
-	protected int priority = 5; // Between 0 and 10
-    
+    protected String portName = "name";
+    protected String typeName = "port";
+    protected String startAddress = "";
+    protected String endAddress = "";
+    protected int priority = 5; // Between 0 and 10
+
     public TMLArchiPortArtifact(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp)  {
         super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
-        
+
         width = 75;
         height = 40;
         minWidth = 75;
-        
+
         nbConnectingPoint = 0;
         addTGConnectingPointsComment();
-        
+
         moveable = true;
         editable = true;
         removable = true;
-        
+
         value = "";
         portName = "name";
-		referenceCommunicationName = "TMLCommunication";
-        
+        referenceCommunicationName = "TMLCommunication";
+
         makeFullValue();
-		
-		//setPriority(((TMLArchiDiagramPanel)tdp).getPriority(getFullValue(), priority);
-        
+
+        //setPriority(((TMLArchiDiagramPanel)tdp).getPriority(getFullValue(), priority);
+
         myImageIcon = IconManager.imgic702;
     }
-	
-	public int getPriority() {
-		return priority;
-	}
-	
-	public void setPriority(int _priority) {
-		priority = _priority;
-	}
-	
-    
+
+    public int getPriority() {
+        return priority;
+    }
+
+    public void setPriority(int _priority) {
+        priority = _priority;
+    }
+
+
     public void internalDrawing(Graphics g) {
-        
+
         if (oldValue.compareTo(value) != 0) {
             setValue(value, g);
         }
-        
+
         g.drawRect(x, y, width, height);
-        
+
         //g.drawRoundRect(x, y, width, height, arc, arc);
         g.drawLine(x+width-space-fileX, y + space, x+width-space-fileX, y+space+fileY);
         g.drawLine(x+width-space-fileX, y + space, x+width-space-cran, y+space);
@@ -124,31 +124,31 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
         g.drawLine(x+width-space, y+space+fileY, x+width-space-fileX, y+space+fileY);
         g.drawLine(x+width-space-cran, y+space, x+width-space-cran, y+space+cran);
         g.drawLine(x+width-space-cran, y+space+cran, x + width-space, y+space+cran);
-        
-		g.drawImage(IconManager.img9, x+width-space-fileX + 3, y + space + 7, null);
-		
+
+        g.drawImage(IconManager.img9, x+width-space-fileX + 3, y + space + 7, null);
+
         g.drawString(value, x + textX , y + textY);
-		
-		Font f = g.getFont();
-		g.setFont(f.deriveFont(Font.ITALIC));
-		g.drawString(typeName, x + textX , y + textY + 20);
-		g.setFont(f);
-        
+
+        Font f = g.getFont();
+        g.setFont(f.deriveFont(Font.ITALIC));
+        g.drawString(typeName, x + textX , y + textY + 20);
+        g.setFont(f);
+
     }
-    
+
     public void setValue(String val, Graphics g) {
         oldValue = value;
         int w  = g.getFontMetrics().stringWidth(value);
-		int w1 = Math.max(minWidth, w + 2 * textX + fileX + space);
-		
+        int w1 = Math.max(minWidth, w + 2 * textX + fileX + space);
+
         //System.out.println("width=" + width + " w1=" + w1 + " w2=" + w2 + " value=" + value);
-        if (w1 != width) { 
+        if (w1 != width) {
             width = w1;
             resizeWithFather();
         }
         //System.out.println("width=" + width + " w1=" + w1 + " value=" + value);
     }
-    
+
     public void resizeWithFather() {
         if ((father != null) && (father instanceof TMLArchiCommunicationNode)) {
             //System.out.println("cdRect comp");
@@ -157,107 +157,107 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
             setMoveCd(x, y);
         }
     }
-    
-    
-     public boolean editOndoubleClick(JFrame frame) {
-		String tmp;
-		boolean error = false;
-		
-		JDialogPortArtifact dialog = new JDialogPortArtifact(frame, "Setting port artifact attributes", this, mappedMemory, startAddress, endAddress, value );
-		dialog.setSize(700, 600);
+
+
+    public boolean editOndoubleClick(JFrame frame) {
+        String tmp;
+        boolean error = false;
+
+        JDialogPortArtifact dialog = new JDialogPortArtifact(frame, "Setting port artifact attributes", this, mappedMemory, startAddress, endAddress, value );
+        dialog.setSize(700, 600);
         GraphicLib.centerOnParent(dialog);
         dialog.show(); // blocked until dialog has been closed
-				mappedMemory = dialog.getMappedMemory();
-				startAddress = dialog.getStartAddress();
-				endAddress = dialog.getEndAddress();
-        
-		if (!dialog.isRegularClose()) {
-			return false;
-		}
-		
-		if (dialog.getReferenceCommunicationName() == null) {
-			return false;
-		}
-		
-		if (dialog.getReferenceCommunicationName().length() != 0) {
-			tmp = dialog.getReferenceCommunicationName();
-			referenceCommunicationName = tmp;
-			
-		}
-		
-		if (dialog.getCommunicationName().length() != 0) {
-			tmp = dialog.getCommunicationName();
-			
-			if (!TAttribute.isAValidId(tmp, false, false)) {
-				error = true;
+        mappedMemory = dialog.getMappedMemory();
+        startAddress = dialog.getStartAddress();
+        endAddress = dialog.getEndAddress();
+
+        if (!dialog.isRegularClose()) {
+            return false;
+        }
+
+        if (dialog.getReferenceCommunicationName() == null) {
+            return false;
+        }
+
+        if (dialog.getReferenceCommunicationName().length() != 0) {
+            tmp = dialog.getReferenceCommunicationName();
+            referenceCommunicationName = tmp;
+
+        }
+
+        if (dialog.getCommunicationName().length() != 0) {
+            tmp = dialog.getCommunicationName();
+
+            if (!TAttribute.isAValidId(tmp, false, false)) {
+                error = true;
             } else {
-				portName = tmp;
-			}
-		}
-		
-		if (dialog.getTypeName().length() != 0) {
-			typeName = dialog.getTypeName();
-		}
-		
-		priority = dialog.getPriority();
-		
-		((TMLArchiDiagramPanel)tdp).setPriority(getFullValue(), priority);
-		
-			
-		if (error) {
-			JOptionPane.showMessageDialog(frame,
-               "Name is non-valid",
-               "Error",
-               JOptionPane.INFORMATION_MESSAGE);
-		}
-		
-		makeFullValue();
-			
-		return !error;
-      
+                portName = tmp;
+            }
+        }
+
+        if (dialog.getTypeName().length() != 0) {
+            typeName = dialog.getTypeName();
+        }
+
+        priority = dialog.getPriority();
+
+        ((TMLArchiDiagramPanel)tdp).setPriority(getFullValue(), priority);
+
+
+        if (error) {
+            JOptionPane.showMessageDialog(frame,
+                                          "Name is non-valid",
+                                          "Error",
+                                          JOptionPane.INFORMATION_MESSAGE);
+        }
+
+        makeFullValue();
+
+        return !error;
+
     }
-    
+
     private void makeFullValue() {
         value = referenceCommunicationName + "::" + portName;
     }
-    
+
     public TGComponent isOnMe(int _x, int _y) {
         if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
             return this;
         }
         return null;
     }
-    
+
     public int getType() {
         return TGComponentManager.TMLARCHI_PORT_ARTIFACT;
     }
-    
+
     protected String translateExtraParam() {
         StringBuffer sb = new StringBuffer("<extraparam>\n");
         sb.append("<info value=\"" + value + "\" portName=\"" + portName + "\" referenceCommunicationName=\"");
         sb.append(referenceCommunicationName);
-		/*sb.append("\" priority=\"");
-		sb.append(priority);*/
-		sb.append("\" typeName=\"" + typeName);
-		sb.append("\" mappedMemory=\"" + mappedMemory );
-		sb.append("\" startAddress=\"" + startAddress );
-		sb.append("\" endAddress=\"" + endAddress );
+        /*sb.append("\" priority=\"");
+          sb.append(priority);*/
+        sb.append("\" typeName=\"" + typeName);
+        sb.append("\" mappedMemory=\"" + mappedMemory );
+        sb.append("\" startAddress=\"" + startAddress );
+        sb.append("\" endAddress=\"" + endAddress );
         sb.append("\" />\n");
         sb.append("</extraparam>\n");
         return new String(sb);
     }
-    
+
     public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{
         //System.out.println("*** load extra synchro ***");
         try {
-            
+
             NodeList nli;
             Node n1, n2;
             Element elt;
             int t1id;
             String svalue = null, sname = null, sreferenceCommunication = null, stype = null;
-			//String prio = null;
-            
+            //String prio = null;
+
             for(int i=0; i<nl.getLength(); i++) {
                 n1 = nl.item(i);
                 //System.out.println(n1);
@@ -272,70 +272,70 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
                                 svalue = elt.getAttribute("value");
                                 sname = elt.getAttribute("portName");
                                 sreferenceCommunication = elt.getAttribute("referenceCommunicationName");
-								stype = elt.getAttribute("typeName");
-								mappedMemory = elt.getAttribute("mappedMemory");
-								startAddress = elt.getAttribute("startAddress");
-								endAddress = elt.getAttribute("endAddress");
-								//prio = elt.getAttribute("priority");
+                                stype = elt.getAttribute("typeName");
+                                mappedMemory = elt.getAttribute("mappedMemory");
+                                startAddress = elt.getAttribute("startAddress");
+                                endAddress = elt.getAttribute("endAddress");
+                                //prio = elt.getAttribute("priority");
                             }
                             if (svalue != null) {
                                 value = svalue;
-                            } 
+                            }
                             if (sname != null){
                                 portName = sname;
                             }
                             if (sreferenceCommunication != null) {
                                 referenceCommunicationName = sreferenceCommunication;
                             }
-							if (stype != null){
+                            if (stype != null){
                                 typeName = stype;
                             }
-							
-							/*if ((prio != null) && (prio.trim().length() > 0)) {
-								priority = Integer.decode(prio).intValue();
-							}*/
+
+                            /*if ((prio != null) && (prio.trim().length() > 0)) {
+                              priority = Integer.decode(prio).intValue();
+                              }*/
                         }
                     }
                 }
             }
-            
+
         } catch (Exception e) {
-			System.out.println("Channel artifact");
+            System.out.println("Channel artifact");
             throw new MalformedModelingException();
         }
         makeFullValue();
     }
-    
+
     public DesignPanel getDesignPanel() {
         return tdp.getGUI().getDesignPanel(value);
     }
-	
-	public String getReferenceCommunicationName() {
+
+    public String getReferenceCommunicationName() {
         return referenceCommunicationName;
     }
-	
-	public void setReferenceCommunicationName(String _referenceCommunicationName) {
+
+    public void setReferenceCommunicationName(String _referenceCommunicationName) {
         referenceCommunicationName = _referenceCommunicationName;
-		makeFullValue();
+        makeFullValue();
     }
-    
+
     public String getPortName() {
         return portName;
     }
-	
-	
-	public String getFullValue() {
-		String tmp = getValue();
-		tmp += " (" + getTypeName() + ")";
-		return tmp;
-	}
-	
-	public String getTypeName() {
+
+
+    public String getFullValue() {
+        String tmp = getValue();
+        tmp += " (" + getTypeName() + ")";
+        return tmp;
+    }
+
+    public String getTypeName() {
         return typeName;
     }
-	
-	public String getAttributes() {
-		return "Priority = " + priority;
-	}
-	
+
+    public String getAttributes() {
+        return "Priority = " + priority;
+    }
+
 }
-- 
GitLab