public class AlignmentDataReader extends Object
AlignmentModel
s and DataModel
s from a stream of JPhyloIO events.Constructor and Description |
---|
AlignmentDataReader(info.bioinfweb.jphyloio.JPhyloIOEventReader eventReader,
AlignmentModelFactory alignmentModelFactory)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addDataModelReader(DataModelEventReader<?> reader)
Adds the specified data model reader to this instance, if it is not already present.
|
AlignmentModelEventReader |
getAlignmentModelReader()
Returns the alignment event reader used create to and read alignment model instances
|
void |
readAll()
Processes all events from the underlying JPhyloIO event stream.
|
boolean |
removeDataModelReader(DataModelEventReader<?> reader)
Removes the specified data model reader from this instance.
|
public AlignmentDataReader(info.bioinfweb.jphyloio.JPhyloIOEventReader eventReader, AlignmentModelFactory alignmentModelFactory)
A new instance must be created for each stream of JPhyloIO events that shall be processed.
eventReader
- the reader providing JPhyloIO eventsalignmentModelFactory
- the factory to create alignment model instances during readingNullPointerException
- if eventReader
or alignmentModelReader
are null
public AlignmentModelEventReader getAlignmentModelReader()
public boolean addDataModelReader(DataModelEventReader<?> reader)
It is recommended to add all readers before the first method that processed events (e.g.
#readUnitlNextAlignmentModel()
) is called. If new readers are added in between, its up to the
application developer to make sure that these reader still work properly without knowledge of the events
that were already consumed.
reader
- the reader to be addedtrue
if the new reader was added, false
if the specified reader was already presentIllegalArgumentException
- if the specified reader does not reference this instance by
DataModelEventReader.getMainReader()
public boolean removeDataModelReader(DataModelEventReader<?> reader)
reader
- the reader to be removedtrue
if the specified reader was removed, false
if that reader was not contained in
this instancepublic void readAll() throws Exception
AlignmentModelEventReader.getCompletedModels()
or by the according
data model readers, if specified before calling this method.Exception
- if an exception was thrown by JPhyloIOEventReader.next()
.