public class SequenceIDManager extends Object
Mapping once added to an instance cannot be removed later on to ensure that all IDs stored in any object remain valid.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ID_PREFIX |
Constructor and Description |
---|
SequenceIDManager() |
SequenceIDManager(String idPrefix) |
Modifier and Type | Method and Description |
---|---|
String |
addSequenceName(String sequenceName)
Adds a new empty sequence to the underlying data source and generates an ID for it.
|
String |
renameSequence(String sequenceID,
String newSequenceName,
AlignmentModel<?> model)
Renames a sequence in the underlying data source.
|
String |
sequenceIDByName(String sequenceName)
Returns the unique sequence ID associated with the specified name.
|
String |
sequenceNameByID(String sequenceID)
Returns the sequence name (that would be visible to the application user) associated with the
specified unique ID.
|
public static final String DEFAULT_ID_PREFIX
public SequenceIDManager()
public SequenceIDManager(String idPrefix)
public String addSequenceName(String sequenceName)
If a shared ID manager is used, a previously defined ID is used, if one exists.
sequenceName
- the name of the new sequenceAlignmentSourceNotWritableException
- if the underlying data source is not writable for sequencespublic String renameSequence(String sequenceID, String newSequenceName, AlignmentModel<?> model) throws DuplicateSequenceNameException, SequenceNotFoundException
sequenceID
- the ID of the sequence to be renamednewSequenceName
- the new name the sequence shall havemodel
- the alignment model calling this method (This reference is only needed to set the source
of a possible exceptions.)DuplicateSequenceNameException
- if a sequence with the specified new name is already present in
the underlying data sourceSequenceNotFoundException
- if a sequence with the specified ID is not present the underlying
data sourcepublic String sequenceIDByName(String sequenceName)
sequenceName
- the name of the sequence that would be visible to the application usernull
if no sequence with the specified name is contained in this modelpublic String sequenceNameByID(String sequenceID)
sequenceID
- the unique unmodifiable ID the sequence is identified bynull
if no sequence with this ID is contained in this model