Rename Appendable methods parameters

This commit is contained in:
Abduqodiri Qurbonzoda
2019-12-13 03:54:27 +03:00
parent d1c0dfe8ac
commit b868e6f8da
5 changed files with 52 additions and 34 deletions
@@ -10,28 +10,28 @@ package kotlin.text
*/ */
public actual interface Appendable { public actual interface Appendable {
/** /**
* Appends the specified character [c] to this Appendable and returns this instance. * Appends the specified character [value] to this Appendable and returns this instance.
* *
* @param c the character to append. * @param value the character to append.
*/ */
public actual fun append(c: Char): Appendable public actual fun append(value: Char): Appendable
/** /**
* Appends the specified character sequence [csq] to this Appendable and returns this instance. * Appends the specified character sequence [value] to this Appendable and returns this instance.
* *
* @param csq the character sequence to append. If [csq] is `null`, then the four characters `"null"` are appended to this Appendable. * @param value the character sequence to append. If [value] is `null`, then the four characters `"null"` are appended to this Appendable.
*/ */
public actual fun append(csq: CharSequence?): Appendable public actual fun append(value: CharSequence?): Appendable
/** /**
* Appends a subsequence of the specified character sequence [csq] to this Appendable and returns this instance. * Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance.
* *
* @param csq the character sequence from which a subsequence is appended. If [csq] is `null`, * @param value the character sequence from which a subsequence is appended. If [value] is `null`,
* then characters are appended as if [csq] contained the four characters `"null"`. * then characters are appended as if [value] contained the four characters `"null"`.
* @param start the beginning (inclusive) of the subsequence to append. * @param startIndex the beginning (inclusive) of the subsequence to append.
* @param end the end (exclusive) of the subsequence to append. * @param endIndex the end (exclusive) of the subsequence to append.
* *
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [start] or [end] is out of range of the [csq] character sequence indices or when `start > end`. * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/ */
public actual fun append(csq: CharSequence?, start: Int, end: Int): Appendable public actual fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable
} }
@@ -36,18 +36,18 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
actual override fun subSequence(startIndex: Int, endIndex: Int): CharSequence = string.substring(startIndex, endIndex) actual override fun subSequence(startIndex: Int, endIndex: Int): CharSequence = string.substring(startIndex, endIndex)
actual override fun append(c: Char): StringBuilder { actual override fun append(value: Char): StringBuilder {
string += c string += value
return this return this
} }
actual override fun append(csq: CharSequence?): StringBuilder { actual override fun append(value: CharSequence?): StringBuilder {
string += csq.toString() string += value.toString()
return this return this
} }
@UseExperimental(ExperimentalStdlibApi::class) @UseExperimental(ExperimentalStdlibApi::class)
actual override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder = this.appendRange(csq, start, end) actual override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder = this.appendRange(value, startIndex, endIndex)
/** /**
* Reverses the contents of this string builder and returns this instance. * Reverses the contents of this string builder and returns this instance.
+30 -13
View File
@@ -13,30 +13,47 @@ package kotlin.text
*/ */
expect interface Appendable { expect interface Appendable {
/** /**
* Appends the specified character [c] to this Appendable and returns this instance. * Appends the specified character [value] to this Appendable and returns this instance.
* *
* @param c the character to append. * @param value the character to append.
*/ */
fun append(c: Char): Appendable fun append(value: Char): Appendable
/** /**
* Appends the specified character sequence [csq] to this Appendable and returns this instance. * Appends the specified character sequence [value] to this Appendable and returns this instance.
* *
* @param csq the character sequence to append. If [csq] is `null`, then the four characters `"null"` are appended to this Appendable. * @param value the character sequence to append. If [value] is `null`, then the four characters `"null"` are appended to this Appendable.
*/ */
fun append(csq: CharSequence?): Appendable fun append(value: CharSequence?): Appendable
/** /**
* Appends a subsequence of the specified character sequence [csq] to this Appendable and returns this instance. * Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance.
* *
* @param csq the character sequence from which a subsequence is appended. If [csq] is `null`, * @param value the character sequence from which a subsequence is appended. If [value] is `null`,
* then characters are appended as if [csq] contained the four characters `"null"`. * then characters are appended as if [value] contained the four characters `"null"`.
* @param start the beginning (inclusive) of the subsequence to append. * @param startIndex the beginning (inclusive) of the subsequence to append.
* @param end the end (exclusive) of the subsequence to append. * @param endIndex the end (exclusive) of the subsequence to append.
* *
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [start] or [end] is out of range of the [csq] character sequence indices or when `start > end`. * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/ */
fun append(csq: CharSequence?, start: Int, end: Int): Appendable fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable
}
/**
* Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance.
*
* @param value the character sequence from which a subsequence is appended. If [value] is `null`,
* then characters are appended as if [value] contained the four characters `"null"`.
* @param startIndex the beginning (inclusive) of the subsequence to append.
* @param endIndex the end (exclusive) of the subsequence to append.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public fun <T : Appendable> T.appendRange(value: CharSequence?, startIndex: Int, endIndex: Int): T {
@Suppress("UNCHECKED_CAST")
return append(value, startIndex, endIndex) as T
} }
/** /**
@@ -34,9 +34,9 @@ expect class StringBuilder : Appendable, CharSequence {
override fun subSequence(startIndex: Int, endIndex: Int): CharSequence override fun subSequence(startIndex: Int, endIndex: Int): CharSequence
override fun append(c: Char): StringBuilder override fun append(value: Char): StringBuilder
override fun append(csq: CharSequence?): StringBuilder override fun append(value: CharSequence?): StringBuilder
override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder
/** /**
* Reverses the contents of this string builder and returns this instance. * Reverses the contents of this string builder and returns this instance.
@@ -4904,6 +4904,7 @@ public final class kotlin/text/StringsKt {
public static final fun append (Ljava/lang/Appendable;[Ljava/lang/CharSequence;)Ljava/lang/Appendable; public static final fun append (Ljava/lang/Appendable;[Ljava/lang/CharSequence;)Ljava/lang/Appendable;
public static final fun append (Ljava/lang/StringBuilder;[Ljava/lang/Object;)Ljava/lang/StringBuilder; public static final fun append (Ljava/lang/StringBuilder;[Ljava/lang/Object;)Ljava/lang/StringBuilder;
public static final fun append (Ljava/lang/StringBuilder;[Ljava/lang/String;)Ljava/lang/StringBuilder; public static final fun append (Ljava/lang/StringBuilder;[Ljava/lang/String;)Ljava/lang/StringBuilder;
public static final fun appendRange (Ljava/lang/Appendable;Ljava/lang/CharSequence;II)Ljava/lang/Appendable;
public static final fun appendln (Ljava/lang/Appendable;)Ljava/lang/Appendable; public static final fun appendln (Ljava/lang/Appendable;)Ljava/lang/Appendable;
public static final fun appendln (Ljava/lang/StringBuilder;)Ljava/lang/StringBuilder; public static final fun appendln (Ljava/lang/StringBuilder;)Ljava/lang/StringBuilder;
public static final fun asIterable (Ljava/lang/CharSequence;)Ljava/lang/Iterable; public static final fun asIterable (Ljava/lang/CharSequence;)Ljava/lang/Iterable;