public class CharSetEventReader extends AbstractDataModelEventReader<CharSetDataModel>
CharacterSetEvent
s from JPhyloIO into instances of CharSetDataModel
.
CharacterSetEvent
s between alignment start and end events are stored as associated
with the according alignment model. Events fired outside alignments are stored in an additional
global model not associated with any alignment model. This global model is returned when the end
of the event stream was reached (if any according events occurred).
For parsing Nexus files that would mean that all character sets defined in SETS
blocks are stored in the global model. Additionally the supported MrBayes MIXED
data type extension may lead to character set events within alignments. These are than stored in
separate models, because different sets may be defined for each alignment block in the file. If
this MrBayes extension is not used all character sets (also from separate SETS
blocks will be stored in one global model, which will be the only returned instance.
This reader is able to read metadata that specifies the color associated with a character set.
Note that an ObjectTranslator
for the respective data type that creates Color
objects must be used. Otherwise the metadata will be ignored. Colors will be generated for sets
for which no metadata could be read.
Constructor and Description |
---|
CharSetEventReader(AlignmentDataReader mainReader) |
CharSetEventReader(AlignmentDataReader mainReader,
info.bioinfweb.jphyloio.events.meta.URIOrStringIdentifier colorPredicate) |
Modifier and Type | Method and Description |
---|---|
boolean |
isPublishOnAlignmentEnd()
Determines whether loaded models should be published when reading their associated alignment is finished or not.
|
void |
processEvent(info.bioinfweb.jphyloio.JPhyloIOEventReader source,
info.bioinfweb.jphyloio.events.JPhyloIOEvent event) |
void |
setPublishOnAlignmentEnd(boolean publishOnAlignmentEnd) |
getCompletedModels, getFactory, getFirstCompletedModel, getLoadingModels, getMainReader
public CharSetEventReader(AlignmentDataReader mainReader, info.bioinfweb.jphyloio.events.meta.URIOrStringIdentifier colorPredicate)
public CharSetEventReader(AlignmentDataReader mainReader)
public boolean isPublishOnAlignmentEnd()
true
instead.
Note that this will work e.g. for NeXML but will not have a benefit for formats that define character sets after alignments, such as Nexus. If character sets are encountered after their associated alignment, these will be published at the end of the file, no matter if this property is set or not.
true
if models are published as the end of their associated alignment was read, or false
if models are all published when the end of the file is reached.public void setPublishOnAlignmentEnd(boolean publishOnAlignmentEnd)
public void processEvent(info.bioinfweb.jphyloio.JPhyloIOEventReader source, info.bioinfweb.jphyloio.events.JPhyloIOEvent event)