for (int i = 0; i < size; i++) {
labels[i] = ((Port) portArray[i]).getName();
types[i] = BaseType.UNKNOWN;
}
UnionType declaredType = new UnionType(labels, types);
output.setTypeEquals(declaredType);
// set the constraints between union fields and input ports
List constraints = new LinkedList();
// since the output port has a clone of the above UnionType, need to
// get the type from the output port.
UnionType outputType = (UnionType) output.getType();
Iterator inputPorts = inputPortList().iterator();
while (inputPorts.hasNext()) {
TypedIOPort inputPort = (TypedIOPort) inputPorts.next();
String label = inputPort.getName();
Inequality inequality = new Inequality(inputPort.getTypeTerm(),
outputType.getTypeTerm(label));
constraints.add(inequality);
}
return constraints;
}