java.text

Interface AttributedCharacterIterator

public interface AttributedCharacterIterator extends CharacterIterator

This interface extends the CharacterIterator interface in order to support iteration over character attributes as well as over the characters themselves.

In addition to attributes of specific characters, this interface supports the concept of the "attribute run", which is an attribute that is defined for a particular value across an entire range of characters or which is undefined over a range of characters.

Since: 1.2 1.2

Nested Class Summary
static classAttributedCharacterIterator.Attribute
Defines attribute keys that are used as text attributes.
Method Summary
Set<AttributedCharacterIterator.Attribute>getAllAttributeKeys()
Returns a list of all keys that are defined for the text range.
ObjectgetAttribute(AttributedCharacterIterator.Attribute attrib)
Returns the value of the specified attribute for the current character.
Map<AttributedCharacterIterator.Attribute,Object>getAttributes()
Returns a Map of the attributes defined for the current character.
intgetRunLimit()
Returns the index of the character after the end of the run that contains all attributes defined for the current character.
intgetRunLimit(Set<? extends AttributedCharacterIterator.Attribute> attribs)
Returns the index of the character after the end of the run that contains all attributes in the specified Set defined for the current character.
intgetRunLimit(AttributedCharacterIterator.Attribute attrib)
Returns the index of the character after the end of the run that contains the specified attribute defined for the current character.
intgetRunStart()
Returns the index of the first character in the run that contains all attributes defined for the current character.
intgetRunStart(Set<? extends AttributedCharacterIterator.Attribute> attribs)
Returns the index of the first character in the run that contains all attributes in the specified Set defined for the current character.
intgetRunStart(AttributedCharacterIterator.Attribute attrib)
Returns the index of the first character in the run that contains the specified attribute defined for the current character.

Method Detail

getAllAttributeKeys

public Set<AttributedCharacterIterator.Attribute> getAllAttributeKeys()
Returns a list of all keys that are defined for the text range. This can be an empty list if no attributes are defined.

Returns: A list of keys

getAttribute

public Object getAttribute(AttributedCharacterIterator.Attribute attrib)
Returns the value of the specified attribute for the current character. If the attribute is not defined for the current character, null is returned.

Parameters: attrib The attribute to retrieve the value of.

Returns: The value of the specified attribute

getAttributes

public Map<AttributedCharacterIterator.Attribute,Object> getAttributes()
Returns a Map of the attributes defined for the current character.

Returns: A Map of the attributes for the current character.

getRunLimit

public int getRunLimit()
Returns the index of the character after the end of the run that contains all attributes defined for the current character.

Returns: The end index of the run.

getRunLimit

public int getRunLimit(Set<? extends AttributedCharacterIterator.Attribute> attribs)
Returns the index of the character after the end of the run that contains all attributes in the specified Set defined for the current character.

Parameters: attribs The Set of attributes.

Returns: The end index of the run.

getRunLimit

public int getRunLimit(AttributedCharacterIterator.Attribute attrib)
Returns the index of the character after the end of the run that contains the specified attribute defined for the current character.

Parameters: attrib The attribute.

Returns: The end index of the run.

getRunStart

public int getRunStart()
Returns the index of the first character in the run that contains all attributes defined for the current character.

Returns: The start index of the run

getRunStart

public int getRunStart(Set<? extends AttributedCharacterIterator.Attribute> attribs)
Returns the index of the first character in the run that contains all attributes in the specified Set defined for the current character.

Parameters: attribs The Set of attributes.

Returns: The start index of the run.

getRunStart

public int getRunStart(AttributedCharacterIterator.Attribute attrib)
Returns the index of the first character in the run that contains the specified attribute defined for the current character.

Parameters: attrib The attribute.

Returns: The start index of the run.