// not have declared type, form type constraint.
if ((sourcePort.getContainer() == this)
&& (destinationPort.getContainer() == this)) {
// Both ports belong to this, so their type must be equal.
// Represent this with two inequalities.
Inequality ineq1 = new Inequality(sourcePort.getTypeTerm(),
destinationPort.getTypeTerm());
result.add(ineq1);
Inequality ineq2 = new Inequality(destinationPort
.getTypeTerm(), sourcePort.getTypeTerm());
result.add(ineq2);
} else if (sourcePort.getContainer().equals(this)) {
if (sourcePort.sourcePortList().size() == 0) {
// Skip this port. It is not connected on the outside.
continue;
}
// Require the source port to be an array.
Inequality arrayInequality = new Inequality(
ArrayType.ARRAY_BOTTOM, sourcePort.getTypeTerm());
result.add(arrayInequality);
// Next require that the element type of the
// source port array be compatible with the
// destination port.
try {
Inequality ineq = new Inequality(ArrayType
.elementType(sourcePort), destinationPort
.getTypeTerm());
result.add(ineq);
} catch (IllegalActionException e) {
throw new InternalErrorException(e);
}
} else if (destinationPort.getContainer().equals(this)) {
// Require that the destination port type be an array
// with elements compatible with the source port.
try {
Inequality ineq = new Inequality(ArrayType
.arrayOf(sourcePort), destinationPort
.getTypeTerm());
result.add(ineq);
} catch (IllegalActionException e) {
throw new InternalErrorException(e);