+2004-03-11 Dalibor Topic <robilad@kaffe.org>
+
+ * java/text/AttributedString.java
+ (addAttribute(AttributedCharacterIterator.Attribute,Object,int,int)):
+ Use HashMap instead of Hashtable since value can be null, and
+ you can not store a null value in a Hashtable.
+
+2004-03-11 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/text/AttributedStringIterator.java
+ (getAllAttributesKey): Return only keys concerned
+ by the current iterator.
+ (getAttributes): Use strict inequality for
+ end_index.
+
2004-03-11 Michael Koch <konqueror@gmx.de>
* java/net/HttpURLConnection.java:
/* AttributedString.java -- Models text with attributes
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
package java.text;
import java.util.Iterator;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.HashSet;
import java.util.Map;
* of the string.
*
* @param attrib The attribute to add.
- * @param value The value of the attribute.
+ * @param value The value of the attribute, which may be null.
* @param begin_index The beginning index of the subrange.
* @param end_index The ending index of the subrange.
*
if (attrib == null)
throw new IllegalArgumentException("null attribute");
- Hashtable ht = new Hashtable();
- ht.put(attrib, value);
+ HashMap hm = new HashMap();
+ hm.put(attrib, value);
- addAttributes(ht, begin_index, end_index);
+ addAttributes(hm, begin_index, end_index);
}
/*************************************************************************/
if (attribs == null)
return(s);
- for (int i = 0; i < attribs.length; i++)
+ for (int i = 0; i < attribs.length; i++)
{
+ if (attribs[i].begin_index > getEndIndex()
+ || attribs[i].end_index <= getBeginIndex())
+ continue;
+
Set key_set = attribs[i].attribs.keySet();
Iterator iter = key_set.iterator();
while (iter.hasNext())
// Check for attribute match and range match
if (obj.equals(attrib))
if ((ci.getIndex() >= attribs[i].begin_index) &&
- (ci.getIndex() <= attribs[i].end_index))
+ (ci.getIndex() < attribs[i].end_index))
return(attribs[i].attribs.get(obj));
}
}
for (int i = 0; i < attribs.length; i++)
{
if ((ci.getIndex() >= attribs[i].begin_index) &&
- (ci.getIndex() <= attribs[i].end_index))
+ (ci.getIndex() < attribs[i].end_index))
m.putAll(attribs[i].attribs);
}