public class TokenPainterList extends Object implements Iterable<TokenPainter>
TokenPainter
s used by 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.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.
|
TokenPainter |
getDefaultTokenPainter()
Returns the default token painter that is used to paint tokens from the alignment model if no according
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.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public TokenPainterList(PaintSettings owner)
owner
- the paint settings object containing this instancepublic PaintSettings getOwner()
public TokenPainter get(int index)
index
- the index of the painter to be returnednull
if no painter was defined at that positionIndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()
)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 setIndexOutOfBoundsException
- 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 Iterator<TokenPainter> iterator()
null
elements can occur.)iterator
in interface 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 TokenPainter getDefaultTokenPainter()
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.