/** * Creates an AttributedCharacterIterator instance that provides access to the entire contents of * this string. * * @return An iterator providing access to the text and its attributes. */ public AttributedCharacterIterator getIterator() { return getIterator(null, 0, length()); }
/** * Creates an AttributedCharacterIterator instance that provides access to the entire contents of * this string. * * @return An iterator providing access to the text and its attributes. */ public AttributedCharacterIterator getIterator() { return getIterator(null, 0, length()); }
/** * Creates an AttributedCharacterIterator instance that provides access to * selected contents of this string. * Information about attributes not listed in attributes that the * implementor may have need not be made accessible through the iterator. * If the list is null, all available attribute information should be made * accessible. * * @param attributes a list of attributes that the client is interested in * @return an iterator providing access to the entire text and its selected attributes */ public AttributedCharacterIterator getIterator(Attribute[] attributes) { return getIterator(attributes, 0, length()); }
/** * Creates an AttributedCharacterIterator instance that provides access to * selected contents of this string. * Information about attributes not listed in attributes that the * implementor may have need not be made accessible through the iterator. * If the list is null, all available attribute information should be made * accessible. * * @param attributes a list of attributes that the client is interested in * @return an iterator providing access to the entire text and its selected attributes */ public AttributedCharacterIterator getIterator(Attribute[] attributes) { return getIterator(attributes, 0, length()); }
/** * Adds an attribute to the entire string. * @param attribute the attribute key * @param value the value of the attribute; may be null * @exception NullPointerException if <code>attribute</code> is null. * @exception IllegalArgumentException if the AttributedString has length 0 * (attributes cannot be applied to a 0-length range). */ public void addAttribute(Attribute attribute, Object value) { if (attribute == null) { throw new NullPointerException(); } int len = length(); if (len == 0) { throw new IllegalArgumentException("Can't add attribute to 0-length text"); } addAttributeImpl(attribute, value, 0, len); }
/** * Adds an attribute to the entire string. * @param attribute the attribute key * @param value the value of the attribute; may be null * @exception NullPointerException if <code>attribute</code> is null. * @exception IllegalArgumentException if the AttributedString has length 0 * (attributes cannot be applied to a 0-length range). */ public void addAttribute(Attribute attribute, Object value) { if (attribute == null) { throw new NullPointerException(); } int len = length(); if (len == 0) { throw new IllegalArgumentException("Can't add attribute to 0-length text"); } addAttributeImpl(attribute, value, 0, len); }
/** * Adds an attribute to a subrange of the string. * @param attribute the attribute key * @param value The value of the attribute. May be null. * @param beginIndex Index of the first character of the range. * @param endIndex Index of the character following the last character of the range. * @exception NullPointerException if <code>attribute</code> is null. * @exception IllegalArgumentException if beginIndex is less then 0, endIndex is * greater than the length of the string, or beginIndex and endIndex together don't * define a non-empty subrange of the string. */ public void addAttribute(Attribute attribute, Object value, int beginIndex, int endIndex) { if (attribute == null) { throw new NullPointerException(); } if (beginIndex < 0 || endIndex > length() || beginIndex >= endIndex) { throw new IllegalArgumentException("Invalid substring range"); } addAttributeImpl(attribute, value, beginIndex, endIndex); }
/** * Adds an attribute to a subrange of the string. * @param attribute the attribute key * @param value The value of the attribute. May be null. * @param beginIndex Index of the first character of the range. * @param endIndex Index of the character following the last character of the range. * @exception NullPointerException if <code>attribute</code> is null. * @exception IllegalArgumentException if beginIndex is less then 0, endIndex is * greater than the length of the string, or beginIndex and endIndex together don't * define a non-empty subrange of the string. */ public void addAttribute(Attribute attribute, Object value, int beginIndex, int endIndex) { if (attribute == null) { throw new NullPointerException(); } if (beginIndex < 0 || endIndex > length() || beginIndex >= endIndex) { throw new IllegalArgumentException("Invalid substring range"); } addAttributeImpl(attribute, value, beginIndex, endIndex); }
AttributedStringIterator(Attribute[] attributes, int beginIndex, int endIndex) { if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) { throw new IllegalArgumentException("Invalid substring range"); } this.beginIndex = beginIndex; this.endIndex = endIndex; this.currentIndex = beginIndex; updateRunInfo(); if (attributes != null) { relevantAttributes = (Attribute[]) attributes.clone(); } }
if (offset == length()) { return runCount;
AttributedStringIterator(Attribute[] attributes, int beginIndex, int endIndex) { if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) { throw new IllegalArgumentException("Invalid substring range"); } this.beginIndex = beginIndex; this.endIndex = endIndex; this.currentIndex = beginIndex; updateRunInfo(); if (attributes != null) { relevantAttributes = (Attribute[]) attributes.clone(); } }
if (offset == length()) { return runCount;
if (beginIndex < 0 || endIndex > length() || beginIndex > endIndex) { throw new IllegalArgumentException("Invalid substring range");
if (beginIndex < 0 || endIndex > length() || beginIndex > endIndex) { throw new IllegalArgumentException("Invalid substring range");
int textLength = length(); if (endIndex < textLength) { int currIndex = runIndex;
int textLength = length(); if (endIndex < textLength) { int currIndex = runIndex;