/**
   * Creates a modify subsystem block
   *
   * @param builder builder to use
   * @param subSys qualified subsystem name
   * @param simpleName simple name
   */
  protected void modifySubSystemBlock(
      DeltaMontiArcModelBuilder builder, String subSys, String simpleName) {
    String toModify = simpleName;
    int index = toModify.indexOf(DeltaSimulinkKeyWords.AOC);
    if (index != -1) {
      toModify = toModify.substring(0, index);
    }
    if (toModify.startsWith(DeltaSimulinkKeyWords.MODIFY_MODEL)) {
      toModify = toModify.substring(DeltaSimulinkKeyWords.MODIFY_MODEL.length()).trim();
      // add package for models
      toModify = MontiArcStringBuilder.EXPORT_PACKAGE + "." + toModify.trim();
    } else if (toModify.startsWith(DeltaSimulinkKeyWords.MODIFY)) {
      toModify = toModify.substring(DeltaSimulinkKeyWords.MODIFY.length()).trim();
    } else {
      handler.addError("Unable to parse modify statement!", subSys);
      return;
    }
    currentComponentName.push(toModify);
    builder.startCreateModifyComponent(toModify);

    convertDeltaAddPorts(subSys, builder);

    convertDeltaSubSystems(subSys, builder);

    convertDeltaModelBlocks(subSys, builder);

    convertDeltaConnectors(subSys, builder);

    convertDeltaRemovePorts(subSys, builder);

    convertDeltaRemoveSubSystems(subSys, builder);

    convertDeltaRemoveModelBlocks(subSys, builder);

    builder.closeBody();
    currentComponentName.pop();
  }
  protected String convertConnectorElement(String blockName, String portName) {
    String result = blockName;
    if (result.startsWith(DeltaSimulinkKeyWords.MODIFY)) {
      result = result.substring(DeltaSimulinkKeyWords.MODIFY.length());
    } else if (result.startsWith(DeltaSimulinkKeyWords.REPLACE)
        && result.contains(DeltaSimulinkKeyWords.REPLACE_WITH)) {
      result =
          result
              .substring(
                  result.lastIndexOf(DeltaSimulinkKeyWords.REPLACE_WITH)
                      + DeltaSimulinkKeyWords.REPLACE_WITH.length())
              .trim();

      int spaceIndex = result.indexOf(" ");
      // model block
      if (spaceIndex != -1) {
        result = result.substring(spaceIndex + 1);
      }
    }
    if (portName != null) {
      result = result + "." + portName;
    }
    return result;
  }