This patch (committed) adds @since tags and reformats the source files to match our
coding style a little better:
2006-09-11 David Gilbert <[EMAIL PROTECTED]>
* java/text/AttributedCharacterIterator.java: Added @since tag,
renamed some variables (no underscores) and removed some spaces to
match the common style,
* java/text/AttributedString.java: Likewise,
* java/text/AttributedStringIterator.java: Likewise.
Regards,
Dave
Index: java/text/AttributedCharacterIterator.java
===================================================================
RCS file:
/sources/classpath/classpath/java/text/AttributedCharacterIterator.java,v
retrieving revision 1.14
diff -u -r1.14 AttributedCharacterIterator.java
--- java/text/AttributedCharacterIterator.java 11 Mar 2006 12:32:02 -0000
1.14
+++ java/text/AttributedCharacterIterator.java 11 Sep 2006 13:04:06 -0000
@@ -1,5 +1,5 @@
/* AttributedCharacterIterator.java -- Iterate over attributes
- Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,6 +53,8 @@
* that is defined for a particular value across an entire range of
* characters or which is undefined over a range of characters.
*
+ * @since 1.2
+ *
* @author Aaron M. Renn ([EMAIL PROTECTED])
*/
public interface AttributedCharacterIterator extends CharacterIterator
@@ -68,7 +70,7 @@
* This is the attribute for the language of the text. The value of
* attributes of this key type are instances of <code>Locale</code>.
*/
- public static final Attribute LANGUAGE = new Attribute ("LANGUAGE");
+ public static final Attribute LANGUAGE = new Attribute("LANGUAGE");
/**
* This is the attribute for the reading form of text. This is used
@@ -77,7 +79,7 @@
* instances of <code>Annotation</code> which wrappers a
* <code>String</code>.
*/
- public static final Attribute READING = new Attribute ("READING");
+ public static final Attribute READING = new Attribute("READING");
/**
* This is the attribute for input method segments. The value of
attributes
@@ -85,7 +87,7 @@
* a <code>String</code>.
*/
public static final Attribute INPUT_METHOD_SEGMENT =
- new Attribute ("INPUT_METHOD_SEGMENT");
+ new Attribute("INPUT_METHOD_SEGMENT");
/**
* The name of the attribute key
@@ -98,7 +100,7 @@
*
* @param name The name of this attribute key.
*/
- protected Attribute (String name)
+ protected Attribute(String name)
{
this.name = name;
}
@@ -156,7 +158,7 @@
* @return <code>true</code> if the specified object is equal to this one,
* <code>false</code> otherwise.
*/
- public final boolean equals (Object obj)
+ public final boolean equals(Object obj)
{
if (obj == this)
return true;
@@ -211,7 +213,7 @@
*
* @return The value of the specified attribute
*/
- Object getAttribute (AttributedCharacterIterator.Attribute attrib);
+ Object getAttribute(AttributedCharacterIterator.Attribute attrib);
/**
* Returns the index of the first character in the run that
@@ -230,7 +232,7 @@
*
* @return The start index of the run.
*/
- int getRunStart (Set attribs);
+ int getRunStart(Set attribs);
/**
* Returns the index of the first character in the run that
@@ -240,7 +242,7 @@
*
* @return The start index of the run.
*/
- int getRunStart (AttributedCharacterIterator.Attribute attrib);
+ int getRunStart(AttributedCharacterIterator.Attribute attrib);
/**
* Returns the index of the character after the end of the run
@@ -259,7 +261,7 @@
*
* @return The end index of the run.
*/
- int getRunLimit (Set attribs);
+ int getRunLimit(Set attribs);
/**
* Returns the index of the character after the end of the run
@@ -269,6 +271,6 @@
*
* @return The end index of the run.
*/
- int getRunLimit (AttributedCharacterIterator.Attribute attrib);
+ int getRunLimit(AttributedCharacterIterator.Attribute attrib);
} // interface AttributedCharacterIterator
Index: java/text/AttributedString.java
===================================================================
RCS file: /sources/classpath/classpath/java/text/AttributedString.java,v
retrieving revision 1.17
diff -u -r1.17 AttributedString.java
--- java/text/AttributedString.java 11 Sep 2006 10:45:02 -0000 1.17
+++ java/text/AttributedString.java 11 Sep 2006 13:04:07 -0000
@@ -50,6 +50,8 @@
* This class models a <code>String</code> with attributes over various
* subranges of the string. It allows applications to access this
* information via the <code>AttributedCharacterIterator</code> interface.
+ *
+ * @since 1.2
*
* @author Aaron M. Renn ([EMAIL PROTECTED])
*/
@@ -66,23 +68,23 @@
Map attribs;
/** The beginning index of the attributes */
- int begin_index;
+ int beginIndex;
/** The ending index of the attributes */
- int end_index;
+ int endIndex;
/**
* Creates a new attribute range.
*
* @param attribs the attributes.
- * @param begin_index the start index.
- * @param end_index the end index.
+ * @param beginIndex the start index.
+ * @param endIndex the end index.
*/
- AttributeRange(Map attribs, int begin_index, int end_index)
+ AttributeRange(Map attribs, int beginIndex, int endIndex)
{
this.attribs = attribs;
- this.begin_index = begin_index;
- this.end_index = end_index;
+ this.beginIndex = beginIndex;
+ this.endIndex = endIndex;
}
} // Inner class AttributeRange
@@ -147,13 +149,13 @@
*
* @param aci The <code>AttributedCharacterIterator</code> containing the
* text and attribute information.
- * @param begin_index The beginning index of the text subrange.
- * @param end_index The ending index of the text subrange.
+ * @param beginIndex The beginning index of the text subrange.
+ * @param endIndex The ending index of the text subrange.
*/
- public AttributedString(AttributedCharacterIterator aci, int begin_index,
- int end_index)
+ public AttributedString(AttributedCharacterIterator aci, int beginIndex,
+ int endIndex)
{
- this(aci, begin_index, end_index, null);
+ this(aci, beginIndex, endIndex, null);
}
/**
@@ -181,9 +183,9 @@
StringBuffer sb = new StringBuffer("");
// Get the valid attribute list
- Set all_attribs = aci.getAllAttributeKeys();
+ Set allAttribs = aci.getAllAttributeKeys();
if (attributes != null)
- all_attribs.retainAll(Arrays.asList(attributes));
+ allAttribs.retainAll(Arrays.asList(attributes));
// Loop through and extract the attributes
char c = aci.setIndex(begin);
@@ -193,7 +195,7 @@
{
sb.append(c);
- Iterator iter = all_attribs.iterator();
+ Iterator iter = allAttribs.iterator();
while(iter.hasNext())
{
Object obj = iter.next();
@@ -206,8 +208,8 @@
(AttributedCharacterIterator.Attribute)obj;
// Make sure the attribute is defined.
- Object attrib_obj = aci.getAttribute(attrib);
- if (attrib_obj == null)
+ Object attribObj = aci.getAttribute(attrib);
+ if (attribObj == null)
continue;
int rl = aci.getRunLimit(attrib);
if (rl > end)
@@ -224,18 +226,18 @@
rs -= begin;
if (rs < 0)
{
- if (attrib_obj instanceof Annotation)
+ if (attribObj instanceof Annotation)
continue;
rs = 0;
}
// Create a map object. Yes this will only contain one attribute
- Map new_map = new Hashtable();
- new_map.put(attrib, attrib_obj);
+ Map newMap = new Hashtable();
+ newMap.put(attrib, attribObj);
// Add it to the attribute list.
- accum.add(new AttributeRange(new_map, rs, rl));
+ accum.add(new AttributeRange(newMap, rs, rl));
}
c = aci.next();
@@ -290,27 +292,27 @@
* specified subrange of the string.
*
* @param attributes The list of attributes.
- * @param begin_index The beginning index.
- * @param end_index The ending index
+ * @param beginIndex The beginning index.
+ * @param endIndex The ending index
*
* @throws NullPointerException if <code>attributes</code> is
* <code>null</code>.
* @throws IllegalArgumentException if the subrange is not valid.
*/
- public void addAttributes(Map attributes, int begin_index, int end_index)
+ public void addAttributes(Map attributes, int beginIndex, int endIndex)
{
if (attributes == null)
throw new NullPointerException("null attribute");
- if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
- (end_index <= begin_index))
+ if ((beginIndex < 0) || (endIndex > sci.getEndIndex()) ||
+ (endIndex <= beginIndex))
throw new IllegalArgumentException("bad range");
AttributeRange[] new_list = new AttributeRange[attribs.length + 1];
System.arraycopy(attribs, 0, new_list, 0, attribs.length);
attribs = new_list;
- attribs[attribs.length - 1] = new AttributeRange(attributes, begin_index,
- end_index);
+ attribs[attribs.length - 1] = new AttributeRange(attributes, beginIndex,
+ endIndex);
}
/**
@@ -351,20 +353,20 @@
* returned.
*
* @param attributes A list of attributes to include in the returned
iterator.
- * @param begin_index The beginning index of the subrange.
- * @param end_index The ending index of the subrange.
+ * @param beginIndex The beginning index of the subrange.
+ * @param endIndex The ending index of the subrange.
*
* @return An <code>AttributedCharacterIterator</code> for this string.
*/
public AttributedCharacterIterator getIterator(
AttributedCharacterIterator.Attribute[] attributes,
- int begin_index, int end_index)
+ int beginIndex, int endIndex)
{
- if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
- (end_index < begin_index))
+ if ((beginIndex < 0) || (endIndex > sci.getEndIndex()) ||
+ (endIndex < beginIndex))
throw new IllegalArgumentException("bad range");
- return(new AttributedStringIterator(sci, attribs, begin_index, end_index,
+ return(new AttributedStringIterator(sci, attribs, beginIndex, endIndex,
attributes));
}
Index: java/text/AttributedStringIterator.java
===================================================================
RCS file: /sources/classpath/classpath/java/text/AttributedStringIterator.java,v
retrieving revision 1.12
diff -u -r1.12 AttributedStringIterator.java
--- java/text/AttributedStringIterator.java 24 Oct 2005 16:29:10 -0000
1.12
+++ java/text/AttributedStringIterator.java 11 Sep 2006 13:04:07 -0000
@@ -1,5 +1,5 @@
/* AttributedStringIterator.java -- Class to iterate over AttributedString
- Copyright (C) 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,12 +71,21 @@
/*************************************************************************/
+ /**
+ * Creates a new instance.
+ *
+ * @param sci an iterator for the string content.
+ * @param attribs the attribute ranges.
+ * @param beginIndex the start index.
+ * @param endIndex the end index.
+ * @param restricts the attributes that the user is interested in.
+ */
AttributedStringIterator(StringCharacterIterator sci,
AttributedString.AttributeRange[] attribs,
- int begin_index, int end_index,
+ int beginIndex, int endIndex,
AttributedCharacterIterator.Attribute[] restricts)
{
- this.ci = new StringCharacterIterator(sci, begin_index, end_index);
+ this.ci = new StringCharacterIterator(sci, beginIndex, endIndex);
this.attribs = attribs;
this.restricts = restricts;
}
@@ -154,8 +163,8 @@
for (int i = 0; i < attribs.length; i++)
{
- if (attribs[i].begin_index > getEndIndex()
- || attribs[i].end_index <= getBeginIndex())
+ if (attribs[i].beginIndex > getEndIndex()
+ || attribs[i].endIndex <= getBeginIndex())
continue;
Set key_set = attribs[i].attribs.keySet();
@@ -333,7 +342,7 @@
return null;
for (int i = attribs.length - 1; i >= 0; i--)
{
- if (pos >= attribs[i].begin_index && pos < attribs[i].end_index)
+ if (pos >= attribs[i].beginIndex && pos < attribs[i].endIndex)
{
Set keys = attribs[i].attribs.keySet();
if (keys.contains(key))
@@ -373,8 +382,8 @@
for (int i = 0; i < attribs.length; i++)
{
- if ((ci.getIndex() >= attribs[i].begin_index) &&
- (ci.getIndex() < attribs[i].end_index))
+ if ((ci.getIndex() >= attribs[i].beginIndex) &&
+ (ci.getIndex() < attribs[i].endIndex))
m.putAll(attribs[i].attribs);
}