public abstract class LabelledResultsCSVWriter extends Object
FeatureCSVWriter
, possibly adding further processing.Modifier and Type | Field and Description |
---|---|
protected FeatureCSVMetadataForOutput |
outputMetadata
Metadata defining which CSV file to write to, and which headers.
|
Modifier | Constructor and Description |
---|---|
protected |
LabelledResultsCSVWriter(FeatureCSVMetadataForOutput outputMetadata,
FeatureCSVWriterFactory writerCreator,
Optional<java.util.function.Consumer<LabelledResultsVector>> consumeAfterAdding) |
Modifier and Type | Method and Description |
---|---|
abstract void |
add(LabelledResultsVector results)
Adds a results-element to be written.
|
protected Optional<FeatureCSVWriter> |
createWriter(FeatureCSVMetadata csvMetadata)
Creates a
CSVWriter . |
abstract void |
end()
Stops writing the CSV file.
|
protected void |
maybeConsumeResults(LabelledResultsVector results)
Consumes the
LabelledResultsVector if consumeAfterAdding is present. |
abstract void |
start()
Starts writing the CSV file.
|
protected final FeatureCSVMetadataForOutput outputMetadata
protected LabelledResultsCSVWriter(FeatureCSVMetadataForOutput outputMetadata, FeatureCSVWriterFactory writerCreator, Optional<java.util.function.Consumer<LabelledResultsVector>> consumeAfterAdding)
public abstract void start() throws OutputWriteFailedException
This should be called once, before any calls to add(LabelledResultsVector)
.
OutputWriteFailedException
- if the output file cannot be created.public abstract void add(LabelledResultsVector results)
This should be called once for each set of results to be written.
results
- the results.public abstract void end() throws OutputWriteFailedException
This should be called once, after all calls to add(LabelledResultsVector)
.
OutputWriteFailedException
- if the output file cannot be created.protected Optional<FeatureCSVWriter> createWriter(FeatureCSVMetadata csvMetadata) throws OutputWriteFailedException
CSVWriter
.csvMetadata
- the metadata for the writer.OutputWriteFailedException
- if the CSV file cannot be created successfully.protected void maybeConsumeResults(LabelledResultsVector results)
LabelledResultsVector
if consumeAfterAdding
is present.results
- the results to maybe consume.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.