diff options
author | Matthias Klose <doko@gcc.gnu.org> | 2012-12-19 17:03:15 +0000 |
---|---|---|
committer | Matthias Klose <doko@gcc.gnu.org> | 2012-12-19 17:03:15 +0000 |
commit | a1906e8bbfa426ed1adfe751608bc74f1d4d2ab7 (patch) | |
tree | 9b478aacc6b13f1beadacec2ade096dcb732af53 /libjava/classpath/java/text/AttributedStringIterator.java | |
parent | baeb2e16475b278e83fe73751d4f0f572805b16e (diff) | |
download | gcc-a1906e8bbfa426ed1adfe751608bc74f1d4d2ab7.zip gcc-a1906e8bbfa426ed1adfe751608bc74f1d4d2ab7.tar.gz gcc-a1906e8bbfa426ed1adfe751608bc74f1d4d2ab7.tar.bz2 |
Import GNU Classpath (20121202).
2012-12-19 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (20121202).
* Regenerate class and header files.
* Regenerate auto* files.
* sources.am, gcj/javaprims.h: Regenerate.
* gnu/java/nio/FileLockImpl.java (close): New override.
From-SVN: r194618
Diffstat (limited to 'libjava/classpath/java/text/AttributedStringIterator.java')
-rw-r--r-- | libjava/classpath/java/text/AttributedStringIterator.java | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/libjava/classpath/java/text/AttributedStringIterator.java b/libjava/classpath/java/text/AttributedStringIterator.java index 429bd70..6d402cb 100644 --- a/libjava/classpath/java/text/AttributedStringIterator.java +++ b/libjava/classpath/java/text/AttributedStringIterator.java @@ -1,5 +1,5 @@ /* AttributedStringIterator.java -- Class to iterate over AttributedString - Copyright (C) 1998, 1999, 2004, 2005, 2006, Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2004, 2005, 2006, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,6 +44,8 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; +import static java.text.AttributedCharacterIterator.Attribute; + /** * This class implements the AttributedCharacterIterator interface. It * is used by AttributedString.getIterator(). @@ -67,7 +69,7 @@ class AttributedStringIterator implements AttributedCharacterIterator * The list of attributes that the user is interested in. We may, * at our option, not return any other attributes. */ - private AttributedCharacterIterator.Attribute[] restricts; + private Attribute[] restricts; /*************************************************************************/ @@ -155,9 +157,9 @@ class AttributedStringIterator implements AttributedCharacterIterator * Returns a list of all the attribute keys that are defined anywhere * on this string. */ - public Set getAllAttributeKeys() + public Set<Attribute> getAllAttributeKeys() { - HashSet s = new HashSet(); + HashSet<Attribute> s = new HashSet<Attribute>(); if (attribs == null) return(s); @@ -167,8 +169,7 @@ class AttributedStringIterator implements AttributedCharacterIterator || attribs[i].endIndex <= getBeginIndex()) continue; - Set key_set = attribs[i].attribs.keySet(); - Iterator iter = key_set.iterator(); + Iterator<? extends Attribute> iter = attribs[i].attribs.keySet().iterator(); while (iter.hasNext()) { s.add(iter.next()); @@ -190,14 +191,14 @@ class AttributedStringIterator implements AttributedCharacterIterator return getRunLimit(getAllAttributeKeys()); } - public int getRunLimit(AttributedCharacterIterator.Attribute attrib) + public int getRunLimit(Attribute attrib) { - HashSet s = new HashSet(); + HashSet<Attribute> s = new HashSet<Attribute>(); s.add(attrib); return(getRunLimit(s)); } - public synchronized int getRunLimit(Set attributeSet) + public synchronized int getRunLimit(Set<? extends Attribute> attributeSet) { if (attributeSet == null) return ci.getEndIndex(); @@ -207,13 +208,13 @@ class AttributedStringIterator implements AttributedCharacterIterator int limit = current; if (current == end) return end; - Map runValues = getAttributes(); + Map<Attribute,Object> runValues = getAttributes(); while (limit < end) { - Iterator iterator = attributeSet.iterator(); + Iterator<? extends Attribute> iterator = attributeSet.iterator(); while (iterator.hasNext()) { - Attribute attributeKey = (Attribute) iterator.next(); + Attribute attributeKey = iterator.next(); Object v1 = runValues.get(attributeKey); Object v2 = getAttribute(attributeKey, limit + 1); boolean changed = false; @@ -262,11 +263,11 @@ class AttributedStringIterator implements AttributedCharacterIterator * * return The index of the first character in the run. */ - public int getRunStart(AttributedCharacterIterator.Attribute attrib) + public int getRunStart(Attribute attrib) { if (attrib == null) return ci.getBeginIndex(); - HashSet s = new HashSet(); + HashSet<Attribute> s = new HashSet<Attribute>(); s.add(attrib); return(getRunStart(s)); } @@ -279,7 +280,7 @@ class AttributedStringIterator implements AttributedCharacterIterator * * return The index of the first character in the run. */ - public int getRunStart(Set attributeSet) + public int getRunStart(Set<? extends Attribute> attributeSet) { if (attributeSet == null) return ci.getBeginIndex(); @@ -289,14 +290,14 @@ class AttributedStringIterator implements AttributedCharacterIterator int start = current; if (start == begin) return begin; - Map runValues = getAttributes(); + Map<Attribute, Object> runValues = getAttributes(); int prev = start - 1; while (start > begin) { - Iterator iterator = attributeSet.iterator(); + Iterator<? extends Attribute> iterator = attributeSet.iterator(); while (iterator.hasNext()) { - Attribute attributeKey = (Attribute) iterator.next(); + Attribute attributeKey = iterator.next(); Object v1 = runValues.get(attributeKey); Object v2 = getAttribute(attributeKey, prev); boolean changed = false; @@ -340,7 +341,7 @@ class AttributedStringIterator implements AttributedCharacterIterator { if (pos >= attribs[i].beginIndex && pos < attribs[i].endIndex) { - Set keys = attribs[i].attribs.keySet(); + Set<? extends Attribute> keys = attribs[i].attribs.keySet(); if (keys.contains(key)) { return attribs[i].attribs.get(key); @@ -370,9 +371,9 @@ class AttributedStringIterator implements AttributedCharacterIterator * Return a list of all the attributes and values defined for this * character */ - public Map getAttributes() + public Map<Attribute,Object> getAttributes() { - HashMap m = new HashMap(); + HashMap<Attribute,Object> m = new HashMap<Attribute,Object>(); if (attribs == null) return(m); |