diff --git a/src/main/java/ui/syscams/SysCAMSBlockDE.java b/src/main/java/ui/syscams/SysCAMSBlockDE.java index a16b46683d8ed922b9b7c5e701311d778cf35274..92f22568c27d96e0045642c15db3a786b4add635 100644 --- a/src/main/java/ui/syscams/SysCAMSBlockDE.java +++ b/src/main/java/ui/syscams/SysCAMSBlockDE.java @@ -63,6 +63,7 @@ import java.util.Vector; public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent, WithAttributes { private int period; + private String time; private int maxFontSize = 14; private int minFontSize = 4; @@ -108,6 +109,9 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements value = tdp.findSysCAMSPrimitiveComponentName("Block_DE_"); name = "Primitive component"; + setPeriod(0); + setTime(""); + myImageIcon = IconManager.imgic1202; actionOnAdd(); @@ -431,4 +435,13 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements public String getAttributes() { return null; } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } } + diff --git a/src/main/java/ui/syscams/SysCAMSBlockTDF.java b/src/main/java/ui/syscams/SysCAMSBlockTDF.java index f7c8058aa573f5e78ace734ff750695042daf82a..54a1ec60618adc906b1b664d1916684c575e4750 100644 --- a/src/main/java/ui/syscams/SysCAMSBlockTDF.java +++ b/src/main/java/ui/syscams/SysCAMSBlockTDF.java @@ -63,6 +63,7 @@ import java.util.Vector; public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent, WithAttributes { private int period; + private String time; private String processCode; private int maxFontSize = 14; @@ -110,6 +111,11 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements oldValue = value; name = "Primitive component"; + // Initialization of port attributes + setPeriod(0); + setProcessCode("void processing() {\n\n}"); + setTime(""); + myImageIcon = IconManager.imgic1202; actionOnAdd(); @@ -359,6 +365,8 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements } protected String translateExtraParam() { + StringBuffer proc; + StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<Data isAttacker=\""); sb.append(isAttacker() ? "Yes": "No"); @@ -366,12 +374,30 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements sb.append("<Attribute period=\""); sb.append(this.getPeriod()); sb.append("\" processCode=\""); - sb.append(this.getProcessCode()); + proc = encode(this.getProcessCode()); + sb.append(proc); sb.append("\" />\n"); sb.append("</extraparam>\n"); return new String(sb); } + public StringBuffer encode(String data) { + StringBuffer databuf = new StringBuffer(data); + StringBuffer buffer = new StringBuffer(""); + for(int pos = 0; pos != data.length(); pos++) { + char c = databuf.charAt(pos); + switch(c) { + case '&': buffer.append("&"); break; + case '\"': buffer.append("""); break; + case '\'': buffer.append("'"); break; + case '<': buffer.append("<"); break; + case '>': buffer.append(">"); break; + default: buffer.append(databuf.charAt(pos)); break; + } + } + return buffer; + } + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ try { NodeList nli; @@ -495,4 +521,13 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements public String getAttributes() { return null; } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } } + diff --git a/src/main/java/ui/syscams/SysCAMSChannelFacility.java b/src/main/java/ui/syscams/SysCAMSChannelFacility.java index 3ac59014a0fd603d977865ab3065da69bd21ff9a..1c197b678ce2a9e075820c4664de7dffdb722e4a 100644 --- a/src/main/java/ui/syscams/SysCAMSChannelFacility.java +++ b/src/main/java/ui/syscams/SysCAMSChannelFacility.java @@ -151,7 +151,7 @@ public abstract class SysCAMSChannelFacility extends TGCScalableWithInternalComp } public int getDefaultConnector() { - return TGComponentManager.CONNECTOR_PORT_TMLC; + return TGComponentManager.CAMS_CONNECTOR; } public Color getPortColor() { diff --git a/src/main/java/ui/syscams/SysCAMSChannelOutPort.java b/src/main/java/ui/syscams/SysCAMSChannelOutPort.java deleted file mode 100644 index ed1f34c0f92c0318cde8476d1ea4978863565536..0000000000000000000000000000000000000000 --- a/src/main/java/ui/syscams/SysCAMSChannelOutPort.java +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille - * - * ludovic.apvrille AT enst.fr - * - * This software is a computer program whose purpose is to allow the - * edition of TURTLE analysis, design and deployment diagrams, to - * allow the generation of RT-LOTOS or Java code from this diagram, - * and at last to allow the analysis of formal validation traces - * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP - * from INRIA Rhone-Alpes. - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - -package ui.syscams; - -import ui.TDiagramPanel; -import ui.TGComponent; -import ui.TGComponentManager; - -import java.awt.*; - -/** - * Class SysCAMSChannelOutPort - * Channel out port. To be used in SystemC-AMS component task diagrams - * Creation: 22/04/2018 - * @version 1.0 22/04/2018 - * @author Irina Kit Yan LEE - */ - -public class SysCAMSChannelOutPort extends SysCAMSPrimitivePort { - public SysCAMSChannelOutPort(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); - - initConnectingPoint(true, true, 1); - } - - public void drawParticularity(Graphics g) { - } - - public int getType() { - return TGComponentManager.TMLCTD_COPORT; - } -} \ No newline at end of file diff --git a/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramPanel.java b/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramPanel.java index f1b5f6b1527599c4c97c9823b7eadd42410bea9a..66f990b3d5fcffcb9fd35b28f69c6df76229197b 100644 --- a/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramPanel.java +++ b/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramPanel.java @@ -705,7 +705,7 @@ public class SysCAMSComponentTaskDiagramPanel extends TDiagramPanel implements T public void loadExtraParameters(Element elt) { } - + public void setConnectorsToFront() { TGComponent tgc; Iterator<TGComponent> iterator = componentList.listIterator(); diff --git a/src/main/java/ui/syscams/SysCAMSPortConnectingPoint.java b/src/main/java/ui/syscams/SysCAMSPortConnectingPoint.java index 24820249358266616b52fedd4f9041bd3322be4e..333341f49e0058d1d7b1ff520a2e7e91c866df4a 100644 --- a/src/main/java/ui/syscams/SysCAMSPortConnectingPoint.java +++ b/src/main/java/ui/syscams/SysCAMSPortConnectingPoint.java @@ -59,6 +59,6 @@ public class SysCAMSPortConnectingPoint extends TGConnectingPointWidthHeight{ } public boolean isCompatibleWith(int type) { - return type == TGComponentManager.CONNECTOR_PORT_TMLC; + return type == TGComponentManager.CAMS_CONNECTOR; } } \ No newline at end of file diff --git a/src/main/java/ui/syscams/SysCAMSPortConverter.java b/src/main/java/ui/syscams/SysCAMSPortConverter.java index b4bedc05ee8472fcce8d4ca82619de84285e4d23..10622278b1bda0d3f61cff16789b3e269cb2306c 100644 --- a/src/main/java/ui/syscams/SysCAMSPortConverter.java +++ b/src/main/java/ui/syscams/SysCAMSPortConverter.java @@ -53,6 +53,7 @@ import ui.TGComponent; public class SysCAMSPortConverter extends SysCAMSPrimitivePort { private int period; + private String time; private int rate; private int delay; private String convType; @@ -62,6 +63,14 @@ public class SysCAMSPortConverter extends SysCAMSPrimitivePort { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); } + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + public int getPeriod() { return period; } diff --git a/src/main/java/ui/syscams/SysCAMSPortDE.java b/src/main/java/ui/syscams/SysCAMSPortDE.java index 2ec7fbc38c8fcd21d975983024865822cf5e9780..daa5f068d8f7f1fd25a6c444562a04caeaa3f234 100644 --- a/src/main/java/ui/syscams/SysCAMSPortDE.java +++ b/src/main/java/ui/syscams/SysCAMSPortDE.java @@ -53,6 +53,7 @@ import ui.TGComponent; public class SysCAMSPortDE extends SysCAMSPrimitivePort { private int period; + private String time; private int rate; private int delay; private String DEType; @@ -62,6 +63,14 @@ public class SysCAMSPortDE extends SysCAMSPrimitivePort { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); } + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + public String getDEType() { return DEType; } diff --git a/src/main/java/ui/syscams/SysCAMSPortTDF.java b/src/main/java/ui/syscams/SysCAMSPortTDF.java index 59010f2324173a3fe0b2cfdfb4552caaea20ec67..3635a9e1c8f62a087e8b7d58a9e0249128c5e05b 100644 --- a/src/main/java/ui/syscams/SysCAMSPortTDF.java +++ b/src/main/java/ui/syscams/SysCAMSPortTDF.java @@ -53,6 +53,7 @@ import ui.TGComponent; public class SysCAMSPortTDF extends SysCAMSPrimitivePort { private int period; + private String time; private int rate; private int delay; private String TDFType; @@ -62,6 +63,14 @@ public class SysCAMSPortTDF extends SysCAMSPrimitivePort { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); } + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + public String getTDFType() { return TDFType; } diff --git a/src/main/java/ui/syscams/SysCAMSPrimitivePort.java b/src/main/java/ui/syscams/SysCAMSPrimitivePort.java index 0c1b0af2c4014dbe6f5a4619037b4714c7b1e1cc..9dbeb15acb74ee3093ed35a9602f50fe8fbdae3e 100644 --- a/src/main/java/ui/syscams/SysCAMSPrimitivePort.java +++ b/src/main/java/ui/syscams/SysCAMSPrimitivePort.java @@ -88,12 +88,8 @@ public abstract class SysCAMSPrimitivePort extends TGCScalableWithInternalCompon minWidth = 1; minHeight = 1; - nbConnectingPoint = 1; - connectingPoint = new TGConnectingPoint[1]; - for (int i=0; i<1; i++) { - connectingPoint[i] = new SysCAMSPortConnectingPoint(this, 0, 0, true, true, 0.5, 0.0); - } - + initConnectingPoint(true, true, 1); + addTGConnectingPointsComment(); nbInternalTGComponent = 0; @@ -117,16 +113,19 @@ public abstract class SysCAMSPrimitivePort extends TGCScalableWithInternalCompon // Initialization of port attributes if (this instanceof SysCAMSPortTDF) { ((SysCAMSPortTDF) this).setPeriod(0); + ((SysCAMSPortTDF) this).setTime(""); ((SysCAMSPortTDF) this).setRate(0); ((SysCAMSPortTDF) this).setDelay(0); ((SysCAMSPortTDF) this).setTDFType("int"); } else if (this instanceof SysCAMSPortDE) { ((SysCAMSPortDE) this).setPeriod(0); + ((SysCAMSPortDE) this).setTime(""); ((SysCAMSPortDE) this).setRate(0); ((SysCAMSPortDE) this).setDelay(0); ((SysCAMSPortDE) this).setDEType("int"); } else if (this instanceof SysCAMSPortConverter) { ((SysCAMSPortConverter) this).setPeriod(0); + ((SysCAMSPortConverter) this).setTime(""); ((SysCAMSPortConverter) this).setDelay(0); ((SysCAMSPortConverter) this).setRate(0); ((SysCAMSPortConverter) this).setConvType("int"); @@ -342,18 +341,21 @@ public abstract class SysCAMSPrimitivePort extends TGCScalableWithInternalCompon if (this instanceof SysCAMSPortTDF) { sb.append("\" period=\"" + ((SysCAMSPortTDF) this).getPeriod()); + sb.append("\" time=\"" + ((SysCAMSPortTDF) this).getTime()); sb.append("\" rate=\"" + ((SysCAMSPortTDF) this).getRate()); sb.append("\" delay=\"" + ((SysCAMSPortTDF) this).getDelay()); sb.append("\" type=\"" + ((SysCAMSPortTDF) this).getTDFType()); } if (this instanceof SysCAMSPortDE) { sb.append("\" period=\"" + ((SysCAMSPortDE) this).getPeriod()); + sb.append("\" time=\"" + ((SysCAMSPortDE) this).getTime()); sb.append("\" rate=\"" + ((SysCAMSPortDE) this).getRate()); sb.append("\" delay=\"" + ((SysCAMSPortDE) this).getDelay()); sb.append("\" type=\"" + ((SysCAMSPortDE) this).getDEType()); } if (this instanceof SysCAMSPortConverter) { sb.append("\" period=\"" + ((SysCAMSPortConverter) this).getPeriod()); + sb.append("\" time=\"" + ((SysCAMSPortConverter) this).getTime()); sb.append("\" rate=\"" + ((SysCAMSPortConverter) this).getRate()); sb.append("\" delay=\"" + ((SysCAMSPortConverter) this).getDelay()); sb.append("\" type=\"" + ((SysCAMSPortConverter) this).getConvType()); @@ -370,7 +372,7 @@ public abstract class SysCAMSPrimitivePort extends TGCScalableWithInternalCompon Element elt; int period, rate, delay; - String type; + String type, time; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); @@ -385,22 +387,26 @@ public abstract class SysCAMSPrimitivePort extends TGCScalableWithInternalCompon typep = Integer.decode(elt.getAttribute("commType")).intValue(); isOrigin = Integer.decode(elt.getAttribute("origin")).intValue(); period = Integer.decode(elt.getAttribute("period")).intValue(); + time = elt.getAttribute("time"); rate = Integer.decode(elt.getAttribute("rate")).intValue(); delay = Integer.decode(elt.getAttribute("delay")).intValue(); type = elt.getAttribute("type"); setPortName(commName); if (this instanceof SysCAMSPortTDF) { ((SysCAMSPortTDF)this).setPeriod(period); + ((SysCAMSPortTDF)this).setTime(time); ((SysCAMSPortTDF)this).setRate(rate); ((SysCAMSPortTDF)this).setDelay(delay); ((SysCAMSPortTDF)this).setTDFType(type); } else if (this instanceof SysCAMSPortDE) { ((SysCAMSPortDE)this).setPeriod(period); + ((SysCAMSPortDE)this).setTime(time); ((SysCAMSPortDE)this).setRate(rate); ((SysCAMSPortDE)this).setDelay(delay); ((SysCAMSPortDE)this).setDEType(type); } else if (this instanceof SysCAMSPortConverter) { ((SysCAMSPortConverter)this).setPeriod(period); + ((SysCAMSPortConverter)this).setTime(time); ((SysCAMSPortConverter)this).setRate(rate); ((SysCAMSPortConverter)this).setDelay(delay); ((SysCAMSPortConverter)this).setConvType(type); @@ -452,7 +458,7 @@ public abstract class SysCAMSPrimitivePort extends TGCScalableWithInternalCompon } public int getDefaultConnector() { - return TGComponentManager.CONNECTOR_PORT_TMLC; + return TGComponentManager.CAMS_CONNECTOR; } public String getAttributes() {