info.bioinfweb.jphyloio

## Class ReaderStreamDataProvider<R extends AbstractEventReader<? extends ReaderStreamDataProvider<R>>>

- java.lang.Object
- - info.bioinfweb.jphyloio.ReaderStreamDataProvider<R>

- Direct Known Subclasses:
    TextReaderStreamDataProvider, XMLReaderStreamDataProvider

      public class ReaderStreamDataProvider<R extends AbstractEventReader<? extends ReaderStreamDataProvider<R>>>
      extends java.lang.Object

  Stream data providers are objects used by helper classes of JPhyloIO event readers (e.g. command readers for Nexus, `NewickStringReader` or element readers for XML formats). They have two major functions:
  1. Delegate protected properties of their associated event reader to allow accessing them by helper classes in other packages.
  2. Act as a repository for data that shall be shared among different helper classes of a reader.
  Author:
    Ben Stöver
  See Also:
    `AbstractEventReader.getStreamDataProvider()`, `AbstractEventReader.createStreamDataProvider()`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReaderStreamDataProvider(R eventReader)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `eventsUpcoming()` Checks whether events are waiting the event queue of the associated event reader.
    `java.util.Collection<JPhyloIOEvent>` | `getCurrentEventCollection()` Returns the event collection that is currently used to take up new events.
    `R` | `getEventReader()`
    `LongIDManager` | `getIDManager()` Returns the ID manager of the associated reader.
    `ReadWriteParameterMap` | `getParameters()` Returns the parameter map that was specified when the constructor of the associated reader was called.
    `SequenceTokensEventManager` | `getSequenceTokensEventManager()` Returns the sequence tokens event manager of the associated reader.
    `boolean` | `hasSpecialEventCollection()` Determines whether the current event collection is different from the queue of upcoming events.
    `java.util.Collection<JPhyloIOEvent>` | `resetCurrentEventCollection()` Removes the event collection at the top of the eventCollections stack and returns it.
    `java.util.Collection<JPhyloIOEvent>` | `setCurrentEventCollection(java.util.Collection<JPhyloIOEvent> newCollection)` Adds a new current event collection to the stack.

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

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

- - ### Constructor Detail

    - #### ReaderStreamDataProvider

          public ReaderStreamDataProvider(R eventReader)

  - ### Method Detail

    - #### getEventReader

          public R getEventReader()

    - #### resetCurrentEventCollection

          public java.util.Collection<JPhyloIOEvent> resetCurrentEventCollection()

      Removes the event collection at the top of the eventCollections stack and returns it.
      Returns:
        the removed event collection

    - #### setCurrentEventCollection

          public java.util.Collection<JPhyloIOEvent> setCurrentEventCollection(java.util.Collection<JPhyloIOEvent> newCollection)

      Adds a new current event collection to the stack.
      Parameters:
        `newCollection` - the new collection to take up new events from now on
      Returns:
        the event collection that was previously at the top of the stack
      Throws:
        `java.lang.NullPointerException` - if `newCollection` is `null`

    - #### getCurrentEventCollection

          public java.util.Collection<JPhyloIOEvent> getCurrentEventCollection()

      Returns the event collection that is currently used to take up new events.
      Returns:
        the current event collection

    - #### hasSpecialEventCollection

          public boolean hasSpecialEventCollection()

      Determines whether the current event collection is different from the queue of upcoming events.
      Returns:
        `false` if `getCurrentEventCollection()` returns the same instance as `#getUpcomingEvents()` or `true` otherwise

    - #### eventsUpcoming

          public boolean eventsUpcoming()

      Checks whether events are waiting the event queue of the associated event reader.

      Note that this event queue maybe different from the `getCurrentEventCollection()`. Therefore this method may return `false`, even if an event has just been added.

      Returns:
        `true` if at least one event is wainting, `false` otherwise

    - #### getSequenceTokensEventManager

          public SequenceTokensEventManager getSequenceTokensEventManager()

      Returns the sequence tokens event manager of the associated reader.
      Returns:
        the sequence tokens event manager

    - #### getParameters

          public ReadWriteParameterMap getParameters()

      Returns the parameter map that was specified when the constructor of the associated reader was called.
      Returns:
        the parameter map of the associated reader

    - #### getIDManager

          public LongIDManager getIDManager()

      Returns the ID manager of the associated reader.
      Returns:
        the ID manager to be used to create unique IDs for generated events