T
- the token type to be storedpublic class PackedAlignmentModel<T> extends AbstractListAlignmentModel<T>
PackedObjectArrayList
as the underlying data source.
This class can be used to efficiently store large editable sequences, because it will usually use only
a small fraction of the space ArrayListAlignmentModel
will use to store its tokens.
Due to the compression method the token set cannot be changed during runtime for instances of this class.
DEFAULT_INITIAL_CAPACITY
Constructor and Description |
---|
PackedAlignmentModel(TokenSet<T> tokenSet)
Creates a new instance of this class with the maximum number of different tokens that is equal to the
number of tokens in the specified set.
|
PackedAlignmentModel(TokenSet<T> tokenSet,
int minTokenCount)
Creates a new instance of this class using its own ID manager.
|
PackedAlignmentModel(TokenSet<T> tokenSet,
SequenceIDManager idManager,
boolean reuseSequenceIDs)
Creates a new instance of this class with the maximum number of different tokens that is equal to the
number of tokens in the specified set.
|
PackedAlignmentModel(TokenSet<T> tokenSet,
SequenceIDManager idManager,
boolean reuseSequenceIDs,
int minTokenCount)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List<T> |
createNewSequence(java.lang.String sequenceID,
java.lang.String sequenceName,
int initialCapacity)
This method is called by
#createNewSequence(int, String) and must be implemented by inherited classes. |
int |
getMaxTokenCount()
Returns the maximum number of different tokens that can be modeled by this packed list.
|
void |
setTokenSet(TokenSet<T> set)
This method is not supported by this class.
|
createNewSequence, getInitialCapacity, getSequence, getSequenceLength, getTokenAt, getWriteType, insertTokenAt, insertTokensAt, isUseMaxLength, removeTokenAt, removeTokensAt, setTokenAt, setTokensAt
containsSequence, doAddSequence, doRemoveSequence, getSequenceCount, getSequenceMap, getSequenceOrder, sequenceIDIterator
addSequence, addSequence, appendToken, appendTokens, doRenameSequence, fireAfterSequenceChange, fireAfterTokenChange, getApproxMaxSequenceLength, getIDManager, getMaxSequenceLength, getTokenSet, isReuseSequenceIDs, isSequencesReadOnly, isTokensReadOnly, removeSequence, renameSequence, sequenceIDsByName, sequenceNameByID, setMaxSequeceLengthRecalculte, setReuseSequenceIDs
fireAfterSequenceRenamed, getChangeListeners, getID, getLabel, setID, setLabel
public PackedAlignmentModel(TokenSet<T> tokenSet, SequenceIDManager idManager, boolean reuseSequenceIDs, int minTokenCount)
tokenSet
- the token set to be used by this alignment modelidManager
- the ID manager to be used by the new instance (maybe shared among multiple instances)reuseSequenceIDs
- Specifies whether unused IDs of the underlying ID manager should be reused by this model.
(See the documentation of AbstractUndecoratedAlignmentModel.isReuseSequenceIDs()
for details. Specify false
, if you are unsure
what this property does.)minTokenCount
- the minimal number of different tokens to be supported by the compression method
of this modelAbstractUndecoratedAlignmentModel.getMaxSequenceLength()
public PackedAlignmentModel(TokenSet<T> tokenSet, int minTokenCount)
tokenSet
- the token set to be used by this alignment modelminTokenCount
- the minimal number of different tokens to be supported by the compression method
of this modelAbstractUndecoratedAlignmentModel.getMaxSequenceLength()
public PackedAlignmentModel(TokenSet<T> tokenSet, SequenceIDManager idManager, boolean reuseSequenceIDs)
Note that adding additional elements to the token set later on may cause problems if the returned
instance cannot hold enough different types of tokens (see getMaxTokenCount()
for further
information).
tokenSet
- the token set to be used by this alignment modelidManager
- the ID manager to be used by the new instance (maybe shared among multiple instances)reuseSequenceIDs
- Specifies whether unused IDs of the underlying ID manager should be reused by this model.
(See the documentation of AbstractUndecoratedAlignmentModel.isReuseSequenceIDs()
for details. Specify false
, if you are unsure
what this property does.)public PackedAlignmentModel(TokenSet<T> tokenSet)
Note that adding additional elements to the token set later on may cause problems if the returned
instance cannot hold enough different types of tokens (see getMaxTokenCount()
for further
information).
tokenSet
- the token set to be used by this alignment modelidManager
- the ID manager to be used by the new instance (maybe shared among multiple instances)public int getMaxTokenCount()
Note that the returned value might be higher than the value passed to the constructor depending on the maximum integer value that can be represented by the number of necessary bits.
protected java.util.List<T> createNewSequence(java.lang.String sequenceID, java.lang.String sequenceName, int initialCapacity)
AbstractListAlignmentModel
#createNewSequence(int, String)
and must be implemented by inherited classes.
In contrast to #createNewSequence(int, String)
it provides an additional parameter specifying the
initial capacity the returned list object shall have. This parameter value if set depending on the return
values of AbstractListAlignmentModel.isUseMaxLength()
either to a fixed value as specified by AbstractListAlignmentModel.getInitialCapacity()
or by the maximum length of other sequences in this provider if any of these contain more elements than
AbstractListAlignmentModel.getInitialCapacity()
.createNewSequence
in class AbstractListAlignmentModel<T>
sequenceID
- the ID the new sequence must havesequenceName
- the name the new sequence will haveinitialCapacity
- the initial capacity the returned list object shall havepublic void setTokenSet(TokenSet<T> set)
setTokenSet
in interface AlignmentModel<T>
setTokenSet
in class AbstractUndecoratedAlignmentModel<T>
set
- the new token set to be usedjava.lang.UnsupportedOperationException
- always