diff --git a/src/tmltranslator/tmlcp/TMLCPSequenceDiagram.java b/src/tmltranslator/tmlcp/TMLCPSequenceDiagram.java index 8224858a3fb63cd533f247f7a12ec466106658e7..62acc216ebec190f534a5e3bd319ecd28e3ad46b 100755 --- a/src/tmltranslator/tmlcp/TMLCPSequenceDiagram.java +++ b/src/tmltranslator/tmlcp/TMLCPSequenceDiagram.java @@ -152,7 +152,7 @@ public class TMLCPSequenceDiagram extends TMLElement { public void addMessage( TMLSDMessage _msg ) { messages.add( _msg ); - addItem( new TMLSDItem( _msg.getName(), _msg.getSenderName(), _msg.getReceiverName(), _msg.getYCoord(), _msg.getAttributes() ) ); + //addItem( new TMLSDItem( _msg.getName(), _msg.getSenderName(), _msg.getReceiverName(), _msg.getYCoord(), _msg.getAttributes() ) ); } public void insertInitialValue( String _name, String value ) /*throws UninitializedVariableException*/ { diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index 34f2ccc98bb7f717f939f08ebbcdd453be437fc5..f13163ec8aa0cd76dc372b33e0feba865a72fc78 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -1885,7 +1885,7 @@ public class GTMLModeling { return map; // the data structure map is returned to CheckSyntaxTMLMapping in GTURTLEModeling } - //Checking the syntax of CP without mapping + //Checking the syntax of CP with mapping if present public TMLCP translateToTMLCP() { //tmlm = new TMLModeling( true ); @@ -1898,20 +1898,20 @@ public class GTMLModeling { warnings = new Vector(); //listE = new CorrespondanceTGElement(); - TraceManager.addDev( "Making Communication Pattern data structure to check the syntax, without mapping" ); - makeCommunicationPattern(); //this routine will fill archi, but now it fills - /*TraceManager.addDev( "Making TML modeling" ); - if (!makeTMLModeling()) { //Attention, this routine will provoke errors... + TraceManager.addDev( "Making Communication Pattern data structure to check the syntax" ); + makeCommunicationPattern(); + /*if (!makeTMLModeling()) { return null; - } + }*/ TraceManager.addDev("Making mapping"); - makeMapping(); //Attention this routine will fill map + //makeCPMapping(); //Inspect the architecture Deployment Diagram to retrieve mapping information, that is now located in one + //place only: the architecture DD - TraceManager.addDev("<--- TML modeling:"); - TraceManager.addDev("TML: " + tmlm.toString()); - TraceManager.addDev("End of TML modeling --->"); + TraceManager.addDev("<--- TMLCP modeling:"); + TraceManager.addDev("TMLCP: " + tmlcp.toString()); + TraceManager.addDev("End of TMLCP modeling --->"); - removeActionsWithRecords();*/ + //removeActionsWithRecords(); return tmlcp; } @@ -2587,6 +2587,64 @@ public class GTMLModeling { return true; } + + //Inspect the architecture diagrams and retrieve mapping of channels onto CPs + private void makeCPMapping() { + + //Why this code? + //if( nodesToTakeIntoAccount == null ) { + + //take the architecture panel if it exists, otherwise return + Vector<TDiagramPanel> panelList = tmlap.getPanels(); + for( TDiagramPanel panel: panelList ) { + TraceManager.addDev( "Name of Panel: " + panel.getName() ); + } + //} + //else { + // components = nodesToTakeIntoAccount; + //} + ListIterator iterator = components.listIterator(); + + TGComponent tgc; + ArrayList<TMLArchiArtifact> artifacts; + ArrayList<TMLArchiCommunicationArtifact> artifactscomm; + ArrayList<TMLArchiEventArtifact> artifactsEvt; + HwNode node; + TMLTask task; + TMLElement elt; + String s; + + while( iterator.hasNext() ) { + TraceManager.addDev( "makeCPMapping 1" ); + tgc = (TGComponent)( iterator.next() ); + if( tgc instanceof TMLArchiCPNode ) { + TraceManager.addDev( "makeCPMapping 2" ); + node = archi.getHwNodeByName( tgc.getName() ); + if ( ( node != null ) && ( node instanceof HwCommunicationNode ) ) { + TraceManager.addDev( "makeCPMapping 3" ); + artifactscomm = ( (TMLArchiCommunicationNode)(tgc) ).getChannelArtifactList(); + for( TMLArchiCommunicationArtifact artifact: artifactscomm ) { + TraceManager.addDev("Exploring artifact " + artifact.getValue()); + s = artifact.getReferenceCommunicationName(); + s = s.replaceAll("\\s", ""); + s = s + "__" + artifact.getCommunicationName(); + TraceManager.addDev("Searching for:" + s); + elt = tmlm.getCommunicationElementByName(s); + TraceManager.addDev("comm elts:" + tmlm.getStringListCommunicationElements()); + if( elt instanceof TMLChannel ) { + //TraceManager.addDev("Setting priority"); + ( (TMLChannel)(elt) ).setPriority( artifact.getPriority() ); + } + if (elt != null) { + map.addCommToHwCommNode( elt, (HwCommunicationNode)node ); + } else { + TraceManager.addDev("Null mapping: no element named: " + artifact.getCommunicationName()); + } + } + } + } + } + } //End of method private void makeMapping() { if (nodesToTakeIntoAccount == null) { @@ -2607,11 +2665,11 @@ public class GTMLModeling { while(iterator.hasNext()) { tgc = (TGComponent)(iterator.next()); - if (tgc instanceof TMLArchiNode) { - node = archi.getHwNodeByName(tgc.getName()); - if ((node != null) && (node instanceof HwExecutionNode)) { - artifacts = ((TMLArchiNode)(tgc)).getAllTMLArchiArtifacts(); - for(TMLArchiArtifact artifact:artifacts) { + if( tgc instanceof TMLArchiCPNode ) { + node = archi.getHwNodeByName( tgc.getName() ); + if( ( node != null ) && ( node instanceof HwExecutionNode ) ) { //why checking this instanceof? + artifacts = ( (TMLArchiNode)(tgc) ).getAllTMLArchiArtifacts(); + for( TMLArchiArtifact artifact:artifacts ) { //TraceManager.addDev("Exploring artifact " + artifact.getValue()); s = artifact.getReferenceTaskName(); TraceManager.addDev("1) Trying to get task named:" + s); diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index 7926c9794256df20987f30575f6969bd8e4f42ea..721c1fa9dbc6d978661b29c4aebc37779fb4b402 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -6302,10 +6302,8 @@ public class GTURTLEModeling { TraceManager.addDev( "I AM ABOUT TO GENERATE THE TMLtxt CODE!" ); mgui.generateTMLTxt(); //Now generating the TMLtxt code TraceManager.addDev( "TMLtxt CODE GENERATION DONE" ); - //CPparser myCPparser = new CPparser( ConfigurationTTool.TMLCodeDirectory + File.separator, "spec.tmlcp" ); - //here I should call the javacc parser and feed it with the above-generated TMLtxt! /*listE = gtmlm.getCorrespondanceTable(); - checkingErrors = gtmlm.getCheckingErrors(); //A vector + checkingErrors = gtmlm.getCheckingErrors(); if( (checkingErrors != null) && (checkingErrors.size() > 0) ) { analyzeErrors(); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index ab679b07ef0dd63a8fb80520731790fe6379a1d3..d187efee7711e80a0794b0592e9d5ed5cf54370e 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -1212,14 +1212,14 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return list; } - public Vector<String> getAllTMLCP() { + public ArrayList<TMLCommunicationPatternPanel> getAllTMLCP() { TURTLEPanel tp; - Vector<String> list = new Vector<String>(); + ArrayList<TMLCommunicationPatternPanel> list = new ArrayList<TMLCommunicationPatternPanel>(); for(int i=0; i<tabs.size(); i++) { tp = (TURTLEPanel)(tabs.elementAt(i)); - if (tp instanceof TMLCommunicationPatternPanel) { - list.add(mainTabbedPane.getTitleAt(i)); + if( tp instanceof TMLCommunicationPatternPanel ) { + list.add( (TMLCommunicationPatternPanel) tp ); } } return list;