--- old/src/share/classes/java/lang/AbstractStringBuilder.java 2012-01-23 09:34:30.000000000 -0800 +++ new/src/share/classes/java/lang/AbstractStringBuilder.java 2012-01-23 09:34:30.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,10 +91,10 @@ * array is allocated with greater capacity. The new capacity is the * larger of: *
minimumCapacity
argument.
- * 2
.
+ * minimumCapacity
argument is nonpositive, this
+ * If the {@code minimumCapacity} argument is nonpositive, this
* method takes no action and simply returns.
*
* @param minimumCapacity the minimum desired capacity.
@@ -147,26 +147,26 @@
* Sets the length of the character sequence.
* The sequence is changed to a new character sequence
* whose length is specified by the argument. For every nonnegative
- * index k less than newLength
, the character at
+ * index k less than {@code newLength}, the character at
* index k in the new character sequence is the same as the
* character at index k in the old sequence if k is less
* than the length of the old character sequence; otherwise, it is the
- * null character '\u0000'
.
+ * null character {@code '\u005Cu0000'}.
*
- * In other words, if the newLength
argument is less than
+ * In other words, if the {@code newLength} argument is less than
* the current length, the length is changed to the specified length.
*
- * If the newLength
argument is greater than or equal
+ * If the {@code newLength} argument is greater than or equal
* to the current length, sufficient null characters
- * ('\u0000'
) are appended so that
- * length becomes the newLength
argument.
+ * ({@code '\u005Cu0000'}) are appended so that
+ * length becomes the {@code newLength} argument.
*
- * The newLength
argument must be greater than or equal
- * to 0
.
+ * The {@code newLength} argument must be greater than or equal
+ * to {@code 0}.
*
* @param newLength the new length
* @throws IndexOutOfBoundsException if the
- * newLength
argument is negative.
+ * {@code newLength} argument is negative.
*/
public void setLength(int newLength) {
if (newLength < 0)
@@ -182,21 +182,21 @@
}
/**
- * Returns the char
value in this sequence at the specified index.
- * The first char
value is at index 0
, the next at index
- * 1
, and so on, as in array indexing.
+ * Returns the {@code char} value in this sequence at the specified index.
+ * The first {@code char} value is at index {@code 0}, the next at index
+ * {@code 1}, and so on, as in array indexing.
*
* The index argument must be greater than or equal to
- * 0
, and less than the length of this sequence.
+ * {@code 0}, and less than the length of this sequence.
*
- *
If the char
value specified by the index is a
+ *
If the {@code char} value specified by the index is a
* surrogate, the surrogate
* value is returned.
*
- * @param index the index of the desired char
value.
- * @return the char
value at the specified index.
- * @throws IndexOutOfBoundsException if index
is
- * negative or greater than or equal to length()
.
+ * @param index the index of the desired {@code char} value.
+ * @return the {@code char} value at the specified index.
+ * @throws IndexOutOfBoundsException if {@code index} is
+ * negative or greater than or equal to {@code length()}.
*/
public char charAt(int index) {
if ((index < 0) || (index >= count))
@@ -206,22 +206,22 @@
/**
* Returns the character (Unicode code point) at the specified
- * index. The index refers to char
values
- * (Unicode code units) and ranges from 0
to
- * {@link #length()} - 1
.
+ * index. The index refers to {@code char} values
+ * (Unicode code units) and ranges from {@code 0} to
+ * {@link #length()}{@code - 1}.
*
- *
If the char
value specified at the given index
+ *
If the {@code char} value specified at the given index
* is in the high-surrogate range, the following index is less
* than the length of this sequence, and the
- * char
value at the following index is in the
+ * {@code char} value at the following index is in the
* low-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char
value at the given index is returned.
+ * the {@code char} value at the given index is returned.
*
- * @param index the index to the char
values
+ * @param index the index to the {@code char} values
* @return the code point value of the character at the
- * index
- * @exception IndexOutOfBoundsException if the index
+ * {@code index}
+ * @exception IndexOutOfBoundsException if the {@code index}
* argument is negative or not less than the length of this
* sequence.
*/
@@ -234,22 +234,22 @@
/**
* Returns the character (Unicode code point) before the specified
- * index. The index refers to char
values
- * (Unicode code units) and ranges from 1
to {@link
+ * index. The index refers to {@code char} values
+ * (Unicode code units) and ranges from {@code 1} to {@link
* #length()}.
*
- *
If the char
value at (index - 1)
- * is in the low-surrogate range, (index - 2)
is not
- * negative, and the char
value at (index -
- * 2)
is in the high-surrogate range, then the
+ *
If the {@code char} value at {@code (index - 1)}
+ * is in the low-surrogate range, {@code (index - 2)} is not
+ * negative, and the {@code char} value at {@code (index -
+ * 2)} is in the high-surrogate range, then the
* supplementary code point value of the surrogate pair is
- * returned. If the char
value at index -
- * 1
is an unpaired low-surrogate or a high-surrogate, the
+ * returned. If the {@code char} value at {@code index -
+ * 1} is an unpaired low-surrogate or a high-surrogate, the
* surrogate value is returned.
*
* @param index the index following the code point that should be returned
* @return the Unicode code point value before the given index.
- * @exception IndexOutOfBoundsException if the index
+ * @exception IndexOutOfBoundsException if the {@code index}
* argument is less than 1 or greater than the length
* of this sequence.
*/
@@ -264,22 +264,22 @@
/**
* Returns the number of Unicode code points in the specified text
* range of this sequence. The text range begins at the specified
- * beginIndex
and extends to the char
at
- * index endIndex - 1
. Thus the length (in
- * char
s) of the text range is
- * endIndex-beginIndex
. Unpaired surrogates within
+ * {@code beginIndex} and extends to the {@code char} at
+ * index {@code endIndex - 1}. Thus the length (in
+ * {@code char}s) of the text range is
+ * {@code endIndex-beginIndex}. Unpaired surrogates within
* this sequence count as one code point each.
*
- * @param beginIndex the index to the first char
of
+ * @param beginIndex the index to the first {@code char} of
* the text range.
- * @param endIndex the index after the last char
of
+ * @param endIndex the index after the last {@code char} of
* the text range.
* @return the number of Unicode code points in the specified text
* range
* @exception IndexOutOfBoundsException if the
- * beginIndex
is negative, or endIndex
+ * {@code beginIndex} is negative, or {@code endIndex}
* is larger than the length of this sequence, or
- * beginIndex
is larger than endIndex
.
+ * {@code beginIndex} is larger than {@code endIndex}.
*/
public int codePointCount(int beginIndex, int endIndex) {
if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) {
@@ -290,22 +290,22 @@
/**
* Returns the index within this sequence that is offset from the
- * given index
by codePointOffset
code
+ * given {@code index} by {@code codePointOffset} code
* points. Unpaired surrogates within the text range given by
- * index
and codePointOffset
count as
+ * {@code index} and {@code codePointOffset} count as
* one code point each.
*
* @param index the index to be offset
* @param codePointOffset the offset in code points
* @return the index within this sequence
- * @exception IndexOutOfBoundsException if index
+ * @exception IndexOutOfBoundsException if {@code index}
* is negative or larger then the length of this sequence,
- * or if codePointOffset
is positive and the subsequence
- * starting with index
has fewer than
- * codePointOffset
code points,
- * or if codePointOffset
is negative and the subsequence
- * before index
has fewer than the absolute value of
- * codePointOffset
code points.
+ * or if {@code codePointOffset} is positive and the subsequence
+ * starting with {@code index} has fewer than
+ * {@code codePointOffset} code points,
+ * or if {@code codePointOffset} is negative and the subsequence
+ * before {@code index} has fewer than the absolute value of
+ * {@code codePointOffset} code points.
*/
public int offsetByCodePoints(int index, int codePointOffset) {
if (index < 0 || index > count) {
@@ -317,12 +317,12 @@
/**
* Characters are copied from this sequence into the
- * destination character array dst
. The first character to
- * be copied is at index srcBegin
; the last character to
- * be copied is at index srcEnd-1
. The total number of
- * characters to be copied is srcEnd-srcBegin
. The
- * characters are copied into the subarray of dst
starting
- * at index dstBegin
and ending at index:
+ * destination character array {@code dst}. The first character to
+ * be copied is at index {@code srcBegin}; the last character to
+ * be copied is at index {@code srcEnd-1}. The total number of
+ * characters to be copied is {@code srcEnd-srcBegin}. The
+ * characters are copied into the subarray of {@code dst} starting
+ * at index {@code dstBegin} and ending at index:
*
@@ -330,19 +330,19 @@ * @param srcBegin start copying at this offset. * @param srcEnd stop copying at this offset. * @param dst the array to copy the data into. - * @param dstBegin offset into* dstbegin + (srcEnd-srcBegin) - 1 *
dst
.
- * @throws NullPointerException if dst
is
- * null
.
+ * @param dstBegin offset into {@code dst}.
+ * @throws NullPointerException if {@code dst} is
+ * {@code null}.
* @throws IndexOutOfBoundsException if any of the following is true:
* srcBegin
is negative
- * dstBegin
is negative
- * srcBegin
argument is greater than
- * the srcEnd
argument.
- * srcEnd
is greater than
- * this.length()
.
- * dstBegin+srcEnd-srcBegin
is greater than
- * dst.length
+ * ch
. This
+ * The character at the specified index is set to {@code ch}. This
* sequence is altered to represent a new character sequence that is
* identical to the old character sequence, except that it contains the
- * character ch
at position index
.
+ * character {@code ch} at position {@code index}.
*
* The index argument must be greater than or equal to
- * 0
, and less than the length of this sequence.
+ * {@code 0}, and less than the length of this sequence.
*
* @param index the index of the character to modify.
* @param ch the new character.
- * @throws IndexOutOfBoundsException if index
is
- * negative or greater than or equal to length()
.
+ * @throws IndexOutOfBoundsException if {@code index} is
+ * negative or greater than or equal to {@code length()}.
*/
public void setCharAt(int index, char ch) {
if ((index < 0) || (index >= count))
@@ -741,21 +741,21 @@
}
/**
- * Removes the char
at the specified position in this
- * sequence. This sequence is shortened by one char
.
+ * Removes the {@code char} at the specified position in this
+ * sequence. This sequence is shortened by one {@code char}.
*
*
Note: If the character at the given index is a supplementary
* character, this method does not remove the entire character. If
* correct handling of supplementary characters is required,
- * determine the number of char
s to remove by calling
- * Character.charCount(thisSequence.codePointAt(index))
,
- * where thisSequence
is this sequence.
+ * determine the number of {@code char}s to remove by calling
+ * {@code Character.charCount(thisSequence.codePointAt(index))},
+ * where {@code thisSequence} is this sequence.
*
- * @param index Index of char
to remove
+ * @param index Index of {@code char} to remove
* @return This object.
- * @throws StringIndexOutOfBoundsException if the index
+ * @throws StringIndexOutOfBoundsException if the {@code index}
* is negative or greater than or equal to
- * length()
.
+ * {@code length()}.
*/
public AbstractStringBuilder deleteCharAt(int index) {
if ((index < 0) || (index >= count))
@@ -767,12 +767,12 @@
/**
* Replaces the characters in a substring of this sequence
- * with characters in the specified String
. The substring
- * begins at the specified start
and extends to the character
- * at index end - 1
or to the end of the
+ * with characters in the specified {@code String}. The substring
+ * begins at the specified {@code start} and extends to the character
+ * at index {@code end - 1} or to the end of the
* sequence if no such character exists. First the
* characters in the substring are removed and then the specified
- * String
is inserted at start
. (This
+ * {@code String} is inserted at {@code start}. (This
* sequence will be lengthened to accommodate the
* specified String if necessary.)
*
@@ -780,9 +780,9 @@
* @param end The ending index, exclusive.
* @param str String that will replace previous contents.
* @return This object.
- * @throws StringIndexOutOfBoundsException if start
- * is negative, greater than length()
, or
- * greater than end
.
+ * @throws StringIndexOutOfBoundsException if {@code start}
+ * is negative, greater than {@code length()}, or
+ * greater than {@code end}.
*/
public AbstractStringBuilder replace(int start, int end, String str) {
if (start < 0)
@@ -805,14 +805,14 @@
}
/**
- * Returns a new String
that contains a subsequence of
+ * Returns a new {@code String} that contains a subsequence of
* characters currently contained in this character sequence. The
* substring begins at the specified index and extends to the end of
* this sequence.
*
* @param start The beginning index, inclusive.
* @return The new string.
- * @throws StringIndexOutOfBoundsException if start
is
+ * @throws StringIndexOutOfBoundsException if {@code start} is
* less than zero, or greater than the length of this object.
*/
public String substring(int start) {
@@ -850,18 +850,18 @@
}
/**
- * Returns a new String
that contains a subsequence of
+ * Returns a new {@code String} that contains a subsequence of
* characters currently contained in this sequence. The
- * substring begins at the specified start
and
- * extends to the character at index end - 1
.
+ * substring begins at the specified {@code start} and
+ * extends to the character at index {@code end - 1}.
*
* @param start The beginning index, inclusive.
* @param end The ending index, exclusive.
* @return The new string.
- * @throws StringIndexOutOfBoundsException if start
- * or end
are negative or greater than
- * length()
, or start
is
- * greater than end
.
+ * @throws StringIndexOutOfBoundsException if {@code start}
+ * or {@code end} are negative or greater than
+ * {@code length()}, or {@code start} is
+ * greater than {@code end}.
*/
public String substring(int start, int end) {
if (start < 0)
@@ -1254,15 +1254,15 @@
*
- * is* this.toString().startsWith(str, k) *
true
.
+ * is {@code true}.
*
* @param str any string.
* @return if the string argument occurs as a substring within this
* object, then the index of the first character of the first
* such substring is returned; if it does not occur as a
- * substring, -1
is returned.
- * @throws java.lang.NullPointerException if str
is
- * null
.
+ * substring, {@code -1} is returned.
+ * @throws java.lang.NullPointerException if {@code str} is
+ * {@code null}.
*/
public int indexOf(String str) {
return indexOf(str, 0);
@@ -1282,8 +1282,8 @@
* @param fromIndex the index from which to start the search.
* @return the index within this string of the first occurrence of the
* specified substring, starting at the specified index.
- * @throws java.lang.NullPointerException if str
is
- * null
.
+ * @throws java.lang.NullPointerException if {@code str} is
+ * {@code null}.
*/
public int indexOf(String str, int fromIndex) {
return String.indexOf(value, 0, count,
@@ -1293,7 +1293,7 @@
/**
* Returns the index within this string of the rightmost occurrence
* of the specified substring. The rightmost empty string "" is
- * considered to occur at the index value this.length()
.
+ * considered to occur at the index value {@code this.length()}.
* The returned index is the largest value k such that
* * this.toString().startsWith(str, k) @@ -1304,9 +1304,9 @@ * @return if the string argument occurs one or more times as a substring * within this object, then the index of the first character of * the last such substring is returned. If it does not occur as - * a substring,-1
is returned. - * @throws java.lang.NullPointerException ifstr
is - *null
. + * a substring, {@code -1} is returned. + * @throws java.lang.NullPointerException if {@code str} is + * {@code null}. */ public int lastIndexOf(String str) { return lastIndexOf(str, count); @@ -1326,8 +1326,8 @@ * @param fromIndex the index to start the search from. * @return the index within this sequence of the last occurrence of the * specified substring. - * @throws java.lang.NullPointerException ifstr
is - *null
. + * @throws java.lang.NullPointerException if {@code str} is + * {@code null}. */ public int lastIndexOf(String str, int fromIndex) { return String.lastIndexOf(value, 0, count, @@ -1342,8 +1342,8 @@ * is never reversed. * * Let n be the character length of this character sequence - * (not the length inchar
values) just prior to - * execution of thereverse
method. Then the + * (not the length in {@code char} values) just prior to + * execution of the {@code reverse} method. Then the * character at index k in the new character sequence is * equal to the character at index n-k-1 in the old * character sequence. @@ -1351,7 +1351,7 @@ *Note that the reverse operation may result in producing * surrogate pairs that were unpaired low-surrogates and * high-surrogates before the operation. For example, reversing - * "\uDC00\uD800" produces "\uD800\uDC00" which is + * "\u005CuDC00\u005CuD800" produces "\u005CuD800\u005CuDC00" which is * a valid surrogate pair. * * @return a reference to this object. @@ -1387,11 +1387,11 @@ /** * Returns a string representing the data in this sequence. - * A new
String
object is allocated and initialized to + * A new {@code String} object is allocated and initialized to * contain the character sequence currently represented by this - * object. ThisString
is then returned. Subsequent + * object. This {@code String} is then returned. Subsequent * changes to this sequence do not affect the contents of the - *String
. + * {@code String}. * * @return a string representation of this sequence of characters. */