java.text

Interface AttributedCharacterIterator

All Superinterfaces:
CharacterIterator, Cloneable
Known Implementing Classes:
FormatCharacterIterator

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 class
AttributedCharacterIterator.Attribute
Defines attribute keys that are used as text attributes.

Fields inherited from interface java.text.CharacterIterator

DONE

Method Summary

Map
Object> getAttributes()
Returns a Map of the attributes defined for the current character.
Set
getAllAttributeKeys()
Returns a list of all keys that are defined for the text range.
Object
getAttribute(AttributedCharacterIterator.Attribute attrib)
Returns the value of the specified attribute for the current character.
int
getRunLimit()
Returns the index of the character after the end of the run that contains all attributes defined for the current character.
int
getRunLimit(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.
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.
int
getRunStart()
Returns the index of the first character in the run that contains all attributes defined for the current character.
int
getRunStart(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.
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.

Methods inherited from interface java.text.CharacterIterator

clone, current, first, getBeginIndex, getEndIndex, getIndex, last, next, previous, setIndex

Method Details

Object> getAttributes

public MapObject> getAttributes()
Returns a Map of the attributes defined for the current character.
Returns:
A Map of the attributes for the current character.

getAllAttributeKeys

public Set 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

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(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(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.

AttributedCharacterIterator.java -- Iterate over attributes Copyright (C) 1998, 1999, 2004, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.