int gatePinNumber = connection.getGatePinNumber();
switch (connection.getType()) {
case Connection.TO_INTERNAL:
if (isLegalFromPartEdge(connection, part))
graph.addEdge(part, getPinInfo(INTERNAL_PIN_TYPE, gatePinNumber));
break;
case Connection.FROM_INTERNAL:
if (isLegalToPartEdge(connection, part))
graph.addEdge(getPinInfo(INTERNAL_PIN_TYPE, gatePinNumber), part);