public class TokenPainterList extends java.lang.Object implements java.lang.Iterable<TokenPainter>
TokenPainter
s used by PaintSettings
and AlignmentArea
. For usual
alignment models this list will contain only one token painter, but if an instance of
ConcatenatedAlignmentModel
is used, it will contain one token painter for each part model.
Note that ConcatenatedAlignmentModel
is just a placeholder for future functionality in current
versions of LibrAlign. See its documnentation for details.
Constructor and Description |
---|
TokenPainterList(PaintSettings owner)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
afterAlignmentModelChanged()
This method is called by the owning alignment area to notify this object about a change of the associated
alignment model.
|
TokenPainter |
get(int index)
Returns the painter at the specified index.
|
TokenPainterMap |
getDefaultTokenMap()
Returns the default token painter map that is used to paint tokens from the alignment model if no
respective painter is defined in the list.
|
PaintSettings |
getOwner()
Returns the paint settings object containing this instance.
|
int |
indexOf(TokenPainter painter)
Returns the first index of the specified token painter in this list.
|
boolean |
isEmpty()
Checks whether this list contains any painters.
|
java.util.Iterator<TokenPainter> |
iterator()
Returns an unmodifiable iterator over all painter of this list.
|
TokenPainter |
painterByColumn(int columnIndex)
Returns the according painter to the specified column index.
|
TokenPainter |
set(int index,
TokenPainter painter)
Replaces the painter at the specified position in this list with the specified new painter.
|
int |
size()
Returns the number of list elements in this instance.
|
public TokenPainterList(PaintSettings owner)
owner
- the paint settings object containing this instancepublic PaintSettings getOwner()
public TokenPainter get(int index)
getDefaultTokenMap()
is returned that best matches the alignment model
at the specified index. If the index is out of range, a default model will anyway be returned.index
- the index of the painter to be returned (identical with the index of the alignment part
model in ConcatenatedAlignmentModel
s)null
)public TokenPainter painterByColumn(int columnIndex)
columnIndex
- the index of the column that contains the token to be paintedpublic TokenPainter set(int index, TokenPainter painter)
Painters can also be set to null
. In such cases the alignment area will use its default
painter for the according column ranges.
index
- the index of the painter to be replacedpainter
- the new painter to be setjava.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()
)public int size()
null
.)public int indexOf(TokenPainter painter)
painter
- the painter object to determine the index forpublic java.util.Iterator<TokenPainter> iterator()
null
elements can occur.)iterator
in interface java.lang.Iterable<TokenPainter>
Iterator.remove()
public boolean isEmpty()
null
elements is not empty.
A list with the length of 0 only specifying a default painter is considered empty.true
if the list is empty, false
otherwisepublic TokenPainterMap getDefaultTokenMap()
TokenPainterMap
for
further details.public void afterAlignmentModelChanged()
This method is meant for internal use in LibrAlign and it should not be necessary to call it directly from external code.