Newer
Older
TMLArchiCPUNode newcpu = new TMLArchiCPUNode(firewallArchComp.getX() + 100, firewallArchComp.getY() + 100, newarch.tmlap.getMinX(), newarch.tmlap.getMaxX(), newarch.tmlap.getMinY(), newarch.tmlap.getMaxY(), true, null, newarch.tmlap);
newcpu.setName("CPU" + firewallNode.getName());
newarch.tmlap.replaceArchComponent(firewallArchComp, newcpu);
//Add artifact
TMLArchiArtifact hsmArt = new TMLArchiArtifact(newcpu.getX(), newcpu.getY(), newarch.tmlap.getMinX(), newarch.tmlap.getMaxX(), newarch.tmlap.getMinY(), newarch.tmlap.getMaxY(), true, newcpu, newarch.tmlap);
newarch.tmlap.addComponent(hsmArt, newcpu.getX(), newcpu.getY(), true, true);
hsmArt.setFullName(firewallNode.getName(), refTask);
}
// for (int link = 0; link < links / 2; link++) {
HashMap<TMLChannel, TMLChannel> inChans = new HashMap<TMLChannel, TMLChannel>();
HashMap<TMLChannel, TMLChannel> outChans = new HashMap<TMLChannel, TMLChannel>();
if (TraceManager.devPolicy == TraceManager.TO_CONSOLE) {
firewallComp = new TMLCPrimitiveComponent(newtcdp.getMaxX() - 100, newtcdp.getMaxY() - 100, newtcdp.getMinX(), newtcdp.getMaxX(), newtcdp.getMinY(), newtcdp.getMaxY(), false, null, newtcdp);
TAttribute reqIndex = new TAttribute(2, "index", "0", 0);
firewallComp.getAttributeList().add(reqIndex);
TAttribute chanIndex = new TAttribute(2, "channelIndex", "0", 0);
firewallComp.getAttributeList().add(chanIndex);
TAttribute rule = new TAttribute(2, "rule", "true", 4);
firewallComp.getAttributeList().add(rule);
newtcdp.addComponent(firewallComp, 0, 0, false, true);
firewallComp.setValueWithChange(firewallNode.getName());
firewallADP = tcp.getTMLActivityDiagramPanel(firewallNode.getName());
}
List<TMLChannel> channelsCopy = tmlm.getChannels();
List<TMLChannel> toAdd = new ArrayList<TMLChannel>();
TMLTask firewall = new TMLTask("TASK__" + firewallNode.getName(), firewallComp, firewallADP);
// tmlm.addTask(firewall);
// map.addTaskToHwExecutionNode(firewall, cpu);
TMLActivity act = firewall.getActivityDiagram();
List<TMLTask> modifiedTasks = new ArrayList<TMLTask>();
//Build requests between every connected task and firewall task
for (TMLTask task : map.getTMLModeling().getTasks()) {
TMLCPrimitiveComponent taskcomp = null;
for (TGComponent tg : tcdp.getComponentList()) {
if (tg instanceof TMLCPrimitiveComponent) {
if (tg.getValue().equals(task.getName().split("__")[1])) {
taskcomp = ((TMLCPrimitiveComponent) tg);
break;
}
} else if (tg instanceof TMLCCompositeComponent) {
TMLCCompositeComponent cc = (TMLCCompositeComponent) tg;
List<TMLCPrimitiveComponent> pcomps = cc.getAllPrimitiveComponents();
for (TMLCPrimitiveComponent pc : pcomps) {
if (pc.getValue().equals(task.getName().split("__")[1])) {
taskcomp = pc;
break;
}
}
}
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
if (pathExists(map, firewallNode, task) && commPath(map, firewallNode, task)) {
modifiedTasks.add(task);
//Add Request Ports
TMLCChannelOutPort destPort = new TMLCChannelOutPort(taskcomp.getX(), taskcomp.getY(), newtcdp.getMinX(), newtcdp.getMaxX(), newtcdp.getMinY(), newtcdp.getMaxX(), true, firewallComp, newtcdp);
TMLCChannelOutPort originPort = new TMLCChannelOutPort(taskcomp.getX(), taskcomp.getY(), newtcdp.getMinX(), newtcdp.getMaxX(), newtcdp.getMinY(), newtcdp.getMaxX(), true, taskcomp, newtcdp);
originPort.commName = "req" + firewallNode.getName();
originPort.isOrigin = true;
destPort.isOrigin = false;
destPort.commName = "req" + firewallNode.getName();
//Connect Request ports
TMLCPortConnector conn = new TMLCPortConnector(0, 0, newtcdp.getMinX(), newtcdp.getMaxX(), newtcdp.getMinY(), newtcdp.getMaxX(), true, null, newtcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>());
newtcdp.addComponent(conn, 0, 0, false, true);
originPort.typep = 2;
destPort.typep = 2;
originPort.setParam(0, new TType(1));
destPort.setParam(0, new TType(1));
newtcdp.addComponent(originPort, taskcomp.getX(), taskcomp.getY(), true, true);
newtcdp.addComponent(destPort, firewallComp.getX(), firewallComp.getY(), true, true);
//Add updateRules connection to first task
if (!updateRulesAdded) {
destPort = new TMLCChannelOutPort(taskcomp.getX(), taskcomp.getY(), newtcdp.getMinX(), newtcdp.getMaxX(), newtcdp.getMinY(), newtcdp.getMaxX(), true, firewallComp, newtcdp);
originPort = new TMLCChannelOutPort(taskcomp.getX(), taskcomp.getY(), newtcdp.getMinX(), newtcdp.getMaxX(), newtcdp.getMinY(), newtcdp.getMaxX(), true, taskcomp, newtcdp);
originPort.commName = "updateRules" + firewallNode.getName();
originPort.isOrigin = true;
destPort.isOrigin = false;
destPort.commName = "updateRules" + firewallNode.getName();
//Connect Evt ports
conn = new TMLCPortConnector(0, 0, newtcdp.getMinX(), newtcdp.getMaxX(), newtcdp.getMinY(), newtcdp.getMaxX(), true, null, newtcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>());
newtcdp.addComponent(conn, 0, 0, false, true);
originPort.typep = 1;
destPort.typep = 1;
originPort.setParam(0, new TType(1));
destPort.setParam(0, new TType(1));
originPort.setParam(1, new TType(2));
destPort.setParam(1, new TType(2));
newtcdp.addComponent(originPort, taskcomp.getX(), taskcomp.getY(), true, true);
newtcdp.addComponent(destPort, firewallComp.getX(), firewallComp.getY(), true, true);
updateRulesAdded = true;
List<String> firewallChans = new ArrayList<String>();
for (TMLChannel chan : channelsCopy) {
TMLTask orig = chan.getOriginTask();
TMLTask dest = chan.getDestinationTask();
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
//If firewall does not filter these tasks, continue on
if (!pathExists(map, firewallNode, orig) || !pathExists(map, firewallNode, dest) || !pathIncludes(map, orig, dest, firewallNode)) {
//toAdd.add(chan);
continue;
}
firewallChans.add(chan.getName().split("__")[chan.getName().split("__").length - 1]);
System.out.println("REMOVING " + chan.getName());
chansToRemove.add(chan.getName().split("__")[1]);
channelIndexMap.put(chan.getName().split("__")[1], index);
index++;
TMLPort origPort = chan.getOriginPort();
TMLPort destPort = chan.getDestinationPort();
TMLChannel wr = new TMLChannel(chan.getName().split("__")[1] + "_firewallIn", chan.getReferenceObject());
//Specify new channel attributes
wr.setSize(chan.getSize());
wr.setMax(chan.getMax());
wr.setPorts(origPort, destPort);
wr.setType(TMLChannel.BRBW);
wr.setPriority(chan.getPriority());
wr.setTasks(orig, firewall);
TMLChannel rd = new TMLChannel(chan.getName().split("__")[1] + "_firewallOut", chan.getReferenceObject());
rd.setTasks(firewall, dest);
rd.setSize(chan.getSize());
rd.setMax(chan.getMax());
rd.setPorts(origPort, destPort);
rd.setType(TMLChannel.BRBW);
rd.setPriority(chan.getPriority());
inChans.put(chan, wr);
outChans.put(chan, rd);
toAdd.add(rd);
toAdd.add(wr);
map.getCorrespondanceList().addCor(rd, (TGComponent) rd.getReferenceObject());
map.getCorrespondanceList().addCor(wr, (TGComponent) wr.getReferenceObject());
}
List<TGComponent> tmpRemove = new ArrayList<TGComponent>();
for (TGComponent tg : newtcdp.getComponentList()) {
if (tg instanceof TMLCPrimitiveComponent) {
TMLCPrimitiveComponent taskcomp = (TMLCPrimitiveComponent) tg;
for (TMLCPrimitivePort port : taskcomp.getAllChannelsOriginPorts()) {
//System.out.println("chantoremove " + chansToRemove + " " + port.getPortName());
if (chansToRemove.contains(port.getPortName())) {
//System.out.println("Removing " + port);
tmpRemove.add(port);
}
}
for (TMLCPrimitivePort port : taskcomp.getAllChannelsDestinationPorts()) {
if (chansToRemove.contains(port.getPortName())) {
tmpRemove.add(port);
}
}
}
}
for (TGComponent tg : tmpRemove) {
newtcdp.removeComponent(tg);
}
//Build activity diagram
//Get start state
adStart = (TMLADStartState) firewallADP.getComponentList().get(0);
if (inChans.keySet().size() == 0) {
TMLADStopState stop = new TMLADStopState(100, 100, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(stop, 100, 100, false, true);
//Connect stop and start
TGConnector tmp = new TGConnectorTMLAD(100, 100, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, null, null, new Vector<Point>());
tmp.setP1(adStart.getTGConnectingPointAtIndex(0));
tmp.setP2(stop.getTGConnectingPointAtIndex(0));
firewallADP.addComponent(tmp, 100, 100, false, true);
continue;
}
//Add request
req = new TMLADReadRequestArg(300, 100, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(req, 300, 100, false, true);
req.setParam(0, "index");
req.makeValue();
TGConnector tmp = new TGConnectorTMLAD(req.getX(), req.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adStart.getTGConnectingPointAtIndex(0), req.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, req.getX(), req.getY(), false, true);
//add choice between update and channel filter
adChoiceMain = new TMLADChoice(400, 300, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(adChoiceMain, 400, 300, false, true);
adChoiceMain.setGuard("[index==0]", 0);
adChoiceMain.setGuard("[else]", 1);
tmp = new TGConnectorTMLAD(adChoiceMain.getX(), adChoiceMain.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, req.getTGConnectingPointAtIndex(1), adChoiceMain.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, adChoiceMain.getX(), adChoiceMain.getY(), false, true);
//Add guard
//Add choice between channels
adChoice = new TMLADChoice(800, 400, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(adChoice, 400, 300, false, true);
tmp = new TGConnectorTMLAD(adChoice.getX(), adChoice.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adChoiceMain.getTGConnectingPointAtIndex(2), adChoice.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, adChoice.getX(), adChoice.getY(), false, true);
//Add waitEvent and updateRules activity
TMLADWaitEvent evt = new TMLADWaitEvent(100, 300, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
evt.setEventName("updateRules" + firewallNode.getName());
evt.setParam("channelIndex", 0);
evt.setParam("rule", 1);
evt.makeValue();
firewallADP.addComponent(evt, 100, 300, false, true);
//Connect choice and waitevent
//Add updaterules choice
TMLADChoice adChoiceRules = new TMLADChoice(100, 400, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(adChoiceRules, 100, 400, false, true);
tmp = new TGConnectorTMLAD(adChoice.getX(), adChoice.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adChoiceMain.getTGConnectingPointAtIndex(1), evt.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, adChoice.getX(), adChoice.getY(), false, true);
adChoiceMain.setGuard("[index==0]", 0);
adChoiceMain.setGuard("[else]", 1);
//Add connector between evt and updaterules choice
tmp = new TGConnectorTMLAD(adChoice.getX(), adChoice.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, evt.getTGConnectingPointAtIndex(1), adChoiceRules.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, adChoice.getX(), adChoice.getY(), false, true);
//for each channel, add the rule change and guard
int i = 1;
for (TMLChannel chan : inChans.keySet()) {
if (i > 3) {
break;
}
TMLADActionState action = new TMLADActionState(100 * i, 500, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(action, 100 * i, 500, false, true);
action.setValue(chan.getName().split("__")[1] + "Allowed=rule");
//Connect choice and action
TAttribute channelRule = new TAttribute(2, chan.getName().split("__")[1] + "Allowed", "true", 4);
firewallComp.getAttributeList().add(channelRule);
tmp = new TGConnectorTMLAD(action.getX(), action.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adChoiceRules.getTGConnectingPointAtIndex(i), action.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, action.getX(), action.getY(), false, true);
adChoiceRules.setGuard("[channelIndex==" + channelIndexMap.get(chan.getName().split("__")[1]) + "]", i - 1);
//add stop state
adStop = new TMLADStopState(100 * i, 600, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(adStop, 100 * i, 600, false, true);
//Connect action and stop state
tmp = new TGConnectorTMLAD(action.getX(), action.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, action.getTGConnectingPointAtIndex(1), adStop.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, action.getX(), action.getY(), false, true);
TMLChannel newChan = inChans.get(chan);
TMLCChannelOutPort originPort = new TMLCChannelOutPort(0, 0, tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, null, tcp.tmlctdp);
TMLCChannelOutPort destPort = new TMLCChannelOutPort(0, 0, tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, null, tcp.tmlctdp);
for (TGComponent tg : tcp.tmlctdp.getComponentList()) {
if (tg instanceof TMLCPrimitiveComponent) {
if (tg.getValue().equals(newChan.getOriginTask().getName().split("__")[1])) {
originPort = new TMLCChannelOutPort(tg.getX(), tg.getY(), tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, tg, tcp.tmlctdp);
originPort.commName = newChan.getName();
tcp.tmlctdp.addComponent(originPort, tg.getX(), tg.getY(), true, true);
} else if (tg.getValue().equals(firewallNode.getName())) {
destPort = new TMLCChannelOutPort(tg.getX(), tg.getY(), tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, tg, tcp.tmlctdp);
destPort.isOrigin = false;
destPort.commName = newChan.getName();
tcp.tmlctdp.addComponent(destPort, tg.getX(), tg.getY(), true, true);
}
}
}
TMLCPortConnector conn = new TMLCPortConnector(0, 0, tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, null, tcp.tmlctdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>());
tcp.tmlctdp.addComponent(conn, 0, 0, false, true);
originPort = new TMLCChannelOutPort(0, 0, tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, null, tcp.tmlctdp);
destPort = new TMLCChannelOutPort(0, 0, tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, null, tcp.tmlctdp);
TMLChannel wrChan = outChans.get(chan);
for (TGComponent tg : tcp.tmlctdp.getComponentList()) {
if (tg instanceof TMLCPrimitiveComponent) {
if (tg.getValue().equals(firewallNode.getName())) {
originPort = new TMLCChannelOutPort(tg.getX(), tg.getY(), tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, tg, tcp.tmlctdp);
originPort.commName = wrChan.getName();
tcp.tmlctdp.addComponent(originPort, tg.getX(), tg.getY(), true, true);
} else if (tg.getValue().equals(wrChan.getDestinationTask().getName().split("__")[1])) {
destPort = new TMLCChannelOutPort(tg.getX(), tg.getY(), tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, tg, tcp.tmlctdp);
destPort.isOrigin = false;
destPort.commName = wrChan.getName();
tcp.tmlctdp.addComponent(destPort, tg.getX(), tg.getY(), true, true);
}
}
}
conn = new TMLCPortConnector(0, 0, tcp.tmlctdp.getMinX(), tcp.tmlctdp.getMaxX(), tcp.tmlctdp.getMinY(), tcp.tmlctdp.getMaxX(), true, null, tcp.tmlctdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>());
tcp.tmlctdp.addComponent(conn, 0, 0, false, true);
i++;
}
int xpos = 700;
int ypos = 100;
i = 1;
for (TMLChannel chan : inChans.keySet()) {
if (i > 3) {
break;
}
adChoice.setGuard("[index==" + channelIndexMap.get(chan.getName().split("__")[1]) + "]", i - 1);
TMLChannel newChan = inChans.get(chan);
adRC = new TMLADReadChannel(xpos, 450, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
adRC.setChannelName(newChan.getName());
adRC.setSamples("1");
tmp = new TGConnectorTMLAD(adRC.getX(), adRC.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adChoice.getTGConnectingPointAtIndex(i), adRC.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, adRC.getX(), adRC.getY(), false, true);
firewallADP.addComponent(adRC, xpos, 450, false, true);
//Execute for latency value
exec = new TMLADExecI(xpos, 500, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
exec.setDelayValue(Integer.toString(firewallNode.latency));
firewallADP.addComponent(exec, xpos, 500, false, true);
tmp = new TGConnectorTMLAD(exec.getX(), exec.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adRC.getTGConnectingPointAtIndex(1), exec.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, exec.getX(), exec.getY(), false, true);
adChoice2 = new TMLADChoice(xpos, 550, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(adChoice2, 550, 300, false, true);
tmp = new TGConnectorTMLAD(exec.getX(), exec.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, exec.getTGConnectingPointAtIndex(1), adChoice2.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, exec.getX(), exec.getY(), false, true);
adWC = new TMLADWriteChannel(xpos - 50, 600, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
adWC.setChannelName(wrChan.getName());
adWC.setSamples("1");
firewallADP.addComponent(adWC, xpos - 50, 600, false, true);
tmp = new TGConnectorTMLAD(exec.getX(), exec.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adChoice2.getTGConnectingPointAtIndex(1), adWC.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, exec.getX(), exec.getY(), false, true);
adStop = new TMLADStopState(xpos - 50, 650, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(adStop, xpos - 50, 650, false, true);
tmp = new TGConnectorTMLAD(adStop.getX(), adStop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adWC.getTGConnectingPointAtIndex(1), adStop.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, adStop.getX(), adStop.getY(), false, true);
// } else {
adStop2 = new TMLADStopState(xpos + 50, 650, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP);
firewallADP.addComponent(adStop2, xpos + 50, 650, false, true);
tmp = new TGConnectorTMLAD(adStop.getX(), adStop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null, firewallADP, adChoice2.getTGConnectingPointAtIndex(2), adStop2.getTGConnectingPointAtIndex(0), new Vector<Point>());
firewallADP.addComponent(tmp, adStop.getX(), adStop.getY(), false, true);
// }
xpos += 200;
i++;
TMLStartState start = new TMLStartState("start", adStart);
act.setFirst(start);
map.getCorrespondanceList().addCor(start, adStart);
System.out.println("MODIFIED " + modifiedTasks);
//Replace channel operator with new firewallIn and firewallOut operators
System.out.println("firewallchans " + firewallChans);
for (TMLTask task : map.getTMLModeling().getTasks()) {
//Get activity diagram
TMLActivityDiagramPanel tad = tcp.getTMLActivityDiagramPanel(task.getName());
TGConnector fromStart = new TGConnectorTMLAD(0, 0, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector<Point>());
List<TMLADWriteChannel> wrChans = new ArrayList<TMLADWriteChannel>();
List<TMLADReadChannel> rdChans = new ArrayList<TMLADReadChannel>();
for (TGComponent tg : tad.getComponentList()) {
if (tg instanceof TMLADWriteChannel) {
TMLADWriteChannel writeChannel = (TMLADWriteChannel) tg;
if (fromStart != null) {
wrChans.add(writeChannel);
}
}
if (tg instanceof TMLADReadChannel) {
TMLADReadChannel readChannel = (TMLADReadChannel) tg;
if (fromStart != null) {
rdChans.add(readChannel);
}
}
/* former HEAD
TMLActivityDiagramPanel tad = tcp.getTMLActivityDiagramPanel(task.getName());
TGConnector fromStart = new TGConnectorTMLAD(0, 0, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector<Point>());
List<TMLADWriteChannel> wrChans = new ArrayList<TMLADWriteChannel>();
List<TMLADReadChannel> rdChans = new ArrayList<TMLADReadChannel>();
for (TGComponent tg : tad.getComponentList()) {
if (tg instanceof TMLADWriteChannel) {
TMLADWriteChannel writeChannel = (TMLADWriteChannel) tg;
if (fromStart != null) {
wrChans.add(writeChannel);
}
}
if (tg instanceof TMLADReadChannel) {
TMLADReadChannel readChannel = (TMLADReadChannel) tg;
if (fromStart != null) {
rdChans.add(readChannel);
}
}
}
//For each writeChannel, add request operator, rename channel
xpos = wr.getX();
ypos = wr.getY();
fromStart = tad.findTGConnectorEndingAt(wr.getTGConnectingPointAtIndex(0));
//TGConnectingPoint point = fromStart.getTGConnectingPointP2();
======= */
}
//For each writeChannel, add request operator, rename channel
for (TMLADWriteChannel wr : wrChans) {
//Check if it goes through the firewall
String chanName = wr.getChannelName();
if (firewallChans.contains(chanName)) {
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
xpos = wr.getX();
ypos = wr.getY();
fromStart = tad.findTGConnectorEndingAt(wr.getTGConnectingPointAtIndex(0));
TGConnectingPoint point = fromStart.getTGConnectingPointP2();
//>>>>>>> labsoc_sec
int yShift = 50;
TMLADSendRequest sendreq = new TMLADSendRequest(xpos, ypos, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad);
sendreq.setRequestName("req" + firewallNode.getName());
if (channelIndexMap.containsKey(chanName)) {
sendreq.setParam(0, Integer.toString(channelIndexMap.get(chanName)));
}
sendreq.makeValue();
tad.addComponent(sendreq, xpos, ypos, false, true);
//Re-route connector to sendreq
fromStart.setP2(sendreq.getTGConnectingPointAtIndex(0));
//Add connector between sendreq and writechannel
fromStart = new TGConnectorTMLAD(wr.getX(), wr.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, sendreq.getTGConnectingPointAtIndex(1), wr.getTGConnectingPointAtIndex(0), new Vector<Point>());
tad.addComponent(fromStart, xpos, ypos, false, true);
wr.setChannelName(chanName + "_firewallIn");
wr.makeValue();
//Shift everything below sendreq down
for (TGComponent tg : tad.getComponentList()) {
if (tg.getY() >= ypos && tg != sendreq) {
tg.setCd(tg.getX(), tg.getY() + yShift);
}
}
for (TMLADReadChannel rd : rdChans) {
//check if it goes through the firewall
String chanName = rd.getChannelName();
if (firewallChans.contains(chanName)) {
rd.setChannelName(chanName + "_firewallOut");
rd.makeValue();
}
}
}
//Redo syntax checking
GTMLModeling gtm = new GTMLModeling(newarch, true);
@SuppressWarnings("unchecked")
public void setTMLMapping(TMLMapping tmap) {
this.tmap = tmap;
}
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
public HashMap<String, HashSet<String>> getCPUTaskMap() {
HashMap<String, HashSet<String>> cpuTaskMap = new HashMap<String, HashSet<String>>();
if (tmap == null) {
return cpuTaskMap;
}
for (HwNode node : tmap.getArch().getCPUs()) {
if (tmap.getMappedTasks(node).size() > 0) {
cpuTaskMap.put(node.getName(), tmap.getMappedTasks(node));
}
}
return cpuTaskMap;
}
public void addHSM(MainGUI gui, Map<String, List<String>> selectedCpuTasks) {
HSMGeneration hsm = new HSMGeneration(gui, selectedCpuTasks, tmap);
hsm.startThread();
}
@SuppressWarnings("unchecked")
public boolean generateGraphicalMapping(TMLMapping map) {
TURTLEPanel tmlap = tmap.getCorrespondanceList().getTG(tmap.getArch().getFirstCPU()).getTDiagramPanel().tp;
int arch = mgui.tabs.indexOf(tmlap);
mgui.cloneRenameTab(arch, "Z3");
TMLArchiPanel newArch = (TMLArchiPanel) mgui.tabs.get(mgui.tabs.size() - 1);
TMLArchiDiagramPanel panel = newArch.tmlap;
if (panel == null) {
return false;
}
panel.removeAllArtifacts();
List<HwExecutionNode> nodes = map.getNodes();
HwExecutionNode node;
List<TMLTask> tasks = map.getMappedTasks();
TMLTask task;
for (int i = 0; i < nodes.size(); i++) {
node = nodes.get(i);
task = tasks.get(i);
if ((node != null) && (task != null)) {
if (!panel.addTaskToNode(node.getName(), task.getName())) {
TraceManager.addDev("Could not add " + task.getName() + " to " + node.getName());
TraceManager.addDev("Task " + task.getName() + " was added to " + node.getName());
}
}
}
return true;
}
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
public TMLMapping<TGComponent> autoSecure(MainGUI gui, boolean autoConf, boolean autoWeakAuth, boolean autoStrongAuth) {
//TODO add more options
//
if (tmap == null) {
return null;
}
TURTLEPanel tmlap = tmap.getCorrespondanceList().getTG(tmap.getArch().getFirstCPU()).getTDiagramPanel().tp;
int arch = gui.tabs.indexOf(tmlap);
gui.cloneRenameTab(arch, "enc");
TMLArchiPanel newarch = (TMLArchiPanel) gui.tabs.get(gui.tabs.size() - 1);
return autoSecure(gui, "enc", tmap, newarch, autoConf, autoWeakAuth, autoStrongAuth);
}
public TMLMapping<TGComponent> autoSecure(MainGUI gui, String name, TMLMapping<TGComponent> map, TMLArchiPanel newarch) {
return autoSecure(gui, name, map, newarch, "100", "0", "100", true, false, false, new HashMap<String, java.util.List<String>>());
}
public TMLMapping<TGComponent> autoSecure(MainGUI gui, String name, TMLMapping<TGComponent> map, TMLArchiPanel newarch, boolean autoConf,
boolean autoWeakAuth, boolean autoStrongAuth) {
return autoSecure(gui, name, map, newarch, "100", "0", "100", autoConf, autoWeakAuth, autoStrongAuth, new HashMap<String, java.util.List<String>>());
}
public TMLMapping<TGComponent> autoSecure(MainGUI gui, String encComp, String overhead, String decComp) {
if (tmap == null) {
return null;
}
TURTLEPanel tmlap = tmap.getCorrespondanceList().getTG(tmap.getArch().getFirstCPU()).getTDiagramPanel().tp;
int arch = gui.tabs.indexOf(tmlap);
gui.cloneRenameTab(arch, "enc");
TMLArchiPanel newarch = (TMLArchiPanel) gui.tabs.get(gui.tabs.size() - 1);
return autoSecure(gui, "enc", tmap, newarch, encComp, overhead, decComp, true, false, false, new HashMap<String, java.util.List<String>>());
}
public TMLMapping<TGComponent> autoSecure(MainGUI gui, String encComp, String overhead, String decComp, boolean autoConf, boolean autoWeakAuth,
boolean autoStrongAuth, Map<String, List<String>> selectedCpuTasks) {
if (tmap == null) {
return null;
}
TURTLEPanel tmlap = tmap.getCorrespondanceList().getTG(tmap.getArch().getFirstCPU()).getTDiagramPanel().tp;
int arch = gui.tabs.indexOf(tmlap);
gui.cloneRenameTab(arch, "enc");
TMLArchiPanel newarch = (TMLArchiPanel) gui.tabs.get(gui.tabs.size() - 1);
return autoSecure(gui, "enc", tmap, newarch, encComp, overhead, decComp, autoConf, autoWeakAuth, autoStrongAuth, selectedCpuTasks);
}
public TMLMapping<TGComponent> autoSecure(MainGUI gui, String name, TMLMapping<TGComponent> map, TMLArchiPanel newarch, String encComp, String
overhead, String decComp) {
return autoSecure(gui, name, tmap, newarch, encComp, overhead, decComp, true, false, false, new HashMap<String, java.util.List<String>>());
}
public TMLMapping<TGComponent> autoSecure(MainGUI gui, String name, TMLMapping<TGComponent> map, TMLArchiPanel newarch, String encComp, String overhead, String decComp, boolean autoConf, boolean autoWeakAuth, boolean autoStrongAuth, Map<String, List<String>> selectedCpuTasks) {
//move to another thread
SecurityGeneration secgen = new SecurityGeneration(gui, name, map, newarch, encComp, overhead, decComp, autoConf, autoWeakAuth, autoStrongAuth, selectedCpuTasks);
tmap = null;
tmap = secgen.startThread();
GTMLModeling gtm = new GTMLModeling(newarch, true);
tmap = gtm.translateToTMLMapping();
listE = gtm.getCorrespondanceTable();
if (tmap != null) {
autoMapKeys();
}
return tmap;
}
public boolean securePath(TMLMapping<TGComponent> map, TMLTask t1, TMLTask t2) {
//Check if a path between two tasks is secure
boolean secure = true;
List<HwLink> links = map.getTMLArchitecture().getHwLinks();
HwExecutionNode node1 = map.getHwNodeOf(t1);
HwExecutionNode node2 = map.getHwNodeOf(t2);
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
List<HwNode> found = new ArrayList<HwNode>();
List<HwNode> done = new ArrayList<HwNode>();
List<HwNode> path = new ArrayList<HwNode>();
Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>();
TraceManager.addDev("Links " + links);
if (node1 == node2) {
return true;
}
for (HwLink link : links) {
if (link.hwnode == node1) {
found.add(link.bus);
List<HwNode> tmp = new ArrayList<HwNode>();
tmp.add(link.bus);
pathMap.put(link.bus, tmp);
}
}
outerloop:
while (found.size() > 0) {
HwNode curr = found.remove(0);
for (HwLink link : links) {
if (curr == link.bus) {
if (link.hwnode == node2) {
path = pathMap.get(curr);
break outerloop;
}
if (!done.contains(link.hwnode) && !found.contains(link.hwnode) && link.hwnode instanceof HwBridge) {
found.add(link.hwnode);
List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr));
tmp.add(link.hwnode);
pathMap.put(link.hwnode, tmp);
}
} else if (curr == link.hwnode) {
if (!done.contains(link.bus) && !found.contains(link.bus)) {
found.add(link.bus);
List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr));
tmp.add(link.bus);
pathMap.put(link.bus, tmp);
}
}
}
done.add(curr);
}
if (path.size() == 0) {
return true;
} else {
HwBus bus;
//Check if all buses and bridges are private
for (HwNode n : path) {
if (n instanceof HwBus) {
bus = (HwBus) n;
if (bus.privacy == 0) {
return false;
}
}
}
}
return secure;
}
public void autoMapKeys() {
if (tmap == null) {
return;
}
List<HwLink> links = tmap.getArch().getHwLinks();
//Find all Security Patterns, if they don't have an associated memory at encrypt and decrypt, map them
TMLModeling<TGComponent> tmlm = tmap.getTMLModeling();
if (tmlm.securityTaskMap == null) {
return;
}
//
for (SecurityPattern sp : tmlm.securityTaskMap.keySet()) {
if (sp.type.contains("Symmetric Encryption") || sp.type.equals("MAC")) {
for (TMLTask t : tmlm.securityTaskMap.get(sp)) {
ArrayList<HwMemory> mems = new ArrayList<HwMemory>();
boolean keyFound = false;
//Try to find memory using only private buses
List<HwNode> toVisit = new ArrayList<HwNode>();
// List<HwNode> toMemory = new ArrayList<HwNode>();
List<HwNode> complete = new ArrayList<HwNode>();
for (HwLink link : links) {
if (link.hwnode == node1) {
if (link.bus.privacy == 1) {
toVisit.add(link.bus);
}
}
}
memloop:
while (toVisit.size() > 0) {
HwNode curr = toVisit.remove(0);
for (HwLink link : links) {
if (curr == link.bus) {
if (link.hwnode instanceof HwMemory) {
mems.add((HwMemory) link.hwnode);
TMLArchiMemoryNode memNode = (TMLArchiMemoryNode) listE.getTG(link.hwnode);
List<TMLArchiKey> keys = memNode.getKeyList();
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
String patternString = "";
for (TMLArchiKey key : keys) {
if (key.getValue().equals(sp.name)) {
keyFound = true;
break memloop;
}
patternString += key.getValue();
patternString += " ";
}
TraceManager.addDev("Memory " + link.hwnode.getName() + " has currently mapped: " + patternString);
}
if (!complete.contains(link.hwnode) && !toVisit.contains(link.hwnode) && link.hwnode instanceof HwBridge) {
toVisit.add(link.hwnode);
}
} else if (curr == link.hwnode) {
if (!complete.contains(link.bus) && !toVisit.contains(link.bus)) {
toVisit.add(link.bus);
}
}
}
complete.add(curr);
}
if (!keyFound) {
if (mems.size() > 0) {
TMLArchiMemoryNode memNode = (TMLArchiMemoryNode) listE.getTG(mems.get(0));
TMLArchiKey key = new TMLArchiKey(memNode.x, memNode.y, memNode.tdp.getMinX(), memNode.tdp.getMaxX(), memNode.tdp.getMinY(), memNode.tdp.getMaxY(), false, memNode, memNode.tdp);
key.setReferenceKey(sp.name);
key.makeFullValue();
TraceManager.addDev("Adding " + sp.name + " key to " + memNode.getName());
TraceManager.addDev("Adding " + sp + " key to " + memNode.getName());
memNode.tdp.addComponent(key, memNode.x, memNode.y, true, true);
memNode.tdp.repaint();
} else {
//
// mgui.issueError("Cannot map key in memory for " + sp.name + " on task " + t.getName(), "Key Mapping Error");
UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Cannot find secure memory to map key " + sp.name + " for task " + t.getName());
ce.setTDiagramPanel(tmap.getCorrespondanceList().getTG(tmap.getArch().getFirstCPU()).getTDiagramPanel());
ce.setTGComponent(null);
checkingErrors.add(ce);
}
}
}
} else if (sp.type.contains("Asymmetric Encryption")) {
for (TMLTask t : tmlm.securityTaskMap.get(sp)) {
ArrayList<HwMemory> mems = new ArrayList<HwMemory>();
boolean keyFound = false;
//Try to find memory using only private buses
List<HwNode> toVisit = new ArrayList<HwNode>();
// List<HwNode> toMemory = new ArrayList<HwNode>();
List<HwNode> complete = new ArrayList<HwNode>();
for (HwLink link : links) {
if (link.hwnode == node1) {
if (link.bus.privacy == 1) {
toVisit.add(link.bus);
}
}
}
memloop:
while (toVisit.size() > 0) {
HwNode curr = toVisit.remove(0);
for (HwLink link : links) {
if (curr == link.bus) {
if (link.hwnode instanceof HwMemory) {
mems.add((HwMemory) link.hwnode);
TMLArchiMemoryNode memNode = (TMLArchiMemoryNode) listE.getTG(link.hwnode);
List<TMLArchiKey> keys = memNode.getKeyList();
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
String patternString = "";
for (TMLArchiKey key : keys) {
if (key.getValue().equals(sp.name)) {
keyFound = true;
break memloop;
}
patternString += key.getValue();
patternString += " ";
}
TraceManager.addDev("Memory " + link.hwnode.getName() + " has currently mapped: " + patternString);
}
if (!complete.contains(link.hwnode) && !toVisit.contains(link.hwnode) && link.hwnode instanceof HwBridge) {
toVisit.add(link.hwnode);
}
} else if (curr == link.hwnode) {
if (!complete.contains(link.bus) && !toVisit.contains(link.bus)) {
toVisit.add(link.bus);
}
}
}
complete.add(curr);
}
if (!keyFound) {
if (mems.size() > 0) {
TMLArchiMemoryNode memNode = (TMLArchiMemoryNode) listE.getTG(mems.get(0));
TMLArchiKey key = new TMLArchiKey(memNode.x, memNode.y, memNode.tdp.getMinX(), memNode.tdp.getMaxX(), memNode.tdp.getMinY(), memNode.tdp.getMaxY(), false, memNode, memNode.tdp);
key.setReferenceKey(sp.name);
key.makeFullValue();
TraceManager.addDev("Adding " + sp.name + " key to " + memNode.getName());
TraceManager.addDev("Adding " + sp + " key to " + memNode.getName());
memNode.tdp.addComponent(key, memNode.x, memNode.y, true, true);
memNode.tdp.repaint();
} else {
UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Key " + sp.name + " on task " + t.getName() + " cannot be mapped since no memory can be accessed surely from this task.");
ce.setTDiagramPanel(tmap.getCorrespondanceList().getTG(tmap.getArch().getFirstCPU()).getTDiagramPanel());
ce.setTGComponent(null);
checkingErrors.add(ce);
}
}
}
}
}
TraceManager.addDev("Mapping finished");
}
public boolean generateFullAvatarFromTML() {
tmap = tmlm.getDefaultMapping();
FullTML2Avatar t2a = new FullTML2Avatar(tmlm);
TraceManager.addDev("Avatar spec generation");
avatarspec = t2a.generateAvatarSpec("1");
TraceManager.addDev("Avatar spec generated");
AvatarSyntaxChecker asc = new AvatarSyntaxChecker();
//TraceManager.addDev("Avatar spec:" + avatarspec.toString());
//mgui.drawAvatarSpecification(avatarspec);
//TraceManager.addDev("Avatar spec:" + avatarspec.toString());
//AvatarSpecification av2 = avatarspec.advancedClone();
//mgui.drawAvatarSpecification(av2);
public void generateAvatarFromTML(boolean mc, boolean security) {
TraceManager.addDev("Generating Avatar from TML");
if (tmlm != null && tmap == null) {
tmap = tmlm.getDefaultMapping();
}
if (avatarspec != null) {
return;
} else if (tmap != null) {
t2a = new TML2Avatar(tmap, mc, security);
TraceManager.addDev("Avatar spec generation");
avatarspec = t2a.generateAvatarSpec("1");
TraceManager.addDev("Avatar spec generation: done");
if (mgui.isExperimentalOn()) {
mgui.drawAvatarSpecification(avatarspec);
}
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
public boolean generateRandomMapping(String[] tasks, String architectureName, String mappingName) {
TraceManager.addDev("Getting panel");
// Get the architecture panel
TURTLEPanel tp = mgui.getTURTLEPanel(architectureName);
if (tp == null) {
return false;
}
// Clone this panel
int indexArch = mgui.getIndexOfPanel(tp);
if (indexArch < 0) {
return false;
}
mgui.cloneRenameTab(indexArch, mappingName);
TraceManager.addDev("Select last panel");
// Select the last Panel
TURTLEPanel newTP = mgui.getTabs().get(mgui.getTabs().size() - 1);
if (newTP == null) {
TraceManager.addDev("Null selected panel");
}
if (!(newTP instanceof TMLArchiPanel)) {
return false;
}
TraceManager.addDev("add Tasks");
TMLArchiPanel mapping = (TMLArchiPanel) newTP;
return mapping.addRandomTasks(tasks);
}
public boolean generateProVerifFromAVATAR(String _path, int _stateReachability, boolean _typed, boolean allowPrivateChannelDuplication, String loopLimit) {
//
if (avatarspec != null) {
//use avspec
} else if (tmap != null) {
t2a = new TML2Avatar(tmap, false, true);
avatarspec = t2a.generateAvatarSpec(loopLimit);
if (mgui.isExperimentalOn()) {
drawPanel(avatarspec, mgui.getFirstAvatarDesignPanelFound());
}
} else if (tmlm != null) {
//Generate default mapping
tmap = tmlm.getDefaultMapping();
t2a = new TML2Avatar(tmap, false, true);
avatarspec = t2a.generateAvatarSpec(loopLimit);