info.bioinfweb.jphyloio.formats.phylip

## Class AbstractPhylipFactory

- java.lang.Object
- - info.bioinfweb.jphyloio.factory.AbstractSingleReaderWriterFactory
  - - info.bioinfweb.jphyloio.formats.phylip.AbstractPhylipFactory

- All Implemented Interfaces:
    SingleReaderWriterFactory, JPhyloIOFormatIDs, PhylipConstants
  Direct Known Subclasses:
    PhylipFactory, SequentialPhylipFactory

      public abstract class AbstractPhylipFactory
      extends AbstractSingleReaderWriterFactory
      implements SingleReaderWriterFactory, PhylipConstants, JPhyloIOFormatIDs

  Implements shared functionality for Phylip factories.
  Since:
    0.0.0
  Author:
    Ben Stöver

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MAXIMUM_EXPECTED_DIGITS_OR_WHITESPACE` Defines the maximum number of digits in a column or line count definition of a Phylip file.

    - ### Fields inherited from interface info.bioinfweb.jphyloio.formats.phylip.PhylipConstants

      `DEFAULT_NAME_LENGTH, PHYLIP_FORMAT_NAME, PREMATURE_NAME_END_CHARACTER, RELAXED_PHYLIP_NAME_PATTERN, SEQUENTIAL_PHYLIP_FORMAT_NAME`

    - ### Fields inherited from interface info.bioinfweb.jphyloio.formats.JPhyloIOFormatIDs

      `FASTA_FORMAT_ID, FORMAT_ID_PREFIX, MEGA_FORMAT_ID, NEWICK_FORMAT_ID, NEXML_FORMAT_ID, NEXUS_FORMAT_ID, PDE_FORMAT_ID, PHYLIP_FORMAT_ID, PHYLOXML_FORMAT_ID, SEQUENTIAL_PHYLIP_FORMAT_ID, XTG_FORMAT_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractPhylipFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkFormat(java.io.Reader reader, ReadWriteParameterMap parameters)` Implementations should read the start of the characters returned by the reader here and determine whether the content could be valid according to the target format.
    `protected JPhyloIOFormatInfo` | `createFormatInfo(java.lang.String formatID, java.lang.String formatName, java.util.Set<java.lang.String> supportedReaderParameters, java.util.Set<java.lang.String> supportedWriterParameters, java.lang.String adapterDescription)`
    `JPhyloIOEventWriter` | `getWriter()` Creates a new writer instance for the target format of this factory.
    `boolean` | `hasReader()` Determines whether this factory is able to create reader instances for its target format.
    `boolean` | `hasWriter()` Determines whether this factory is able to create writer instances for its target format.

    - ### Methods inherited from class info.bioinfweb.jphyloio.factory.AbstractSingleReaderWriterFactory

      `checkFormat, createFormatInfo, getFormatInfo`

    - ### 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.factory.SingleReaderWriterFactory

      `checkFormat, getFormatInfo, getReader, getReader`

- - ### Field Detail

    - #### MAXIMUM_EXPECTED_DIGITS_OR_WHITESPACE

          public static final int MAXIMUM_EXPECTED_DIGITS_OR_WHITESPACE

      Defines the maximum number of digits in a column or line count definition of a Phylip file. Using this constant avoids parsing files completely that are not Phylip and just contain many digits in `checkFormat()`.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractPhylipFactory

          public AbstractPhylipFactory()

  - ### Method Detail

    - #### checkFormat

          public boolean checkFormat(java.io.Reader reader,
                                     ReadWriteParameterMap parameters)
                              throws java.io.IOException

      Description copied from interface: `SingleReaderWriterFactory`
      Implementations should read the start of the characters returned by the reader here and determine whether the content could be valid according to the target format.
      Specified by:
        `checkFormat` in interface `SingleReaderWriterFactory`
      Parameters:
        `reader` - the reader to read the first bytes from
        `parameters` - the parameters map that would also be used to create a reader
      Returns:
        `true` if the tested reader may return content in target format or `false` if the content is not in valid target format
      Throws:
        `java.io.IOException`

    - #### getWriter

          public JPhyloIOEventWriter getWriter()

      Description copied from interface: `SingleReaderWriterFactory`
      Creates a new writer instance for the target format of this factory.
      Specified by:
        `getWriter` in interface `SingleReaderWriterFactory`
      Returns:
        the new writer instance or `null` if this factory is not able to create writers
      See Also:
        `SingleReaderWriterFactory.hasWriter()`

    - #### hasReader

          public boolean hasReader()

      Description copied from interface: `SingleReaderWriterFactory`
      Determines whether this factory is able to create reader instances for its target format.
      Specified by:
        `hasReader` in interface `SingleReaderWriterFactory`
      Returns:
        `true` if creating readers is supported or `false` otherwise

    - #### hasWriter

          public boolean hasWriter()

      Description copied from interface: `SingleReaderWriterFactory`
      Determines whether this factory is able to create writer instances for its target format.
      Specified by:
        `hasWriter` in interface `SingleReaderWriterFactory`
      Returns:
        `true` if creating writers is supported or `false` otherwise

    - #### createFormatInfo

          protected JPhyloIOFormatInfo createFormatInfo(java.lang.String formatID,
                                                        java.lang.String formatName,
                                                        java.util.Set<java.lang.String> supportedReaderParameters,
                                                        java.util.Set<java.lang.String> supportedWriterParameters,
                                                        java.lang.String adapterDescription)