/** * Returns an {@code AttributedCharacterIterator} that gives access to the * complete content of this attributed string. Only attributes contained in * {@code attributes} are available from this iterator if they are defined * for this text. * * @param attributes * the array containing attributes that will be in the new * iterator if they are defined for this text. * @return the newly created {@code AttributedCharacterIterator}. */ public AttributedCharacterIterator getIterator( AttributedCharacterIterator.Attribute[] attributes) { return new AttributedIterator(this, attributes, 0, text.length()); }
public Map<Attribute, Object> getAttributes() { Map<Attribute, Object> result = new HashMap<Attribute, Object>( (attrString.attributeMap.size() * 4 / 3) + 1); Iterator<Map.Entry<Attribute, List<Range>>> it = attrString.attributeMap .entrySet().iterator(); while (it.hasNext()) { Map.Entry<Attribute, List<Range>> entry = it.next(); if (attributesAllowed == null || attributesAllowed.contains(entry.getKey())) { Object value = currentValue(entry.getValue()); if (value != null) { result.put(entry.getKey(), value); } } } return result; }
public int getRunLimit(Set<? extends Attribute> attributes) { int limit = end; Iterator<? extends Attribute> it = attributes.iterator(); while (it.hasNext()) { AttributedCharacterIterator.Attribute attribute = it.next(); int newLimit = getRunLimit(attribute); if (newLimit < limit) { limit = newLimit; } } return limit; }
/** * Returns a set of attributes present in the {@code AttributedString}. * An empty set returned indicates that no attributes where defined. * * @return a set of attribute keys that may be empty. */ public Set<AttributedIterator.Attribute> getAllAttributeKeys() { if (begin == 0 && end == attrString.text.length() && attributesAllowed == null) { return attrString.attributeMap.keySet(); } Set<AttributedIterator.Attribute> result = new HashSet<Attribute>( (attrString.attributeMap.size() * 4 / 3) + 1); Iterator<Map.Entry<Attribute, List<Range>>> it = attrString.attributeMap .entrySet().iterator(); while (it.hasNext()) { Map.Entry<Attribute, List<Range>> entry = it.next(); if (attributesAllowed == null || attributesAllowed.contains(entry.getKey())) { List<Range> ranges = entry.getValue(); if (inRange(ranges)) { result.add(entry.getKey()); } } } return result; }
/** * Returns an {@code AttributedCharacterIterator} that gives access to the * contents of this attributed string starting at index {@code start} up to * index {@code end}. Only attributes contained in {@code attributes} are * available from this iterator if they are defined for this text. * * @param attributes * the array containing attributes that will be in the new * iterator if they are defined for this text. * @param start * the start index of the iterator on the underlying text. * @param end * the end index of the iterator on the underlying text. * @return the newly created {@code AttributedCharacterIterator}. */ public AttributedCharacterIterator getIterator( AttributedCharacterIterator.Attribute[] attributes, int start, int end) { return new AttributedIterator(this, attributes, start, end); } }
/** * Returns an {@code AttributedCharacterIterator} that gives access to the * contents of this attributed string starting at index {@code start} up to * index {@code end}. Only attributes contained in {@code attributes} are * available from this iterator if they are defined for this text. * * @param attributes * the array containing attributes that will be in the new * iterator if they are defined for this text. * @param start * the start index of the iterator on the underlying text. * @param end * the end index of the iterator on the underlying text. * @return the newly created {@code AttributedCharacterIterator}. */ public AttributedCharacterIterator getIterator( AttributedCharacterIterator.Attribute[] attributes, int start, int end) { return new AttributedIterator(this, attributes, start, end); } }
/** * Returns an {@code AttributedCharacterIterator} that gives access to the * contents of this attributed string starting at index {@code start} up to * index {@code end}. Only attributes contained in {@code attributes} are * available from this iterator if they are defined for this text. * * @param attributes * the array containing attributes that will be in the new * iterator if they are defined for this text. * @param start * the start index of the iterator on the underlying text. * @param end * the end index of the iterator on the underlying text. * @return the newly created {@code AttributedCharacterIterator}. */ public AttributedCharacterIterator getIterator( AttributedCharacterIterator.Attribute[] attributes, int start, int end) { return new AttributedIterator(this, attributes, start, end); } }
/** * Returns an {@code AttributedCharacterIterator} that gives access to the * contents of this attributed string starting at index {@code start} up to * index {@code end}. Only attributes contained in {@code attributes} are * available from this iterator if they are defined for this text. * * @param attributes * the array containing attributes that will be in the new * iterator if they are defined for this text. * @param start * the start index of the iterator on the underlying text. * @param end * the end index of the iterator on the underlying text. * @return the newly created {@code AttributedCharacterIterator}. */ public AttributedCharacterIterator getIterator( AttributedCharacterIterator.Attribute[] attributes, int start, int end) { return new AttributedIterator(this, attributes, start, end); } }
/** * Returns an {@code AttributedCharacterIterator} that gives access to the * contents of this attributed string starting at index {@code start} up to * index {@code end}. Only attributes contained in {@code attributes} are * available from this iterator if they are defined for this text. * * @param attributes * the array containing attributes that will be in the new * iterator if they are defined for this text. * @param start * the start index of the iterator on the underlying text. * @param end * the end index of the iterator on the underlying text. * @return the newly created {@code AttributedCharacterIterator}. */ public AttributedCharacterIterator getIterator( AttributedCharacterIterator.Attribute[] attributes, int start, int end) { return new AttributedIterator(this, attributes, start, end); } }
/** * Returns an {@code AttributedCharacterIterator} that gives access to the * contents of this attributed string starting at index {@code start} up to * index {@code end}. Only attributes contained in {@code attributes} are * available from this iterator if they are defined for this text. * * @param attributes * the array containing attributes that will be in the new * iterator if they are defined for this text. * @param start * the start index of the iterator on the underlying text. * @param end * the end index of the iterator on the underlying text. * @return the newly created {@code AttributedCharacterIterator}. */ public AttributedCharacterIterator getIterator( AttributedCharacterIterator.Attribute[] attributes, int start, int end) { return new AttributedIterator(this, attributes, start, end); } }
public Map<Attribute, Object> getAttributes() { Map<Attribute, Object> result = new HashMap<Attribute, Object>( (attrString.attributeMap.size() * 4 / 3) + 1); Iterator<Map.Entry<Attribute, List<Range>>> it = attrString.attributeMap .entrySet().iterator(); while (it.hasNext()) { Map.Entry<Attribute, List<Range>> entry = it.next(); if (attributesAllowed == null || attributesAllowed.contains(entry.getKey())) { Object value = currentValue(entry.getValue()); if (value != null) { result.put(entry.getKey(), value); } } } return result; }
private int runStart(List<Range> ranges) { int result = begin; Iterator<Range> it = ranges.iterator(); while (it.hasNext()) { Range range = it.next(); if (range.start >= end) { break; } if (offset >= range.start && offset < range.end) { return inRange(range) ? range.start : result; } else if (offset < range.start) { break; } result = range.end; } return result; }
private int runLimit(List<Range> ranges) { int result = end; ListIterator<Range> it = ranges.listIterator(ranges.size()); while (it.hasPrevious()) { Range range = it.previous(); if (range.end <= begin) { break; } if (offset >= range.start && offset < range.end) { return inRange(range) ? range.end : result; } else if (offset >= range.end) { break; } result = range.start; } return result; }
private int runLimit(List<Range> ranges) { int result = end; ListIterator<Range> it = ranges.listIterator(ranges.size()); while (it.hasPrevious()) { Range range = it.previous(); if (range.end <= begin) { break; } if (offset >= range.start && offset < range.end) { return inRange(range) ? range.end : result; } else if (offset >= range.end) { break; } result = range.start; } return result; }
private int runStart(List<Range> ranges) { int result = begin; Iterator<Range> it = ranges.iterator(); while (it.hasNext()) { Range range = it.next(); if (range.start >= end) { break; } if (offset >= range.start && offset < range.end) { return inRange(range) ? range.start : result; } else if (offset < range.start) { break; } result = range.end; } return result; }
private int runStart(List<Range> ranges) { int result = begin; Iterator<Range> it = ranges.iterator(); while (it.hasNext()) { Range range = it.next(); if (range.start >= end) { break; } if (offset >= range.start && offset < range.end) { return inRange(range) ? range.start : result; } else if (offset < range.start) { break; } result = range.end; } return result; }
private int runLimit(List<Range> ranges) { int result = end; ListIterator<Range> it = ranges.listIterator(ranges.size()); while (it.hasPrevious()) { Range range = it.previous(); if (range.end <= begin) { break; } if (offset >= range.start && offset < range.end) { return inRange(range) ? range.end : result; } else if (offset >= range.end) { break; } result = range.start; } return result; }
public Map<Attribute, Object> getAttributes() { Map<Attribute, Object> result = new HashMap<Attribute, Object>( (attrString.attributeMap.size() * 4 / 3) + 1); Iterator<Map.Entry<Attribute, List<Range>>> it = attrString.attributeMap .entrySet().iterator(); while (it.hasNext()) { Map.Entry<Attribute, List<Range>> entry = it.next(); if (attributesAllowed == null || attributesAllowed.contains(entry.getKey())) { Object value = currentValue(entry.getValue()); if (value != null) { result.put(entry.getKey(), value); } } } return result; }
private int runLimit(List<Range> ranges) { int result = end; ListIterator<Range> it = ranges.listIterator(ranges.size()); while (it.hasPrevious()) { Range range = it.previous(); if (range.end <= begin) { break; } if (offset >= range.start && offset < range.end) { return inRange(range) ? range.end : result; } else if (offset >= range.end) { break; } result = range.start; } return result; }
public Map<Attribute, Object> getAttributes() { Map<Attribute, Object> result = new HashMap<Attribute, Object>( (attrString.attributeMap.size() * 4 / 3) + 1); Iterator<Map.Entry<Attribute, List<Range>>> it = attrString.attributeMap .entrySet().iterator(); while (it.hasNext()) { Map.Entry<Attribute, List<Range>> entry = it.next(); if (attributesAllowed == null || attributesAllowed.contains(entry.getKey())) { Object value = currentValue(entry.getValue()); if (value != null) { result.put(entry.getKey(), value); } } } return result; }