public class FeatureCSVWriter extends Object
Modifier and Type | Field and Description |
---|---|
static int |
NUMBER_DECIMAL_PLACES
The number of decimal places to use for
double values, unless visuallyShortened==true . |
Constructor and Description |
---|
FeatureCSVWriter(CSVWriter writer,
boolean visuallyShortenedDecimals)
Creates for a
CSVWriter . |
Modifier and Type | Method and Description |
---|---|
void |
addRow(LabelledResultsVector results)
Directly adds a row of feature-values.
|
void |
addRow(List<TypedValue> values)
Directly adds a row in the form of typed-values.
|
void |
close()
Closes any open file-handles.
|
static Optional<FeatureCSVWriter> |
create(FeatureCSVMetadata metadata,
Outputter outputter,
boolean visuallyShortenedDecimals)
Maybe creates a
FeatureCSVWriter depending if the output is allowed. |
public static final int NUMBER_DECIMAL_PLACES
double
values, unless visuallyShortened==true
.public FeatureCSVWriter(CSVWriter writer, boolean visuallyShortenedDecimals)
CSVWriter
.writer
- underlying CSV writer, which if null, it means the writer is disabled.visuallyShortenedDecimals
- when true double
values are printed to be as short
as possible without losing precision, otherwse with NUMBER_DECIMAL_PLACES
.public static Optional<FeatureCSVWriter> create(FeatureCSVMetadata metadata, Outputter outputter, boolean visuallyShortenedDecimals) throws OutputWriteFailedException
FeatureCSVWriter
depending if the output is allowed.metadata
- metadata needed for writing the feature-results.outputter
- determines if the output is allowed.visuallyShortenedDecimals
- when true double
values are printed to be as short
as possible without losing precision.OutputWriteFailedException
- if the CSV file cannot be created successfully.public void addRow(LabelledResultsVector results)
results
- results for the row, along with corresponding labels.public void addRow(List<TypedValue> values)
values
- a list of typed-values corresponding to a row in a CSV file.public void close()
This operation should always be called once at the end of writing.
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.