info.bioinfweb.jphyloio.formats.nexml

## Class NeXMLReaderStreamDataProvider

- java.lang.Object
- - info.bioinfweb.jphyloio.ReaderStreamDataProvider<R>
  - - info.bioinfweb.jphyloio.formats.xml.XMLReaderStreamDataProvider<NeXMLEventReader>
    - - info.bioinfweb.jphyloio.formats.nexml.NeXMLReaderStreamDataProvider

-     public class NeXMLReaderStreamDataProvider
      extends XMLReaderStreamDataProvider<NeXMLEventReader>

  Stores data that shall be shared among different implementations of `AbstractNeXMLElementReader` reading from the same document.
  Author:
    Sarah Wiechers

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NeXMLReaderStreamDataProvider(NeXMLEventReader nexmlEventReader)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearCurrentRowInformation()` Method used for reading cell tags that clears the map of buffered cell informations (`getCurrentCellsBuffer()`) and resets the columns ID iterator used by `nextCharID()`.
    `URIOrStringIdentifier` | `getAdditionalResourceMetaRel()` Returns a {link URIOrStringIdentifier} if an additional `ResourceMetadataEvent` is to be created to enclose meta data of elements without a `JPhyloIOEvent` representation or `null` if this the enclosing event was already generated.
    `java.lang.String` | `getAlternativeStringRepresentation()` Returns the value of the content attribute of the current literal meta element to be used as an alternative string representation by a following `LiteralMetadataContentEvent`.
    `java.util.List<java.lang.String>` | `getCharIDs()` Returns a list of column IDs obtained from NeXML char elements.
    `java.util.Map<java.lang.String,java.lang.Integer>` | `getCharIDToIndexMap()` Returns a map linking column indices to column IDs obtained from NeXML char elements.
    `java.util.Map<java.lang.String,java.lang.String>` | `getCharIDToStatesMap()` Returns a map linking a token set definition ID to a column ID obtained from a NeXML char elements.
    `java.util.Map<java.lang.String,BufferedEventInfo<SingleSequenceTokenEvent>>` | `getCurrentCellsBuffer()` The returned map is used to buffer `SingleTokenDefinitionEvent`s and their nested events, in cases where the order of `cell` tags does not match the order of the referenced columns.
    `java.lang.String` | `getCurrentExpectedCharID()` Returns the column ID that has been the result of the last call of `nextCharID()`.
    `LiteralContentSequenceType` | `getCurrentLiteralContentSequenceType()` Returns the `LiteralContentSequenceType` of the content nested under the current literal meta element.
    `NeXMLSingleTokenDefinitionInformation` | `getCurrentSingleTokenDefinition()` Returns the `NeXMLSingleTokenDefinitionInformation` instance of the currently read single token definition, e.g to add more constituents.
    `java.util.EnumMap<EventContentType,java.lang.String>` | `getElementTypeToCurrentIDMap()` Returns a map that links the currently used ID to an `EventContentType`.
    `NeXMLEventReader` | `getEventReader()`
    `java.util.Stack<EventContentType>` | `getMetaType()` Returns a stack of `EventContentType` that represents the currently encountered nested meta events.
    `java.util.Map<java.lang.String,java.lang.String>` | `getOTUIDToLabelMap()` Returns a map that links a label to a certain OTU ID.
    `java.util.Map<java.lang.String,java.lang.String>` | `getTokenDefinitionIDToSymbolMap()` Returns a map that links a symbol (i.e.
    `java.util.Map<java.lang.String,java.util.List<java.lang.String>>` | `getTokenSetIDtoColumnsMap()` Returns a map that links a symbol (i.e.
    `java.util.Map<java.lang.String,NeXMLReaderTokenSetInformation>` | `getTokenSets()` Returns a map that links a `NeXMLReaderTokenSetInformation` to a certain token set ID.
    `boolean` | `isAllowLongTokens()`
    `boolean` | `isCurrentCellBuffered()` Determines whether the contents of the current `cell` tag are buffered or not.
    `boolean` | `isCurrentSetSupported()` Returns `true` if the set element that is currently read can be interpreted as a series of `JPhyloIOEvent`s or `false` if the set and all its contents will be ignored.
    `java.lang.String` | `nextCharID()` Returns the next NeXML columns ID (ID of a `char` tag) at the current position of the underlying iterator and stores it in the property `getCurrentExpectedCharID()`.
    `void` | `setAdditionalResourceMetaRel(URIOrStringIdentifier additionalResourceMetaRel)`
    `void` | `setAllowLongTokens(boolean allowLongTokens)`
    `void` | `setAlternativeStringRepresentation(java.lang.String alternativeStringRepresentation)`
    `void` | `setCurrentCellBuffered(boolean currentCellBuffered)` Allow to specify whether the contents of the current `cell` tag are buffered or not.
    `void` | `setCurrentLiteralContentSequenceType(LiteralContentSequenceType currentLiteralContentSequenceType)`
    `void` | `setCurrentSetIsSupported(boolean currentSetIsSupported)`
    `void` | `setCurrentSingleTokenDefinition(NeXMLSingleTokenDefinitionInformation currentSingleTokenDefinition)`

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

      `getCharacterSetType, getEdgeInfos, getElementName, getIncompleteToken, getNestedMetaNames, getParentName, getSourceNode, getStartDocumentEvent, getXMLReader, hasIncompleteToken, isCreateNodeStart, isCustomXMLStartWritten, isRootedPhylogeny, setCharacterSetType, setCreateNodeStart, setCustomXMLStartWritten, setElementName, setIncompleteToken, setParentName, setRootedPhylogeny, setStartDocumentEvent`

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

      `eventsUpcoming, getCurrentEventCollection, getIDManager, getParameters, getSequenceTokensEventManager, hasSpecialEventCollection, resetCurrentEventCollection, setCurrentEventCollection`

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

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

- - ### Constructor Detail

    - #### NeXMLReaderStreamDataProvider

          public NeXMLReaderStreamDataProvider(NeXMLEventReader nexmlEventReader)

  - ### Method Detail

    - #### getEventReader

          public NeXMLEventReader getEventReader()

      Overrides:
        `getEventReader` in class `ReaderStreamDataProvider<NeXMLEventReader>`

    - #### isAllowLongTokens

          public boolean isAllowLongTokens()

    - #### setAllowLongTokens

          public void setAllowLongTokens(boolean allowLongTokens)

    - #### getElementTypeToCurrentIDMap

          public java.util.EnumMap<EventContentType,java.lang.String> getElementTypeToCurrentIDMap()

      Returns a map that links the currently used ID to an `EventContentType`. This map is used to determine a the linked ID of a set.
      Returns:
        the map linking an ID to an `EventContentType`

    - #### getMetaType

          public java.util.Stack<EventContentType> getMetaType()

      Returns a stack of `EventContentType` that represents the currently encountered nested meta events.
      Returns:
        the stack of EventContentType representing the encountered meta events

    - #### getCurrentLiteralContentSequenceType

          public LiteralContentSequenceType getCurrentLiteralContentSequenceType()

      Returns the `LiteralContentSequenceType` of the content nested under the current literal meta element.
      Returns:
        the `LiteralContentSequenceType` of the content nested under the current literal meta element

    - #### setCurrentLiteralContentSequenceType

          public void setCurrentLiteralContentSequenceType(LiteralContentSequenceType currentLiteralContentSequenceType)

    - #### getAlternativeStringRepresentation

          public java.lang.String getAlternativeStringRepresentation()

      Returns the value of the content attribute of the current literal meta element to be used as an alternative string representation by a following `LiteralMetadataContentEvent`.
      Returns:
        the value of the content attribute of the current literal meta element

    - #### setAlternativeStringRepresentation

          public void setAlternativeStringRepresentation(java.lang.String alternativeStringRepresentation)

    - #### getAdditionalResourceMetaRel

          public URIOrStringIdentifier getAdditionalResourceMetaRel()

      Returns a {link URIOrStringIdentifier} if an additional `ResourceMetadataEvent` is to be created to enclose meta data of elements without a `JPhyloIOEvent` representation or `null` if this the enclosing event was already generated.
      Returns:
        a {link URIOrStringIdentifier} describing additional metadata or `null`

    - #### setAdditionalResourceMetaRel

          public void setAdditionalResourceMetaRel(URIOrStringIdentifier additionalResourceMetaRel)

    - #### isCurrentSetSupported

          public boolean isCurrentSetSupported()

      Returns `true` if the set element that is currently read can be interpreted as a series of `JPhyloIOEvent`s or `false` if the set and all its contents will be ignored.
      Returns:
        `true` if the set currently read can be interpreted as a series of `JPhyloIOEvent`s

    - #### setCurrentSetIsSupported

          public void setCurrentSetIsSupported(boolean currentSetIsSupported)

    - #### getOTUIDToLabelMap

          public java.util.Map<java.lang.String,java.lang.String> getOTUIDToLabelMap()

      Returns a map that links a label to a certain OTU ID. This map is used to determine a sequence or node label from the OTU linked to it, in case no sequence or node label could be found.
      Returns:
        the map linking a label to an OTU ID

    - #### getTokenSets

          public java.util.Map<java.lang.String,NeXMLReaderTokenSetInformation> getTokenSets()

      Returns a map that links a `NeXMLReaderTokenSetInformation` to a certain token set ID. This is used to buffer information about the token set until the start event is created and to be able to find the right translation map when reading sequences.
      Returns:
        the map linking a `NeXMLReaderTokenSetInformation` to an token set ID

    - #### getTokenDefinitionIDToSymbolMap

          public java.util.Map<java.lang.String,java.lang.String> getTokenDefinitionIDToSymbolMap()

      Returns a map that links a symbol (i.e. the name of a token definition like 'A' for Adenin) to a single token definition ID.
      Returns:
        the map linking a symbol to a single token definition ID

    - #### getCurrentSingleTokenDefinition

          public NeXMLSingleTokenDefinitionInformation getCurrentSingleTokenDefinition()

      Returns the `NeXMLSingleTokenDefinitionInformation` instance of the currently read single token definition, e.g to add more constituents.
      Returns:
        the `NeXMLSingleTokenDefinitionInformation` instance of the currently read single token definition

    - #### setCurrentSingleTokenDefinition

          public void setCurrentSingleTokenDefinition(NeXMLSingleTokenDefinitionInformation currentSingleTokenDefinition)

    - #### getTokenSetIDtoColumnsMap

          public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getTokenSetIDtoColumnsMap()

      Returns a map that links a symbol (i.e. the name of a token definition like 'A' for Adenin) to a single token definition ID.
      Returns:
        the map linking a symbol to a single token definition ID

    - #### getCharIDs

          public java.util.List<java.lang.String> getCharIDs()

      Returns a list of column IDs obtained from NeXML char elements.
      Returns:
        a list of column IDs

    - #### getCharIDToIndexMap

          public java.util.Map<java.lang.String,java.lang.Integer> getCharIDToIndexMap()

      Returns a map linking column indices to column IDs obtained from NeXML char elements.
      Returns:
        a map linking column indices to column IDs

    - #### getCharIDToStatesMap

          public java.util.Map<java.lang.String,java.lang.String> getCharIDToStatesMap()

      Returns a map linking a token set definition ID to a column ID obtained from a NeXML char elements.
      Returns:
        a map linking a token set definition ID to a column ID

    - #### getCurrentCellsBuffer

          public java.util.Map<java.lang.String,BufferedEventInfo<SingleSequenceTokenEvent>> getCurrentCellsBuffer()

      The returned map is used to buffer `SingleTokenDefinitionEvent`s and their nested events, in cases where the order of `cell` tags does not match the order of the referenced columns.
      Returns:
        the map instance to be used for buffering

    - #### clearCurrentRowInformation

          public void clearCurrentRowInformation()

      Method used for reading cell tags that clears the map of buffered cell informations (`getCurrentCellsBuffer()`) and resets the columns ID iterator used by `nextCharID()`.

    - #### nextCharID

          public java.lang.String nextCharID()

      Returns the next NeXML columns ID (ID of a `char` tag) at the current position of the underlying iterator and stores it in the property `getCurrentExpectedCharID()`.

      If this method is called the first time after creation of this object or after a call of `clearCurrentRowInformation()` a new iterator will be created before returning an event.

      Returns:
        the ID of the next `char` tag or `null` if no additional columns are available

    - #### getCurrentExpectedCharID

          public java.lang.String getCurrentExpectedCharID()

      Returns the column ID that has been the result of the last call of `nextCharID()`.
      Returns:
        the currently expected column ID or `null` if no more IDs are to come

    - #### isCurrentCellBuffered

          public boolean isCurrentCellBuffered()

      Determines whether the contents of the current `cell` tag are buffered or not. Buffering becomes necessary, if the order of `cell` tags differs from the order of column definitions from `char` tags.
      Returns:
        `true` if the current cell is buffered or `false` otherwise

    - #### setCurrentCellBuffered

          public void setCurrentCellBuffered(boolean currentCellBuffered)

      Allow to specify whether the contents of the current `cell` tag are buffered or not.