Skip to content
Snippets Groups Projects
Commit 05f9dbe1 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

NC update

parent 35f71da1
No related branches found
No related tags found
No related merge requests found
/**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 NCCapacityUnit
* Creation: 28/11/2008
* @version 1.0 28/11/2008
* @author Ludovic APVRILLE
* @see
*/
package nc;
public class NCCapacityUnit {
public static final String MBS = "Mbs";
public static final String KBS = "Kbs";
private String unit;
public NCCapacityUnit() {
unit = MBS;
}
public void setUnit(String s) {
if (s.equals(MBS)) {
unit = MBS;
}
if (s.equals(KBS)) {
unit = KBS;
}
}
public String getStringUnit() {
return unit;
}
}
\ No newline at end of file
......@@ -49,6 +49,7 @@ package nc;
public class NCLink extends NCElement {
protected int capacity;
protected NCCapacityUnit capacityUnit = new NCCapacityUnit(); // Default value: Mbs
protected NCLinkedElement le1, le2;
public NCLink() {}
......@@ -77,5 +78,13 @@ public class NCLink extends NCElement {
le2 = ncle;
}
public void setCapacityUnit(NCCapacityUnit _unit) {
capacityUnit = _unit;
}
public NCCapacityUnit getCapacityUnit() {
return capacityUnit;
}
}
\ No newline at end of file
......@@ -124,6 +124,8 @@ public class NCStructure extends NCElement {
tmp += sw.getName();
tmp += "\" schedulingPolicy=\"";
tmp += NCSwitch.getStringSchedulingPolicy(sw.getSchedulingPolicy());
tmp += "\" capacity=\"" + sw.getCapacity();
tmp += "\" capacityUnit=\"" + sw.getCapacityUnit().getStringUnit();
tmp += "\" />\n";
}
return tmp;
......@@ -132,16 +134,18 @@ public class NCStructure extends NCElement {
private String getXMLTraffics() {
String tmp = "";
for(NCTraffic tr: traffics) {
tmp += "<traffic ";
tmp += "<Traffic ";
tmp += " name=\"";
tmp += tr.getName();
tmp += " Periodic=\"";
tmp += "\" Periodic=\"";
if (tr.getPeriodicType() == 0) {
tmp += "periodic";
} else {
tmp += "aperiodic";
}
tmp += "\" deadline=\"" + tr.getDeadline();
tmp += "\" deadlineUnit=\"" + tr.getDeadlineUnit().getStringUnit();
tmp += "\" minPacketSize=\"" + tr.getMinPacketSize();
tmp += "\" maxPacketSize=\"" + tr.getMaxPacketSize();
tmp += "\" priority=\"" + tr.getPriority();
tmp += "\" />\n";
......@@ -157,6 +161,8 @@ public class NCStructure extends NCElement {
tmp += lk.getName();
tmp += "\" capacity=\"";
tmp += lk.getCapacity();
tmp += "\" capacityUnit=\"";
tmp += lk.getCapacityUnit().getStringUnit();
tmp += "\" end1=\"";
tmp += lk.getLinkedElement1().getName();
tmp += "\" end2=\"";
......
......@@ -56,6 +56,8 @@ public class NCSwitch extends NCLinkedElement {
public static String[] SchedulingPolicies = {FCFS, STATIC, WFQ};
private int schedulingPolicy = 0;
private int capacity = 0;
private NCCapacityUnit unitCapacity = new NCCapacityUnit(); // Default value: Mbs
public NCSwitch() {
}
......@@ -82,5 +84,22 @@ public class NCSwitch extends NCLinkedElement {
return -1;
}
public void setCapacity(int _capacity) {
capacity = _capacity;
}
public int getCapacity() {
return capacity;
}
public void setCapacityUnit(NCCapacityUnit _unit) {
unitCapacity = _unit;
}
public NCCapacityUnit getCapacityUnit() {
return unitCapacity;
}
}
\ No newline at end of file
/**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 NCTimeUnit
* Creation: 28/11/2008
* @version 1.0 28/11/2008
* @author Ludovic APVRILLE
* @see
*/
package nc;
public class NCTimeUnit {
public static final String US = "us";
public static final String MS = "ms";
public static final String S = "s";
private String unit;
public NCTimeUnit() {
unit = MS;
}
public void setUnit(String s) {
if (s.equals(US)) {
unit = US;
}
if (s.equals(MS)) {
unit = MS;
}
if (s.equals(S)) {
unit = S;
}
}
public String getStringUnit() {
return unit;
}
}
\ No newline at end of file
......@@ -50,23 +50,34 @@ package nc;
public class NCTraffic extends NCElement {
protected int periodicType = 0; // 0: periodic ; 1: aperiodic
protected int deadline = 10;
protected int maxPacketSize = 20;
protected NCTimeUnit deadlineUnit;
protected int minPacketSize = 20;
protected int maxPacketSize = 40;
protected int priority = 0; // 0 to 3
public NCTraffic() {}
public void setPeriodicType(int _periodicType) {
periodicType = _periodicType;
deadlineUnit = new NCTimeUnit();
}
public void setDeadline(int _deadline) {
deadline = _deadline;
}
public void setDeadlineUnit(NCTimeUnit _deadlineUnit) {
deadlineUnit = _deadlineUnit;
}
public void setMaxPacketSize(int _maxPacketSize) {
maxPacketSize = _maxPacketSize;
}
public void setMinPacketSize(int _minPacketSize) {
minPacketSize = _minPacketSize;
}
public void setPriority(int _priority) {
priority = _priority;
}
......@@ -75,10 +86,26 @@ public class NCTraffic extends NCElement {
return periodicType;
}
public static String getStringPeriodicType(int periodicType) {
if (periodicType == 0) {
return "periodic";
} else {
return "aperiodic";
}
}
public int getDeadline() {
return deadline;
}
public NCTimeUnit getDeadlineUnit() {
return deadlineUnit;
}
public int getMinPacketSize() {
return minPacketSize;
}
public int getMaxPacketSize() {
return maxPacketSize;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment