public Node doEvaluation (Node[] arguments, Executor executor)
throws CALExecutorException {
// Evaluate the 3 arguments.
NRecordValue recordDictionary = (NRecordValue) executor.internalEvaluate(arguments[0]);
Node genParams = executor.internalEvaluate(arguments[1]);
Node independent = executor.internalEvaluate(arguments[2]);
NValInt arbitraryMethodIndex = getIndexOfGenerateClassMethod(executor);
List<String> fieldNames = recordDictionary.fieldNames();
final int nFields = fieldNames.size();
NRecordValue result=new NRecordValue(nFields);
/*
* Loops through all fields in the record dictionary and
* invokes the arbitrary class method to
* construct each record field
*/
for (int i = 0; i < nFields; ++i) {
genParams=executor.internalEvaluate(independent.apply( new NValInt(i)).apply(genParams));
String fieldName = fieldNames.get(i);
Node valueDictionaryThunk = recordDictionary.getValue(fieldName);
result= result.insertRecordField(fieldName,
executor.internalEvaluate(valueDictionaryThunk.apply(arbitraryMethodIndex).apply(genParams)));
}
return result;
}