info.bioinfweb.jphyloio

## Class AbstractSingleMatrixEventWriter<P extends TextWriterStreamDataProvider<? extends AbstractTextEventWriter<P>>>

- java.lang.Object
- - info.bioinfweb.jphyloio.AbstractEventWriter<P>
  - - info.bioinfweb.jphyloio.formats.text.AbstractTextEventWriter<P>
    - - info.bioinfweb.jphyloio.AbstractSingleMatrixEventWriter<P>

- All Implemented Interfaces:
    JPhyloIOEventWriter, JPhyloIOFormatSpecificObject
  Direct Known Subclasses:
    FASTAEventWriter, PhylipEventWriter

      public abstract class AbstractSingleMatrixEventWriter<P extends TextWriterStreamDataProvider<? extends AbstractTextEventWriter<P>>>
      extends AbstractTextEventWriter<P>

  Default implementation for writers that can only write a single matrix (multiple sequence alignment) to their target format, because that format does not support additional data.

  This abstract implementation will log according warnings for the other data that has not been written and than calls `#writeSingleMatrix(DocumentDataAdapter, MatrixDataAdapter, Iterator, Writer, ReadWriteParameterMap)` which must be implemented by inherited classes accordingly.

  Since:
    0.0.0
  Author:
    Ben Stöver

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class info.bioinfweb.jphyloio.AbstractEventWriter

      `AbstractEventWriter.NoEditUniqueLabelHandler, AbstractEventWriter.UniqueLabelHandler`

  - ### Field Summary

    - ### Fields inherited from class info.bioinfweb.jphyloio.AbstractEventWriter

      `EDITED_LABEL_SEPARATOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSingleMatrixEventWriter(java.lang.String formatName)` Creates a new instance of this class.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doWriteDocument(DocumentDataAdapter document, java.io.Writer writer, ReadWriteParameterMap parameters)`
    `protected java.lang.String` | `editSequenceOrNodeLabel(LinkedLabeledIDEvent event, ReadWriteParameterMap parameters, OTUListDataAdapter otuList)`
    `protected abstract java.lang.String` | `maskReservedLabelCharacters(java.lang.String label)`
    `protected abstract void` | `writeSingleMatrix(DocumentDataAdapter document, MatrixDataAdapter matrix, java.util.Iterator<java.lang.String> sequenceIDIterator, ReadWriteParameterMap parameters)` Implementations of this method should write a single matrix to their target format.

    - ### Methods inherited from class info.bioinfweb.jphyloio.formats.text.AbstractTextEventWriter

      `getWriter`

    - ### Methods inherited from class info.bioinfweb.jphyloio.AbstractEventWriter

      `createStreamDataProvider, createUniqueLabel, createUniqueLabel, createUniqueLabel, createUniqueLinkedOTULabel, decreaseIndention, determineMaxSequenceLength, extendSequence, getFileStartInfo, getIndention, getLabeledIDName, getLinkedOTUNameOTUFirst, getLinkedOTUNameOwnFirst, getReferencedOTUList, getStreamDataProvider, increaseIndention, logIngnoredOTULists, writeDocument, writeDocument, writeDocument, writeLineBreak, writeLineStart`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface info.bioinfweb.jphyloio.JPhyloIOFormatSpecificObject

      `getFormatID`

- - ### Constructor Detail

    - #### AbstractSingleMatrixEventWriter

          public AbstractSingleMatrixEventWriter(java.lang.String formatName)

      Creates a new instance of this class.
      Parameters:
        `formatName` - the name of the format the inherited implementation writes to, which will be used for the log messages generated by this abstract implementation.

  - ### Method Detail

    - #### writeSingleMatrix

          protected abstract void writeSingleMatrix(DocumentDataAdapter document,
                                                    MatrixDataAdapter matrix,
                                                    java.util.Iterator<java.lang.String> sequenceIDIterator,
                                                    ReadWriteParameterMap parameters)
                                             throws java.io.IOException

      Implementations of this method should write a single matrix to their target format.
      Parameters:
        `document` - the document containing the matrix
        `matrix` - the (non-empty) matrix to be written
        `sequenceIDIterator` - an iterator oder all sequences in `matrix` positioned before the first sequence
        `writer` - the writer to write the data to
        `parameters` - the parameter map for the writer implementation
      Throws:
        `java.lang.Exception` - if the implementing writer throws an exception
        `java.io.IOException`

    - #### editSequenceOrNodeLabel

          protected java.lang.String editSequenceOrNodeLabel(LinkedLabeledIDEvent event,
                                                             ReadWriteParameterMap parameters,
                                                             OTUListDataAdapter otuList)

    - #### maskReservedLabelCharacters

          protected abstract java.lang.String maskReservedLabelCharacters(java.lang.String label)

    - #### doWriteDocument

          protected void doWriteDocument(DocumentDataAdapter document,
                                         java.io.Writer writer,
                                         ReadWriteParameterMap parameters)
                                  throws java.io.IOException

      Overrides:
        `doWriteDocument` in class `AbstractTextEventWriter<P extends TextWriterStreamDataProvider<? extends AbstractTextEventWriter<P>>>`
      Throws:
        `java.io.IOException`