Commit 1ce9c63d by Michael Koch

[multiple changes]

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.

From-SVN: r79329
parent c21a266b
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> 2004-03-11 Michael Koch <konqueror@gmx.de>
* java/net/HttpURLConnection.java: * java/net/HttpURLConnection.java:
......
/* AttributedString.java -- Models text with attributes /* 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. This file is part of GNU Classpath.
...@@ -39,6 +39,7 @@ exception statement from your version. */ ...@@ -39,6 +39,7 @@ exception statement from your version. */
package java.text; package java.text;
import java.util.Iterator; import java.util.Iterator;
import java.util.HashMap;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
...@@ -329,7 +330,7 @@ addAttribute(AttributedCharacterIterator.Attribute attrib, Object value) ...@@ -329,7 +330,7 @@ addAttribute(AttributedCharacterIterator.Attribute attrib, Object value)
* of the string. * of the string.
* *
* @param attrib The attribute to add. * @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 begin_index The beginning index of the subrange.
* @param end_index The ending index of the subrange. * @param end_index The ending index of the subrange.
* *
...@@ -342,10 +343,10 @@ addAttribute(AttributedCharacterIterator.Attribute attrib, Object value, ...@@ -342,10 +343,10 @@ addAttribute(AttributedCharacterIterator.Attribute attrib, Object value,
if (attrib == null) if (attrib == null)
throw new IllegalArgumentException("null attribute"); throw new IllegalArgumentException("null attribute");
Hashtable ht = new Hashtable(); HashMap hm = new HashMap();
ht.put(attrib, value); hm.put(attrib, value);
addAttributes(ht, begin_index, end_index); addAttributes(hm, begin_index, end_index);
} }
/*************************************************************************/ /*************************************************************************/
......
...@@ -179,8 +179,12 @@ getAllAttributeKeys() ...@@ -179,8 +179,12 @@ getAllAttributeKeys()
if (attribs == null) if (attribs == null)
return(s); 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(); Set key_set = attribs[i].attribs.keySet();
Iterator iter = key_set.iterator(); Iterator iter = key_set.iterator();
while (iter.hasNext()) while (iter.hasNext())
...@@ -327,7 +331,7 @@ getAttribute(AttributedCharacterIterator.Attribute attrib) ...@@ -327,7 +331,7 @@ getAttribute(AttributedCharacterIterator.Attribute attrib)
// Check for attribute match and range match // Check for attribute match and range match
if (obj.equals(attrib)) if (obj.equals(attrib))
if ((ci.getIndex() >= attribs[i].begin_index) && 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)); return(attribs[i].attribs.get(obj));
} }
} }
...@@ -351,7 +355,7 @@ getAttributes() ...@@ -351,7 +355,7 @@ getAttributes()
for (int i = 0; i < attribs.length; i++) for (int i = 0; i < attribs.length; i++)
{ {
if ((ci.getIndex() >= attribs[i].begin_index) && if ((ci.getIndex() >= attribs[i].begin_index) &&
(ci.getIndex() <= attribs[i].end_index)) (ci.getIndex() < attribs[i].end_index))
m.putAll(attribs[i].attribs); m.putAll(attribs[i].attribs);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment