Class OutputSequenceFactory<T>

Object
OutputSequenceFactory<T>
Type Parameters:
T - element-type for generator (that can also be iterated over)

public class OutputSequenceFactory<T> extends Object
Creates and starts an output-seqience with a particular generator and context.

This usually occurs in a subdirectory (relative to outputter, but not necessarily.

Author:
Owen Feehan
  • Constructor Details

    • OutputSequenceFactory

      public OutputSequenceFactory(Generator<T> generator, OutputterChecked outputter)
      Creates a new OutputSequenceFactory instance.
      Parameters:
      generator - The generator to be repeatedly called for writing each element in the sequence.
      outputter - The root directory where writing occurs to, often adding a subdirectory for the sequence.
  • Method Details

    • incrementingByOne

      Writes elements to directory, with an incrementing integer in the filename.

      The integer in the filename starts at 0.

      The eventual filename written becomes $prefix$index.$extension.

      Parameters:
      pattern - how the output of the sequence looks on the file-system.
      Returns:
      a newly created sequence
      Throws:
      OutputWriteFailedException - if any outputting cannot be successfully completed.
    • incrementingByOneCurrentDirectory

      public OutputSequenceIncrementing<T> incrementingByOneCurrentDirectory(String outputName, String prefix, int numberDigits) throws OutputWriteFailedException
      Writes elements to the current directory, with an incrementing integer in the filename.

      The integer in the filename starts at 0.

      The eventual filename written becomes $prefix$index.$extension.

      Parameters:
      outputName - the associated output-name
      prefix - a prefix to include before each filename that is outputted.
      numberDigits - the number of digits (adding trailing zeros) for the integer part of the output-name.
      Returns:
      a newly created sequence
      Throws:
      OutputWriteFailedException - if any outputting cannot be successfully completed.
    • indexedWithInteger

      Writes elements (indexed by integers) to directory, without any order in the sequence.

      Each index must be unique.

      The eventual filename written becomes $prefix$index.$extension.

      Parameters:
      pattern - how the output of the sequence looks on the file-system.
      Returns:
      a newly created sequence
      Throws:
      OutputWriteFailedException - if any outputting cannot be successfully completed.
    • withoutOrder

      Writes elements (indexed by strings) to directory, without any order in the sequence.

      Each index must be unique.

      The eventual filename written becomes $prefix$index.$extension.

      Parameters:
      pattern - how the output of the sequence looks on the file-system.
      Returns:
      a newly created sequence
      Throws:
      OutputWriteFailedException - if any outputting cannot be successfully completed.
    • withoutOrderCurrentDirectory

      public OutputSequenceIndexed<T,String> withoutOrderCurrentDirectory(String outputName) throws OutputWriteFailedException
      Writes elements (indexed by strings) to the current directory, without any order in the sequence.

      Each index must be unique.

      The eventual filename written becomes $index.$extension without any prefix or suffix.

      Parameters:
      outputName - the output-name used in rules to determine if the output is enabled or not.
      Returns:
      a newly created sequence
      Throws:
      OutputWriteFailedException - if any outputting cannot be successfully completed.
    • incrementingByOneStream

      public void incrementingByOneStream(OutputPatternIntegerSuffix pattern, Stream<T> stream) throws OutputWriteFailedException
      Writes file for each element in a stream with an incrementing integer sequence in the outputted file-name.

      The integer in the filename starts at 0.

      Parameters:
      pattern - how the output of the sequence looks on the file-system.
      stream - the items to generate separate files
      Throws:
      OutputWriteFailedException - if any output fails to be written.