protected void convertDeltaRemovePorts(String subSys, DeltaMontiArcModelBuilder builder) { List<SimulinkPort> inPorts = loadPorts(subSys, true); List<SimulinkPort> outPorts = loadPorts(subSys, false); List<SimulinkPort> inPortsToRemove = new ArrayList<SimulinkPort>(); List<SimulinkPort> outPortsToRemove = new ArrayList<SimulinkPort>(); for (SimulinkPort in : inPorts) { DeltaOperation op = getDeltaOperationForElement(in.getQualifiedName()); switch (op) { case REMOVE: inPortsToRemove.add(in); break; default: break; } } for (SimulinkPort out : outPorts) { DeltaOperation op = getDeltaOperationForElement(out.getQualifiedName()); switch (op) { case REMOVE: outPortsToRemove.add(out); break; default: break; } } builder.createPorts(DeltaOperation.REMOVE, inPortsToRemove, outPortsToRemove); }
protected String getPortNameByNumber(String blockName, String number, boolean inPort) { List<SimulinkPort> ports = loadPorts(blockName, inPort); for (SimulinkPort port : ports) { String portNumber = String.valueOf(port.getNumber()); // look for port with the same number if (portNumber.equals(number)) { return port.getName(); } } return ""; }