public interface AttributedCharacterIterator extends CharacterIterator
CharacterIterator interface, adding support for iterating over
attributes and not only characters. An
AttributedCharacterIterator also allows the user to find runs and
their limits. Runs are defined as ranges of characters that all have the same
attributes with the same values.| Modifier and Type | Interface and Description |
|---|---|
static class |
AttributedCharacterIterator.Attribute
Defines keys for text attributes.
|
DONE| Modifier and Type | Method and Description |
|---|---|
Set<AttributedCharacterIterator.Attribute> |
getAllAttributeKeys()
Returns a set of attributes present in the
AttributedCharacterIterator. |
Object |
getAttribute(AttributedCharacterIterator.Attribute attribute)
Returns the value stored in the attribute for the current character.
|
Map<AttributedCharacterIterator.Attribute,Object> |
getAttributes()
Returns a map of all attributes of the current character.
|
int |
getRunLimit()
Returns the index of the last character in the run having the same
attributes as the current character.
|
int |
getRunLimit(AttributedCharacterIterator.Attribute attribute)
Returns the index of the last character in the run that has the same
attribute value for the given attribute as the current character.
|
int |
getRunLimit(Set<? extends AttributedCharacterIterator.Attribute> attributes)
Returns the index of the last character in the run that has the same
attribute values for the attributes in the set as the current character.
|
int |
getRunStart()
Returns the index of the first character in the run that has the same
attributes as the current character.
|
int |
getRunStart(AttributedCharacterIterator.Attribute attribute)
Returns the index of the first character in the run that has the same
attribute value for the given attribute as the current character.
|
int |
getRunStart(Set<? extends AttributedCharacterIterator.Attribute> attributes)
Returns the index of the first character in the run that has the same
attribute values for the attributes in the set as the current character.
|
clone, current, first, getBeginIndex, getEndIndex, getIndex, last, next, previous, setIndexSet<AttributedCharacterIterator.Attribute> getAllAttributeKeys()
AttributedCharacterIterator. An empty set is returned if no attributes
were defined.Object getAttribute(AttributedCharacterIterator.Attribute attribute)
null is returned.attribute - the attribute for which the value should be returned.null if it was not defined.Map<AttributedCharacterIterator.Attribute,Object> getAttributes()
int getRunLimit()
int getRunLimit(AttributedCharacterIterator.Attribute attribute)
attribute - the attribute which the run is based on.int getRunLimit(Set<? extends AttributedCharacterIterator.Attribute> attributes)
attributes - the set of attributes which the run is based on.int getRunStart()
int getRunStart(AttributedCharacterIterator.Attribute attribute)
attribute - the attribute which the run is based on.int getRunStart(Set<? extends AttributedCharacterIterator.Attribute> attributes)
attributes - the set of attributes which the run is based on.