Class FeatureCSVWriter
Object
FeatureCSVWriter
Writes the results of feature-calculations as a CSV file.
- Author:
- Owen Feehan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The number of decimal places to use fordouble
values, unlessvisuallyShortened==true
. -
Constructor Summary
ConstructorsConstructorDescriptionFeatureCSVWriter
(CSVWriter writer, boolean visuallyShortenedDecimals) Creates for aCSVWriter
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRow
(List<TypedValue> values) Directly adds a row in the form of typed-values.void
addRow
(LabelledResultsVector results) Directly adds a row of feature-values.void
close()
Closes any open file-handles.static Optional
<FeatureCSVWriter> create
(FeatureCSVMetadata metadata, Outputter outputter, boolean visuallyShortenedDecimals) Maybe creates aFeatureCSVWriter
depending if the output is allowed.
-
Field Details
-
NUMBER_DECIMAL_PLACES
public static final int NUMBER_DECIMAL_PLACESThe number of decimal places to use fordouble
values, unlessvisuallyShortened==true
.- See Also:
-
-
Constructor Details
-
FeatureCSVWriter
Creates for aCSVWriter
.- Parameters:
writer
- underlying CSV writer, which if null, it means the writer is disabled.visuallyShortenedDecimals
- when truedouble
values are printed to be as short as possible without losing precision, otherwse withNUMBER_DECIMAL_PLACES
.
-
-
Method Details
-
create
public static Optional<FeatureCSVWriter> create(FeatureCSVMetadata metadata, Outputter outputter, boolean visuallyShortenedDecimals) throws OutputWriteFailedException Maybe creates aFeatureCSVWriter
depending if the output is allowed.- Parameters:
metadata
- metadata needed for writing the feature-results.outputter
- determines if the output is allowed.visuallyShortenedDecimals
- when truedouble
values are printed to be as short as possible without losing precision.- Returns:
- a write, if it is allowed.
- Throws:
OutputWriteFailedException
- if the CSV file cannot be created successfully.
-
addRow
Directly adds a row of feature-values.- Parameters:
results
- results for the row, along with corresponding labels.
-
addRow
Directly adds a row in the form of typed-values.- Parameters:
values
- a list of typed-values corresponding to a row in a CSV file.
-
close
public void close()Closes any open file-handles.This operation should always be called once at the end of writing.
-