+ int inputCount = newPinNames.length;
+ List<String> newPinNamesList = Arrays.asList(newPinNames);
+ if (new HashSet<>(newPinNamesList).size() != inputCount)
+ throw new IllegalArgumentException("Pin names contain duplicates");
+ for (String pinName : newPinNamesList)
+ if (pinNamesListOtherSide.contains(pinName))
+ throw new IllegalArgumentException("Can't add pin. There is a pin on the other side with the same name: " + pinName);
+ super.setSize(width, Math.max(inputCount, pinNamesListOtherSide.size()) * pinDistance);
+ for (int i = 0; i < inputCount; i++)
+ {
+ String pinName = newPinNames[i];
+ int oldPinIndex = pinNamesListThisSide.indexOf(pinName);
+ if (oldPinIndex == -1)
+ super.addSubmodelInterface(pinName, logicWidth, relX, pinDistance / 2 + i * pinDistance);
+ else
+ getSupermodelMovablePin(pinName).setRelPos(relX, pinDistance / 2 + i * pinDistance);
+ }
+ for (String pinName : pinNamesListThisSide)
+ if (!newPinNamesList.contains(pinName))
+ super.removeSubmodelInterface(pinName);
+ pinNamesListThisSide.clear();
+ pinNamesListThisSide.addAll(newPinNamesList);