_patternToReplacement.put(pattern, replacement);
if (pattern instanceof Entity && replacement instanceof Entity) {
Entity patternEntity = (Entity) pattern;
Entity replacementEntity = (Entity) replacement;
List<?> patternPortList = patternEntity.portList();
List<?> replacementPortList = replacementEntity.portList();
for (int i = 0; i < patternPortList.size(); i++) {
Port patternPort = (Port) patternPortList.get(i);
Port replacementPort = (Port) replacementPortList.get(i);
_patternToReplacement.put(patternPort, replacementPort);
}