info.bioinfweb.jphyloio.formats.nexml.elementreader

## Class AbstractNeXMLElementReader

- java.lang.Object
- - info.bioinfweb.jphyloio.formats.xml.elementreaders.AbstractXMLElementReader<NeXMLReaderStreamDataProvider>
  - - info.bioinfweb.jphyloio.formats.nexml.elementreader.AbstractNeXMLElementReader

- All Implemented Interfaces:
    NeXMLConstants, XMLElementReader<NeXMLReaderStreamDataProvider>, ReadWriteConstants
  Direct Known Subclasses:
    AbstractSetElementReader, NeXMLMetaEndElementReader, NeXMLMetaStartElementReader, NeXMLSetEndElementReader

      public abstract class AbstractNeXMLElementReader
      extends AbstractXMLElementReader<NeXMLReaderStreamDataProvider>
      implements XMLElementReader<NeXMLReaderStreamDataProvider>, NeXMLConstants, ReadWriteConstants

  Processes a NeXML tag without any of its subelements.

  Methods provided in this class are commonly used by different element readers.

  Author:
    Sarah Wiechers

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `AbstractNeXMLElementReader.LabeledIDEventInformation` Contains information about a `LabeledIDEvent`.
    `protected static class` | `AbstractNeXMLElementReader.OTUorOTUsEventInformation` Contains information about a `LinkedLabeledIDEvent`.

  - ### Field Summary

    - ### Fields inherited from interface info.bioinfweb.jphyloio.formats.nexml.NeXMLConstants

      `ATTR_ABOUT, ATTR_CELL_SET_LINKED_IDS, ATTR_CHAR_SET_LINKED_IDS, ATTR_CODON_POSITION, ATTR_CONTENT, ATTR_DATATYPE, ATTR_GENERATOR, ATTR_HREF, ATTR_ID, ATTR_LABEL, ATTR_LENGTH, ATTR_NODE_EDGE_SET_LINKED_EDGE_IDS, ATTR_NODE_EDGE_SET_LINKED_NODE_IDS, ATTR_NODE_EDGE_SET_LINKED_ROOTEDGE_IDS, ATTR_OTU_SET_LINKED_IDS, ATTR_OTUS, ATTR_PROPERTY, ATTR_REL, ATTR_ROOT, ATTR_SEQUENCE_SET_LINKED_IDS, ATTR_SINGLE_CHAR_LINK, ATTR_SINGLE_OTU_LINK, ATTR_SINGLE_STATE_LINK, ATTR_SOURCE, ATTR_STATE_SET_LINKED_IDS, ATTR_STATES, ATTR_SYMBOL, ATTR_TARGET, ATTR_TOKENS, ATTR_TREE_SET_LINKED_NETWORK_IDS, ATTR_TREE_SET_LINKED_TREE_IDS, ATTR_VERSION, ATTR_XSI_TYPE, DEFAULT_TOKEN_DEFINITION_SET_ID_PREFIX, NEXML_DEFAULT_NAMESPACE_PREFIX, NEXML_FORMAT_NAME, NEXML_NAMESPACE, NEXML_NAMESPACE_PREFIX, NEXML_PREDICATE_NAMESPACE, NEXML_VERSION, PREDICATE_CHAR_ATTR_CODON_POSITION, PREDICATE_CHAR_ATTR_TOKENS, PREDICATE_FORMAT, PREDICATE_MATRIX, PREDICATE_ORIGINAL_LABEL, PREDICATE_ORIGINAL_TOKEN_NAME, TAG_CELL, TAG_CHAR, TAG_CHARACTERS, TAG_EDGE, TAG_FORMAT, TAG_MATRIX, TAG_MEMBER, TAG_META, TAG_NETWORK, TAG_NODE, TAG_OTU, TAG_OTUS, TAG_POLYMORPHIC, TAG_ROOT, TAG_ROOTEDGE, TAG_ROW, TAG_SEQ, TAG_SET, TAG_STATE, TAG_STATES, TAG_TREE, TAG_TREES, TAG_UNCERTAIN, TYPE_CONTIN_CELLS, TYPE_CONTIN_SEQ, TYPE_DNA_CELLS, TYPE_DNA_SEQS, TYPE_FLOAT_NETWORK, TYPE_FLOAT_TREE, TYPE_INT_NETWORK, TYPE_INT_TREE, TYPE_LITERAL_META, TYPE_PROTEIN_CELLS, TYPE_PROTEIN_SEQS, TYPE_RESOURCE_META, TYPE_RESTRICTION_CELLS, TYPE_RESTRICTION_SEQS, TYPE_RNA_CELLS, TYPE_RNA_SEQS, TYPE_STANDARD_CELLS, TYPE_STANDARD_SEQ, UNDEFINED_OTU_ID_PREFIX, UNDEFINED_OTU_LABEL, UNDEFINED_OTUS_ID_PREFIX, UNDEFINED_OTUS_LABEL`

    - ### Fields inherited from interface info.bioinfweb.jphyloio.ReadWriteConstants

      `ATTRIBUTE_STRING_KEY, ATTRIBUTES_NAMESPACE_FOLDER, DATA_TYPE_NAMESPACE_FOLDER, DATA_TYPE_SIMPLE_VALUE_LIST, DEFAULT_CHAR_SET_ID_PREFIX, DEFAULT_CHARACTER_DEFINITION_ID_PREFIX, DEFAULT_EDGE_ID_PREFIX, DEFAULT_GENERAL_ID_PREFIX, DEFAULT_MATRIX_ID_PREFIX, DEFAULT_MAX_COMMENT_LENGTH, DEFAULT_MAX_TOKENS_TO_READ, DEFAULT_META_ID_PREFIX, DEFAULT_NETWORK_ID_PREFIX, DEFAULT_NODE_EDGE_SET_ID_PREFIX, DEFAULT_NODE_ID_PREFIX, DEFAULT_OTU_ID_PREFIX, DEFAULT_OTU_LIST_ID_PREFIX, DEFAULT_OTU_SET_ID_PREFIX, DEFAULT_SEQUENCE_ID_PREFIX, DEFAULT_SEQUENCE_SET_ID_PREFIX, DEFAULT_TOKEN_DEFINITION_ID_PREFIX, DEFAULT_TOKEN_SET_ID_PREFIX, DEFAULT_TREE_ID_PREFIX, DEFAULT_TREE_NETWORK_GROUP_ID_PREFIX, DEFAULT_TREE_NETWORK_SET_ID_PREFIX, JPHYLOIO_ATTRIBUTES_NAMESPACE, JPHYLOIO_ATTRIBUTES_PREFIX, JPHYLOIO_DATA_TYPE_NAMESPACE, JPHYLOIO_DATA_TYPE_PREFIX, JPHYLOIO_FORMATS_NAMESPACE_PREFIX, JPHYLOIO_GENERAL_NAMESPACE, JPHYLOIO_NAMESPACE_PREFIX, JPHYLOIO_PREDICATE_NAMESPACE, JPHYLOIO_PREDICATE_PREFIX, PREDICATE_CHARACTER_COUNT, PREDICATE_EDGE_LENGTH, PREDICATE_EDGE_SOURCE_NODE, PREDICATE_EDGE_TARGET_NODE, PREDICATE_HAS_CUSTOM_XML, PREDICATE_HAS_LITERAL_METADATA, PREDICATE_HAS_RESOURCE_METADATA, PREDICATE_IS_CROSSLINK, PREDICATE_NAMESPACE_FOLDER, PREDICATE_PART_SEPERATOR, PREDICATE_SEQUENCE_COUNT, RESERVED_ID_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractNeXMLElementReader()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `createIntervalEvents(NeXMLReaderStreamDataProvider streamDataProvider, java.lang.String[] charIDs)` Creates a series of `CharacterSetIntervalEvent`s from an array of IDs referencing `CharacterDefinitionEvent`s and adds them to the current event collection.
    `protected AbstractNeXMLElementReader.LabeledIDEventInformation` | `getLabeledIDEventInformation(NeXMLReaderStreamDataProvider streamDataProvider, javax.xml.stream.events.StartElement element)` Obtains information about the ID and label associated with a `StartElement` by reading its attributes.
    `protected AbstractNeXMLElementReader.OTUorOTUsEventInformation` | `getOTUorOTUsEventInformation(NeXMLReaderStreamDataProvider streamDataProvider, javax.xml.stream.events.StartElement element)` Obtains information about the ID, label and linked OTU or OTU list associated with a `StartElement` by reading its attributes.
    `static CharacterSymbolMeaning` | `parseStateMeaning(java.lang.String symbol)`
    `protected java.util.List<java.lang.String>` | `readSequence(NeXMLReaderStreamDataProvider streamDataProvider, java.lang.String sequence, TokenTranslationStrategy translateTokens)` Parses a sequence string to a list of single tokens by using the provided `TokenTranslationStrategy`.

    - ### Methods inherited from class info.bioinfweb.jphyloio.formats.xml.elementreaders.AbstractXMLElementReader

      `readAttributes, readAttributes`

    - ### 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.formats.xml.elementreaders.XMLElementReader

      `readEvent`

- - ### Constructor Detail

    - #### AbstractNeXMLElementReader

          public AbstractNeXMLElementReader()

  - ### Method Detail

    - #### readSequence

          protected java.util.List<java.lang.String> readSequence(NeXMLReaderStreamDataProvider streamDataProvider,
                                                                  java.lang.String sequence,
                                                                  TokenTranslationStrategy translateTokens)
                                                           throws JPhyloIOReaderException,
                                                                  javax.xml.stream.XMLStreamException

      Parses a sequence string to a list of single tokens by using the provided `TokenTranslationStrategy`.

      The sequence may contain tokens longer than one character in case of continuous or standard data.

      Parameters:
        `streamDataProvider` - the stream data provider of the calling `NeXMLEventReader`
        `sequence` - the sequence as a string of tokens
        `translateTokens` - the `TokenTranslationStrategy` to be applied
      Returns:
        the list of tokens obtained from the sequence
      Throws:
        `JPhyloIOReaderException`
        `javax.xml.stream.XMLStreamException`

    - #### createIntervalEvents

          protected void createIntervalEvents(NeXMLReaderStreamDataProvider streamDataProvider,
                                              java.lang.String[] charIDs)
                                       throws JPhyloIOReaderException,
                                              javax.xml.stream.XMLStreamException

      Creates a series of `CharacterSetIntervalEvent`s from an array of IDs referencing `CharacterDefinitionEvent`s and adds them to the current event collection.
      Parameters:
        `streamDataProvider` - the stream data provider of the calling `NeXMLEventReader`
        `charIDs` - an array of IDs referencing `CharacterDefinitionEvent`s
      Throws:
        `JPhyloIOReaderException`
        `javax.xml.stream.XMLStreamException`

    - #### getLabeledIDEventInformation

          protected AbstractNeXMLElementReader.LabeledIDEventInformation getLabeledIDEventInformation(NeXMLReaderStreamDataProvider streamDataProvider,
                                                                                                      javax.xml.stream.events.StartElement element)
                                                                                               throws JPhyloIOReaderException

      Obtains information about the ID and label associated with a `StartElement` by reading its attributes.

      If no ID can be found a default ID is created in case of `NeXMLConstants.TAG_META` and `NeXMLConstants.TAG_CHAR`. In all other cases an ID attribute needs to provide a valid ID or a `JPhyloIOReaderException` will be thrown.

      Parameters:
        `streamDataProvider` - the stream data provider of the calling `NeXMLEventReader`
        `element` - the `StartElement` to obtain the information from
      Returns:
        the `AbstractNeXMLElementReader.LabeledIDEventInformation` containing information about the given `StartElement`
      Throws:
        `JPhyloIOReaderException`

    - #### getOTUorOTUsEventInformation

          protected AbstractNeXMLElementReader.OTUorOTUsEventInformation getOTUorOTUsEventInformation(NeXMLReaderStreamDataProvider streamDataProvider,
                                                                                                      javax.xml.stream.events.StartElement element)
                                                                                               throws JPhyloIOReaderException

      Obtains information about the ID, label and linked OTU or OTU list associated with a `StartElement` by reading its attributes.

      If no label is associated with this start element, the label of the linked element will be returned as a label. If the linked element does not have a label either, the elemnent's ID will can used as a label, depending on `ReadWriteParameterNames.KEY_USE_OTU_LABEL`.

      Parameters:
        `streamDataProvider` - the stream data provider of the calling `NeXMLEventReader`
        `element` - the `StartElement` to obtain the information from
      Returns:
        the `AbstractNeXMLElementReader.OTUorOTUsEventInformation` containing information about the given `StartElement`
      Throws:
        `JPhyloIOReaderException`

    - #### parseStateMeaning

          public static CharacterSymbolMeaning parseStateMeaning(java.lang.String symbol)