T
- the token type that is used by the underlying sequence data providerpublic class SingleCharSequenceAdapter<T> extends AbstractSingleSequenceDataAdapter<T> implements CharSequence, SingleSequenceDataAdapter<T>
AlignmentModel
as a CharSequence
.
Note that the underlying sequence data provider is directly used to that all changes in that provider are also reflected by the instance of this class.
Constructor and Description |
---|
SingleCharSequenceAdapter(AlignmentModel<T> provider,
String sequenceID,
boolean cutLongRepresentations)
Creates a new instance of this class specifying a whole sequence to be viewed.
|
SingleCharSequenceAdapter(AlignmentModel<T> provider,
String sequenceID,
int offset,
int length,
boolean cutLongRepresentations)
Creates a new instance of this class specifying a subsequence to be viewed.
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index)
Returns the character representation of the token in the underlying data source at the specified position.
|
boolean |
isCutLongRepresentations()
The return values indicates whether string representations of tokens that are not exactly one character
long are allowed.
|
int |
length()
This method delegates to
AbstractSingleSequenceDataAdapter.getLength() . |
CharSequence |
subSequence(int start,
int end) |
String |
toString()
Returns a copy of this character sequence as a string.
|
getLength, getOffset, getSequenceID, setLength, setOffset, setSequenceID
getUnderlyingModel, setUnderlyingModel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
chars, codePoints
getLength, getOffset, getSequenceID
getUnderlyingModel
public SingleCharSequenceAdapter(AlignmentModel<T> provider, String sequenceID, int offset, int length, boolean cutLongRepresentations)
provider
- the sequence data provider that contains the sequence to be viewedsequenceID
- the ID used in provider
of the sequence to be viewedoffset
- the start index of the subsequence to be viewed (The first token has the index 0.)length
- the length of the subsequence to be viewedcutLongRepresentations
- Specify true
here if tokens that have a string representation
that is not exactly one character long shall be exported with the first character of their
representation or false
if an exception shall be thrown if such a token is found.public SingleCharSequenceAdapter(AlignmentModel<T> provider, String sequenceID, boolean cutLongRepresentations)
provider
- the sequence data provider that contains the sequence to be viewedsequenceID
- the ID used in provider
of the sequence to be viewedcutLongRepresentations
- Specify true
here if tokens that have a string representation
that is not exactly one character long shall be exported with the first character of their
representation or false
if an exception shall be thrown if such a token is found.public boolean isCutLongRepresentations()
true
if tokens that have a string representation that is not exactly one character long
shall be exported with the first character of their representation or false
if an exception
shall be thrown if such a token is foundpublic char charAt(int index) throws InvalidUnderlyingTokenException, IndexOutOfBoundsException
charAt
in interface CharSequence
InvalidUnderlyingTokenException
- if the underlying token has a string representation that is
not exactly one character long and isCutLongRepresentations()
was set to false
IndexOutOfBoundsException
- if index
was < 0
or >=
length()
CharSequence.charAt(int)
public int length()
AbstractSingleSequenceDataAdapter.getLength()
.length
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public String toString()
toString
in interface CharSequence
toString
in class Object
InvalidUnderlyingTokenException
- if one token in the underlying data source has a string
representation that is not exactly one character long and isCutLongRepresentations()
was set to false