public class TokenPainterMap extends java.lang.Object
For each CharacterStateSetType
a separate token painter can be provided. If the map
contains no matching painter, an instance of SingleColorTokenPainter
without any
entries in its color map is provided. By default NucleotideTokenPainter
and
AminoAcidTokenPainter
are contained in the map, but this can be adjusted using
putTokenPainter(CharacterStateSetType, TokenPainter)
.
Instances of this class are used to provide default painters by TokenPainterList
.
Constructor and Description |
---|
TokenPainterMap()
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
TokenPainter |
getPainter(CharacterStateSetType type)
Returns the best matching painter to specified token type.
|
TokenPainter |
putTokenPainter(CharacterStateSetType type,
TokenPainter painter)
Specifies a new painter for a certain token type.
|
TokenPainter |
removeTokenPainter(CharacterStateSetType type)
Removes the painter mapping for the specified token type.
|
public TokenPainterMap()
public TokenPainter getPainter(CharacterStateSetType type)
CharacterStateSetType.NUCLEOTIDE
are returned is no matching painter for
CharacterStateSetType.DNA
or CharacterStateSetType.RNA
is found.
The mapping for CharacterStateSetType.DISCRETE
is returned for all
discrete types for which no direct mapping is present.type
- the token type for which a painter is requestednull
)public TokenPainter putTokenPainter(CharacterStateSetType type, TokenPainter painter)
type
- the token type to map the painter topainter
- the new paintertype
or null
java.lang.NullPointerException
- if type
or painter
are null
public TokenPainter removeTokenPainter(CharacterStateSetType type)
type
- the token type to remove the mapping fortype
or null