use of org.openscoring.common.Field in project openscoring by openscoring.
the class ModelUtil method encodeTargetFields.
private static List<Field> encodeTargetFields(List<TargetField> targetFields) {
Function<TargetField, Field> function = new Function<TargetField, Field>() {
@Override
public Field apply(TargetField targetField) {
FieldName name = targetField.getName();
// A "phantom" default target field
if (targetField.isSynthetic()) {
name = ModelResource.DEFAULT_NAME;
}
DataField dataField = targetField.getDataField();
Field field = new Field(name.getValue());
field.setName(dataField.getDisplayName());
field.setDataType(targetField.getDataType());
field.setOpType(targetField.getOpType());
field.setValues(encodeValues(dataField));
return field;
}
};
List<Field> fields = new ArrayList<>(Lists.transform(targetFields, function));
return fields;
}
use of org.openscoring.common.Field in project openscoring by openscoring.
the class ModelUtil method encodeOutputFields.
private static List<Field> encodeOutputFields(List<OutputField> outputFields) {
Function<OutputField, Field> function = new Function<OutputField, Field>() {
@Override
public Field apply(OutputField outputField) {
FieldName name = outputField.getName();
org.dmg.pmml.OutputField pmmlOutputField = outputField.getOutputField();
Field field = new Field(name.getValue());
field.setName(pmmlOutputField.getDisplayName());
field.setDataType(outputField.getDataType());
field.setOpType(outputField.getOpType());
return field;
}
};
List<Field> fields = new ArrayList<>(Lists.transform(outputFields, function));
return fields;
}
use of org.openscoring.common.Field in project openscoring by openscoring.
the class ModelUtil method encodeInputFields.
private static List<Field> encodeInputFields(List<InputField> inputFields) {
Function<InputField, Field> function = new Function<InputField, Field>() {
@Override
public Field apply(InputField inputField) {
FieldName name = inputField.getName();
DataField dataField = (DataField) inputField.getField();
Field field = new Field(name.getValue());
field.setName(dataField.getDisplayName());
field.setDataType(inputField.getDataType());
field.setOpType(inputField.getOpType());
field.setValues(encodeValues(dataField));
return field;
}
};
List<Field> fields = new ArrayList<>(Lists.transform(inputFields, function));
return fields;
}
Aggregations