T
- the token type of the alignment models to be created by this instancepublic abstract class AbstractAlignmentModelFactory<T> extends java.lang.Object implements AlignmentModelFactory<T>
Constructor and Description |
---|
AbstractAlignmentModelFactory()
Creates a new instance of this class without an shared sequence ID manager.
|
AbstractAlignmentModelFactory(SequenceIDManager sharedIDManager,
boolean reuseSequenceIDs,
T defaultToken)
Creates a new instance of this class using a shared sequence ID manager.
|
AbstractAlignmentModelFactory(T defaultToken)
Creates a new instance of this class without an shared sequence ID manager.
|
Modifier and Type | Method and Description |
---|---|
AlignmentModel<T> |
createNewModel(NewAlignmentModelParameterMap parameterMap)
Creates a new instance of an alignment model according to the specified parameters.
|
T |
createToken(AlignmentModel<T> alignmentModel,
java.lang.String tokenRepresentation)
Creates a token using
TokenSet.tokenByRepresentation(String) . |
protected abstract AlignmentModel<T> |
doCreateNewModel(NewAlignmentModelParameterMap parameterMap) |
T |
getDefaultToken()
Returns the default token to be used if invalid token representations are passed to
createToken(AlignmentModel, String) . |
SequenceIDManager |
getSharedIDManager()
Returns the sequence ID manager that is shared among all model instances created by this factory.
|
boolean |
hasSharedIDManager()
Determines whether this instance uses a shared sequence ID manager.
|
boolean |
isReuseSequenceIDs()
Determines whether models created by this factory should reuse IDs already present in their associated
ID manager or should always create new IDs.
|
public AbstractAlignmentModelFactory()
public AbstractAlignmentModelFactory(T defaultToken)
defaultToken
- a default token to be used if invalid token representations are passed to
createToken(AlignmentModel, String)
(If null
is specified here, createToken(AlignmentModel, String)
will throw an exception
instead in such cases.)public AbstractAlignmentModelFactory(SequenceIDManager sharedIDManager, boolean reuseSequenceIDs, T defaultToken)
sharedIDManager
- the sequence ID manager that will be shared by all model instances
created by this factoryreuseSequenceIDs
- Specify true
if models created by this factory should reuse IDs already present
in their associated ID manager or false
if new IDs should always be created. (See the documentation
of AbstractUndecoratedAlignmentModel.isReuseSequenceIDs()
for details.)defaultToken
- a default token to be used if invalid token representations are passed to
createToken(AlignmentModel, String)
(If null
is specified here, createToken(AlignmentModel, String)
will throw an exception
instead in such cases.)public SequenceIDManager getSharedIDManager()
null
if no shared ID manager is used by this factoryhasSharedIDManager()
public boolean isReuseSequenceIDs()
AbstractUndecoratedAlignmentModel.isReuseSequenceIDs()
for details.)true
if IDs should be reused, false
otherwisepublic boolean hasSharedIDManager()
true
if a shared ID manager is present, false
otherwisegetSharedIDManager()
public T getDefaultToken()
createToken(AlignmentModel, String)
.null
if none is definedpublic T createToken(AlignmentModel<T> alignmentModel, java.lang.String tokenRepresentation) throws InvalidTokenRepresentationException
TokenSet.tokenByRepresentation(String)
.createToken
in interface AlignmentModelFactory<T>
alignmentModel
- the alignment model which will hold the returned tokentokenRepresentation
- the string representation of the token to be returned (e.g. read from
an alignment file)getDefaultToken()
if no according representation was found in the setInvalidTokenRepresentationException
- if a token representation is not found in the token set
of alignmentModel
and no default token was specifiedAlignmentModelFactory.createToken(info.bioinfweb.libralign.model.AlignmentModel, java.lang.String)
protected abstract AlignmentModel<T> doCreateNewModel(NewAlignmentModelParameterMap parameterMap)
public AlignmentModel<T> createNewModel(NewAlignmentModelParameterMap parameterMap)
AlignmentModelFactory
createNewModel
in interface AlignmentModelFactory<T>
parameterMap
- a map with parameters describing the requirements to be met by the returned instancenull
if this factory is not able to create an
object that meets the specified requirements