info.bioinfweb.jphyloio.formats.xtg

## Class XTGEventReader

- java.lang.Object
- - info.bioinfweb.jphyloio.AbstractEventReader<P>
  - - info.bioinfweb.jphyloio.formats.xml.AbstractXMLEventReader<XMLReaderStreamDataProvider<XTGEventReader>>
    - - info.bioinfweb.jphyloio.formats.xtg.XTGEventReader

- All Implemented Interfaces:
    JPhyloIOXMLEventReader, XTGConstants, JPhyloIOEventReader, JPhyloIOFormatSpecificObject, ReadWriteConstants

      public class XTGEventReader
      extends AbstractXMLEventReader<XMLReaderStreamDataProvider<XTGEventReader>>
      implements XTGConstants

  Event reader for the extensible TreeGraph 2 format (XTG) used by the phylogenetic tree editor TreeGraph 2.

  This reader supports reading pyhlogenetic trees and nested annotations. Reading scale bar and legend information is not supported. In order to serialize the hierarchical structure of `node` and `branch` tags, according events are fired at the end of a node or the start of a new node, depending on what happens first. This avoids buffering large amounts of data longer than necessary.

  Predefined elements as well as attributes are represented by metaevents. If necessary these events are grouped by `ResourceMetadataEvent`s. Textual or decimal annotation values (according to the `is_decimal` attribute} are parsed to the according Java objects.

  ### Recognized parameters

  - `ReadWriteParameterNames#KEY_ALLOW_DEFAULT_NAMESPACE`
  - `ReadWriteParameterNames#KEY_LOGGER`
  Since:
    0.0.0
  Author:
    Sarah Wiechers, Ben Stöver

- - ### Field Summary

    - ### Fields inherited from class info.bioinfweb.jphyloio.formats.xml.AbstractXMLEventReader

      `INTERNAL_USE_NAMESPACE, TAG_PARENT_OF_ROOT`

    - ### Fields inherited from interface info.bioinfweb.jphyloio.formats.xtg.XTGConstants

      `ALIGN_LEFT, ALIGN_RIGHT, ALIGN_TREE_WIDTH, ATTR_ADAPTER_ID, ATTR_ADAPTER_NAME, ATTR_ADAPTER_PURPOSE, ATTR_ALIGN_TO_SUBTREE, ATTR_ANCHOR_0, ATTR_ANCHOR_1, ATTR_BG_COLOR, ATTR_BOTTOM, ATTR_BRANCH_LENGTH, ATTR_BRANCH_LENGTH_SCALE, ATTR_CAPTION_LINK_TYPE, ATTR_CAPTION_TYPE, ATTR_CONSTANT_WIDTH, ATTR_DECIMAL_FORMAT, ATTR_EDGE_RADIUS, ATTR_FONT_FAMILY, ATTR_HEIGHT, ATTR_ICON, ATTR_ICON_FILLED, ATTR_ICON_HEIGHT, ATTR_ICON_WIDTH, ATTR_ID, ATTR_LABEL_ABOVE, ATTR_LABEL_HEIGHT, ATTR_LABEL_SPACING, ATTR_LABEL_WIDTH, ATTR_LEFT, ATTR_LEGEND_POS, ATTR_LEGEND_SPACING, ATTR_LEGEND_STYLE, ATTR_LINE_COLOR, ATTR_LINE_NO, ATTR_LINE_POS, ATTR_LINE_WIDTH, ATTR_LOCALE_COUNTRY, ATTR_LOCALE_LANG, ATTR_LOCALE_VARIANT, ATTR_MIN_BRANCH_LENGTH, ATTR_MIN_SPACE_ABOVE, ATTR_MIN_SPACE_BELOW, ATTR_MIN_TREE_DISTANCE, ATTR_PIE_CAPTION, ATTR_PIE_COLOR, ATTR_POSITION_LABELS_TO_LEFT, ATTR_RIGHT, ATTR_SCALE_BAR_ALIGN, ATTR_SCALE_BAR_DISTANCE, ATTR_SCALE_BAR_HEIGHT, ATTR_SCALE_BAR_INCREASE, ATTR_SCALE_BAR_LONG_INTERVAL, ATTR_SCALE_BAR_SMALL_INTERVAL, ATTR_SCALE_BAR_START, ATTR_SCALE_BAR_WIDTH, ATTR_SHOW_INTERNAL_LINES, ATTR_SHOW_NULL_LINES, ATTR_SHOW_ROOTED, ATTR_SHOW_SCALE_BAR, ATTR_SHOW_TITLE, ATTR_TEXT, ATTR_TEXT_COLOR, ATTR_TEXT_HEIGHT, ATTR_TEXT_IS_DECIMAL, ATTR_TEXT_ORIENTATION, ATTR_TEXT_STYLE, ATTR_TOP, ATTR_UNIQUE_NAME, ATTR_WIDTH, BRANCH_LENGTH_UNITS, DATA_TYPE_COLOR, DATA_TYPE_LEGEND_STYLE, DATA_TYPE_PIE_CHART_LABEL_CAPTION_LINK_TYPE, DATA_TYPE_PIE_CHART_LABEL_CAPTION_TYPE, DATA_TYPE_SCALE_BAR_ALIGNMENT, DATA_TYPE_SCALE_VALUE, DATA_TYPE_TEXT_ORIENTATION, DEPRECATED_VALUE_LEAVES_ADAPTER, FULL_SCHEMA_LOCATION, MILLIMETERS, NAMESPACE_URI, ORIENT_DOWN, ORIENT_HORIZONTAL, ORIENT_UP, PRE_LEGEND_ANCHOR, PREDICATE_BRANCH_CONSTANT_WIDTH, PREDICATE_BRANCH_MIN_LENGTH, PREDICATE_BRANCH_MIN_SPACE_ABOVE, PREDICATE_BRANCH_MIN_SPACE_BELOW, PREDICATE_COLUMN_ID, PREDICATE_DATA_ID, PREDICATE_DATA_ID_VALUE, PREDICATE_DATA_IDS, PREDICATE_DECIMAL_FORMAT, PREDICATE_DOCUMENT_MARGIN, PREDICATE_EDGE_RADIUS, PREDICATE_FONT_FAMILY, PREDICATE_GLOBAL_FORMATS, PREDICATE_GLOBAL_FORMATS_ALIGN_TO_SUBTREE, PREDICATE_GLOBAL_FORMATS_BG_COLOR, PREDICATE_GLOBAL_FORMATS_BRANCH_LENGTH_SCALE, PREDICATE_GLOBAL_FORMATS_POSITION_LABELS_TO_LEFT, PREDICATE_GLOBAL_FORMATS_SHOW_ROOTED, PREDICATE_GLOBAL_FORMATS_SHOW_SCALE_BAR, PREDICATE_HEIGHT, PREDICATE_ICON_LABEL, PREDICATE_ICON_LABEL_ICON, PREDICATE_ICON_LABEL_ICON_FILLED, PREDICATE_INVISIBLE_DATA, PREDICATE_IS_DECIMAL, PREDICATE_LABEL_ABOVE, PREDICATE_LABEL_LINE_NO, PREDICATE_LABEL_LINE_POS, PREDICATE_LABEL_MARGIN, PREDICATE_LEAF_MARGIN, PREDICATE_LEGEND, PREDICATE_LEGEND_ANCHOR_0, PREDICATE_LEGEND_ANCHOR_1, PREDICATE_LEGEND_MARGIN, PREDICATE_LEGEND_MIN_TREE_DISTANCE, PREDICATE_LEGEND_ORIENTATION, PREDICATE_LEGEND_POSITION, PREDICATE_LEGEND_SPACING, PREDICATE_LEGEND_STYLE, PREDICATE_LINE_COLOR, PREDICATE_LINE_WIDTH, PREDICATE_LOCALE_COUNTRY, PREDICATE_LOCALE_LANG, PREDICATE_LOCALE_VARIANT, PREDICATE_MARGIN_BOTTOM, PREDICATE_MARGIN_LEFT, PREDICATE_MARGIN_RIGHT, PREDICATE_MARGIN_TOP, PREDICATE_NODE_BRANCH_DATA_ADAPTERS, PREDICATE_NODE_BRANCH_DATA_ADAPTERS_ADAPTER, PREDICATE_NODE_BRANCH_DATA_ADAPTERS_ADAPTER_ID, PREDICATE_NODE_BRANCH_DATA_ADAPTERS_ADAPTER_NAME, PREDICATE_NODE_BRANCH_DATA_ADAPTERS_ADAPTER_PURPOSE, PREDICATE_NODE_UNIQUE_NAME, PREDICATE_PIE_CAPTION, PREDICATE_PIE_CHART_LABEL, PREDICATE_PIE_CHART_LABEL_CAPTION_LINK_TYPE, PREDICATE_PIE_CHART_LABEL_CAPTION_TYPE, PREDICATE_PIE_CHART_LABEL_INTERNAL_LINES, PREDICATE_PIE_CHART_LABEL_NULL_LINES, PREDICATE_PIE_CHART_LABEL_SHOW_TITLE, PREDICATE_PIE_COLOR, PREDICATE_SCALE_BAR, PREDICATE_SCALE_BAR_ALIGN, PREDICATE_SCALE_BAR_INCREASING, PREDICATE_SCALE_BAR_LONG_INTERVAL, PREDICATE_SCALE_BAR_SMALL_INTERVAL, PREDICATE_SCALE_BAR_START_LEFT, PREDICATE_SCALE_BAR_TREE_DISTANCE, PREDICATE_TEXT, PREDICATE_TEXT_COLOR, PREDICATE_TEXT_HEIGHT, PREDICATE_TEXT_LABEL, PREDICATE_TEXT_STYLE, PREDICATE_WIDTH, STYLE_BOLD, STYLE_BRACE, STYLE_BRACKET, STYLE_ITALIC, STYLE_UNDERLINE, TAG_ADAPTER, TAG_BRANCH, TAG_DOCUMENT_MARGIN, TAG_GLOBAL_FORMATS, TAG_HIDDEN_DATA, TAG_ICON_LABEL, TAG_LABEL_MARGIN, TAG_LEAF_MARGIN, TAG_LEGEND, TAG_LEGEND_MARGIN, TAG_NODE, TAG_NODE_BRANCH_DATA_ADAPTERS, TAG_PIE_CHART_ID, TAG_PIE_CHART_IDS, TAG_PIE_CHART_LABEL, TAG_ROOT, TAG_SCALE_BAR, TAG_TEXT_LABEL, TAG_TREE, VALUE_ADAPTER_PURPOSE_PREFIX, VALUE_LEAVES_ADAPTER, VALUE_SUPPORT_VALUES_ADAPTER, VERSION, XTG, XTG_DATA_TYPE_NAMESPACE, XTG_FORMAT_NAME, XTG_NAMESPACE_PREFIX, XTG_PREDICATE_NAMESPACE`

    - ### 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
    `XTGEventReader(java.io.File file, ReadWriteParameterMap parameters)`
    `XTGEventReader(java.io.InputStream stream, ReadWriteParameterMap parameters)`
    `XTGEventReader(java.io.Reader reader, ReadWriteParameterMap parameters)`
    `XTGEventReader(javax.xml.stream.XMLEventReader xmlReader, ReadWriteParameterMap parameters)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `fillMap()`
    `java.lang.String` | `getFormatID()` Returns a string ID uniquely identifying the target format of this instance.

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

      `close, createMetaXMLEventReader, createMetaXMLStreamReader, createStreamDataProvider, getElementReader, getElementReaderMap, getEncounteredTags, getNamespaceContext, getXMLReader, isAllowDefaultNamespace, parseQName, putElementReader, readNextEvent`

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

      `addEventListener, fireEvent, getCurrentEventCollection, getIDManager, getLastNonCommentEvent, getParameters, getParentInformation, getPreviousEvent, getSequenceTokensEventManager, getStreamDataProvider, getUpcomingEvents, hasNextEvent, hasSpecialEventCollection, isBeforeFirstAccess, next, nextOfType, peek, removeEventListener, resetCurrentEventCollection, setCurrentEventCollection`

    - ### 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.JPhyloIOEventReader

      `addEventListener, getLastNonCommentEvent, getParentInformation, getPreviousEvent, hasNextEvent, next, nextOfType, peek, removeEventListener`

- - ### Constructor Detail

    - #### XTGEventReader

          public XTGEventReader(java.io.File file,
                                ReadWriteParameterMap parameters)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException

      Throws:
        `java.io.IOException`
        `javax.xml.stream.XMLStreamException`

    - #### XTGEventReader

          public XTGEventReader(java.io.InputStream stream,
                                ReadWriteParameterMap parameters)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException

      Throws:
        `java.io.IOException`
        `javax.xml.stream.XMLStreamException`

    - #### XTGEventReader

          public XTGEventReader(java.io.Reader reader,
                                ReadWriteParameterMap parameters)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException

      Throws:
        `java.io.IOException`
        `javax.xml.stream.XMLStreamException`

    - #### XTGEventReader

          public XTGEventReader(javax.xml.stream.XMLEventReader xmlReader,
                                ReadWriteParameterMap parameters)

  - ### Method Detail

    - #### getFormatID

          public java.lang.String getFormatID()

      Description copied from interface: `JPhyloIOFormatSpecificObject`
      Returns a string ID uniquely identifying the target format of this instance. Additional information on the format can be retrieved by passing the returned ID to `JPhyloIOReaderWriterFactory.getFormatInfo(String)`.

      Third party developers that create readers or writers for additional formats must make sure to use a globally unique format ID. It is strongly recommended to use owned reverse domain names for this (e.g. `org.example.additionalformat`).

      Specified by:
        `getFormatID` in interface `JPhyloIOFormatSpecificObject`
      Returns:
        the ID of the target format of this instance
      See Also:
        `JPhyloIOReaderWriterFactory.getFormatInfo(String)`

    - #### fillMap

          protected void fillMap()

      Specified by:
        `fillMap` in class `AbstractXMLEventReader<XMLReaderStreamDataProvider<XTGEventReader>>`