Class LabelledResultsCSVWriter

Object
org.anchoranalysis.feature.io.csv.results.LabelledResultsCSVWriter

public abstract class LabelledResultsCSVWriter
extends Object
Allows results to be written to a FeatureCSVWriter, possibly adding further processing.
Author:
Owen Feehan
  • Field Details

  • Constructor Details

  • Method Details

    • start

      public abstract void start() throws org.anchoranalysis.io.output.error.OutputWriteFailedException
      Starts writing the CSV file.

      This should be called once, before any calls to add(LabelledResultsVector).

      Throws:
      org.anchoranalysis.io.output.error.OutputWriteFailedException - if the output file cannot be created.
    • add

      public abstract void add​(LabelledResultsVector results)
      Adds a results-element to be written.

      This should be called once for each set of results to be written.

      Parameters:
      results - the results.
    • end

      public abstract void end() throws org.anchoranalysis.io.output.error.OutputWriteFailedException
      Stops writing the CSV file.

      This should be called once, after all calls to add(LabelledResultsVector).

      Throws:
      org.anchoranalysis.io.output.error.OutputWriteFailedException - if the output file cannot be created.
    • createWriter

      protected Optional<FeatureCSVWriter> createWriter​(FeatureCSVMetadata csvMetadata) throws org.anchoranalysis.io.output.error.OutputWriteFailedException
      Creates a CSVWriter.
      Parameters:
      csvMetadata - the metadata for the writer.
      Returns:
      the newly-created writer, if possible.
      Throws:
      org.anchoranalysis.io.output.error.OutputWriteFailedException - if the CSV file cannot be created successfully.
    • maybeConsumeResults

      protected void maybeConsumeResults​(LabelledResultsVector results)
      Consumes the LabelledResultsVector if consumeAfterAdding is present.
      Parameters:
      results - the results to maybe consume.