final RTValue[] ordinalValues = new RTValue[nOrdinalFields];
for (int i = 0; i < nOrdinalFields; ++i) {
final Map.Entry<?, ?> inputEntry = (Map.Entry<?, ?>)inputEntrySetIterator.next();
final FieldName fieldName = (FieldName)inputEntry.getKey();
if (!(fieldName instanceof FieldName.Ordinal)
|| ((FieldName.Ordinal)fieldName).getOrdinal() != recordDict.getNthOrdinalFieldName(i)) {
throw new IllegalArgumentException("The field names of the input map and target record must match exactly.");
}
final RTValue fieldDict = recordDict.getNthOrdinalValue(i);
final RTValue fieldValue = RTData.CAL_Opaque.make(inputEntry.getValue());
//compute "Prelude.input fieldDict fieldValue"
//this is just (after inlining Prelude.input d = d)
//fieldDict fieldValue
ordinalValues[i] = fieldDict.apply(fieldValue);
}
if (nTextualFields > 0) {
final RTValue[] textualValues = new RTValue[nTextualFields];
for (int i = 0; i < nTextualFields; ++i) {
final Map.Entry<?, ?> inputEntry = (Map.Entry<?, ?>)inputEntrySetIterator.next();
final FieldName fieldName = (FieldName)inputEntry.getKey();
if (!(fieldName instanceof FieldName.Textual)
|| (fieldName.getCalSourceForm() != recordDict.getNthTextualFieldName(i))) {
throw new IllegalArgumentException("The field names of the input map and target record must match exactly.");
}
final RTValue fieldDict = recordDict.getNthTextualValue(i);
final RTValue fieldValue = RTData.CAL_Opaque.make(inputEntry.getValue());
textualValues[i] = fieldDict.apply(fieldValue);
}
return recordDict.makeFromValues(ordinalValues, textualValues);
}
return recordDict.makeFromValues(ordinalValues, null);
}
if (nTextualFields > 0) {
final Iterator<?> inputEntrySetIterator = fieldNameSortedInputMap.entrySet().iterator();
final RTValue[] textualValues = new RTValue[nTextualFields];
for (int i = 0; i < nTextualFields; ++i) {
final Map.Entry<?, ?> inputEntry = (Map.Entry<?, ?>)inputEntrySetIterator.next();
final FieldName fieldName = (FieldName)inputEntry.getKey();
if (!(fieldName instanceof FieldName.Textual)
|| !(fieldName.getCalSourceForm().equals(recordDict.getNthTextualFieldName(i)))) {
throw new IllegalArgumentException("The field names of the input map and target record must match exactly.");
}
final RTValue fieldDict = recordDict.getNthTextualValue(i);
final RTValue fieldValue = RTData.CAL_Opaque.make(inputEntry.getValue());