// Pack a HashMap with all of the record entries from
// the original record and all of the updating ports.
HashMap outputMap = new HashMap();
RecordToken record = (RecordToken) input.get(0);
Set recordLabels = record.labelSet();
for (Iterator i = recordLabels.iterator(); i.hasNext();) {
String name = (String) i.next();
Token value = record.get(name);
outputMap.put(name, value);
}
List inputPorts = inputPortList();
Iterator inputPortsIterator = inputPorts.iterator();
while (inputPortsIterator.hasNext()) {
TypedIOPort inputPort = (TypedIOPort) inputPortsIterator.next();
if (inputPort != input) {
outputMap.put(inputPort.getName(), inputPort.get(0));
}
}
// Construct a RecordToken and fill it with the values
// in the HashMap.
String[] labels = new String[outputMap.size()];
Token[] values = new Token[outputMap.size()];
int j = 0;
for (Iterator i = outputMap.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
labels[j] = (String) entry.getKey();
values[j] = (Token) entry.getValue();
j++;
}
RecordToken result = new RecordToken(labels, values);
output.send(0, result);
}