Class FeatureCSVWriter
Object
FeatureCSVWriter
Writes the results of feature-calculations as a CSV file.
- Author:
- Owen Feehan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of decimal places to use fordoublevalues, unlessvisuallyShortened==true. -
Constructor Summary
ConstructorsConstructorDescriptionFeatureCSVWriter(CSVWriter writer, boolean visuallyShortenedDecimals) Creates for aCSVWriter. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRow(List<TypedValue> values) Directly adds a row in the form of typed-values.voidaddRow(LabelledResultsVector results) Directly adds a row of feature-values.voidclose()Closes any open file-handles.static Optional<FeatureCSVWriter> create(FeatureCSVMetadata metadata, Outputter outputter, boolean visuallyShortenedDecimals) Maybe creates aFeatureCSVWriterdepending if the output is allowed.
-
Field Details
-
NUMBER_DECIMAL_PLACES
public static final int NUMBER_DECIMAL_PLACESThe number of decimal places to use fordoublevalues, 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 truedoublevalues 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 aFeatureCSVWriterdepending if the output is allowed.- Parameters:
metadata- metadata needed for writing the feature-results.outputter- determines if the output is allowed.visuallyShortenedDecimals- when truedoublevalues 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.
-