public interface ConcatenatedAlignmentModel extends AlignmentModel<java.lang.Object>
This interface allows to concatenate multiple instances of AlignmentModel
implementations.
It extends AlignmentModel
by additional methods allowing to add and remove underlying
models which provide the contents a sets of subsequent columns of the concatenated alignment.
Each contained model may provide a different token set valid for the part of the alignment it models.
To allow combining any different token sets this interface does not have a generic token type but uses
Object
as the token type instead. Implementing classes should return a global token set
containing all tokens if the different submodels with the according inherited method.
Modifier and Type | Method and Description |
---|---|
void |
appendPartModel(AlignmentModel<?> model)
Appends an additional part model at the end of this concatenated alignment.
|
int |
columnOffsetForPartModel(AlignmentModel<?> partModel)
Returns the global index of the first column provided by the specified part model.
|
int |
columnOffsetForPartModel(int partIndex)
Returns the global index of the first column provided by the part model with the specified index.
|
boolean |
containsPartModel(AlignmentModel<?> partModel)
Checks if the specified model is contained in this concatenated model.
|
AlignmentModel<?> |
getLastPartModel()
Returns the right most part model contained in this alignment.
|
AlignmentModel<?> |
getPartModel(int index)
Returns the part model at the specified position.
|
int |
getPartModelCount()
Returns the number of part models contained in this alignment.
|
void |
insertPartModel(int modelIndex,
AlignmentModel<?> model)
Inserts an additional part model at the specified position.
|
int |
parentIDByPartID(int partID,
int partIndex)
Translates the sequence ID used in an underlying part model to the according sequence ID in this
concatenated model.
|
int |
partIDByParentID(int parentID,
int partIndex)
Translates the sequence ID used in this concatenated model to the according sequence ID in an
underlying part model.
|
AlignmentModel<?> |
partModelByColumn(int columnIndex)
Returns the part model currently responsible for providing the contents of the specified column.
|
int |
partModelIndex(AlignmentModel<?> partModel)
Returns the index of the specified part model in this concatenated alignment model.
|
AlignmentModel<?> |
removePartModel(int index)
Removes the part model at the specified index from this concatenated alignment model.
|
addSequence, addSequence, appendToken, appendTokens, containsSequence, getChangeListeners, getID, getLabel, getMaxSequenceLength, getSequenceCount, getSequenceLength, getTokenAt, getTokenSet, getWriteType, insertTokenAt, insertTokensAt, isSequencesReadOnly, isTokensReadOnly, removeSequence, removeTokenAt, removeTokensAt, renameSequence, sequenceIDIterator, sequenceIDsByName, sequenceNameByID, setID, setLabel, setTokenAt, setTokensAt, setTokenSet
void appendPartModel(AlignmentModel<?> model)
model
- the model to be addedjava.lang.IllegalArgumentException
- if this instance is not the owner of model
or the IDs of the
sequences contained in model
do not match the sequence IDs of this instancejava.lang.NullPointerException
- if model
is null
void insertPartModel(int modelIndex, AlignmentModel<?> model)
modelIndex
- the index where the new model shall be inserted (The index in the list of models is
meant here, which is different from the global index the first alignment column of the new model
will have.)model
- the new model to be insertedjava.lang.IllegalArgumentException
- if this instance is not the owner of model
or the IDs of the
sequences contained in model
do not match the sequence IDs of this instancejava.lang.NullPointerException
- if model
is null
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >
getPartModelCount()
)AlignmentModel<?> removePartModel(int index)
index
- the index of the part model to be removedjava.lang.IndexOutOfBoundsException
- if index
is below 0 or >= getPartModelCount()
AlignmentModel<?> getPartModel(int index)
index
- the index of the part model to be returnedjava.lang.IndexOutOfBoundsException
- if index
is below 0 or >= getPartModelCount()
AlignmentModel<?> getLastPartModel()
null
if no part models are contained in this alignmentint getPartModelCount()
int partModelIndex(AlignmentModel<?> partModel)
partModel
- the sought-after part modelboolean containsPartModel(AlignmentModel<?> partModel)
partModel
- the sought-after part modeltrue
if the specified model was found, false
otherwiseint columnOffsetForPartModel(int partIndex)
partIndex
- the index of the part modeljava.lang.IndexOutOfBoundsException
- if partIndex
is below zero or >= getPartModelCount()
int columnOffsetForPartModel(AlignmentModel<?> partModel)
partModel
- the part model that has the returned offsetjava.lang.IllegalArgumentException
- if partModel
is not contained in this concatenated modelAlignmentModel<?> partModelByColumn(int columnIndex)
columnIndex
- the global column index (The first column has the index 0.)java.lang.IndexOutOfBoundsException
- if columnIndex
is below zero or greater than the index of the
right most column in this modelint parentIDByPartID(int partID, int partIndex) throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
partID
- the ID used in the part modelpartIndex
- the index of the part modeljava.lang.IllegalArgumentException
- if the specified ID is not contained in the specified part modeljava.lang.IndexOutOfBoundsException
- if the index of the part model is not validint partIDByParentID(int parentID, int partIndex) throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
Note that not all part models need to contain all sequences represented by the concatenated model.
parentID
- the ID used in this modelpartIndex
- the index of the part modeljava.lang.IllegalArgumentException
- if the specified ID is not contained in this model (i.e. no part model
contains an according sequence)java.lang.IndexOutOfBoundsException
- if the index of the part model is not valid