@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline infix fun CharArray ? . contentEquals ( other : CharArray ? ) : Boolean

/**
 * Checks if the two specified arrays are *structurally* equal to one another.
 *
 * Two arrays are considered structurally equal if they have the same size, and elements at corresponding indices are equal.
 *
 * The arrays are also considered structurally equal if both are `null`.
 *
 * @param other the array to compare with this array.
 * @return `true` if the two arrays are structurally equal, `false` otherwise.
 *
 * @sample samples.collections.Arrays.ContentOperations.charArrayContentEquals
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun < T > Array < out T > ? . contentHashCode ( ) : Int

{ <EOL> return java . util . Arrays . hashCode ( this ) <EOL> }

/**
 * Returns a hash code based on the contents of this array as if it is [List].
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ByteArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ShortArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun IntArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun LongArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun FloatArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun DoubleArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun BooleanArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun CharArray ? . contentHashCode ( ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun < T > Array < out T > ? . contentToString ( ) : String

{ <EOL> return java . util . Arrays . toString ( this ) <EOL> }

/**
 * Returns a string representation of the contents of the specified array as if it is [List].
 *
 * @sample samples.collections.Arrays.ContentOperations.contentToString
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ByteArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ShortArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun IntArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun LongArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun FloatArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun DoubleArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun BooleanArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun CharArray ? . contentToString ( ) : String


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun < T > Array < out T > . copyInto ( destination : Array < T > , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : Array < T >

{ <EOL> System . arraycopy ( this , startIndex , destination , destinationOffset , endIndex - startIndex ) <EOL> return destination <EOL> }

/**
 * Copies this array or its subrange into the [destination] array and returns that array.
 *
 * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.
 *
 * @param destination the array to copy to.
 * @param destinationOffset the position in the [destination] array to copy to, 0 by default.
 * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.
 * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],
 * or when that index is out of the [destination] array indices range.
 *
 * @return the [destination] array.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun ByteArray . copyInto ( destination : ByteArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : ByteArray


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun ShortArray . copyInto ( destination : ShortArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : ShortArray


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun IntArray . copyInto ( destination : IntArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : IntArray


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun LongArray . copyInto ( destination : LongArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : LongArray


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun FloatArray . copyInto ( destination : FloatArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : FloatArray


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun DoubleArray . copyInto ( destination : DoubleArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : DoubleArray


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun BooleanArray . copyInto ( destination : BooleanArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : BooleanArray


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun CharArray . copyInto ( destination : CharArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : CharArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun < T > Array < T > . copyOf ( ) : Array < T >

{ <EOL> return java . util . Arrays . copyOf ( this , size ) <EOL> }

/**
 * Returns new array which is a copy of the original array.
 *
 * @sample samples.collections.Arrays.CopyOfOperations.copyOf
 */


@ kotlin . internal . InlineOnly <EOL> public actual inline fun ByteArray . copyOf ( ) : ByteArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun ShortArray . copyOf ( ) : ShortArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun IntArray . copyOf ( ) : IntArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun LongArray . copyOf ( ) : LongArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun FloatArray . copyOf ( ) : FloatArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun DoubleArray . copyOf ( ) : DoubleArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun BooleanArray . copyOf ( ) : BooleanArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun CharArray . copyOf ( ) : CharArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun ByteArray . copyOf ( newSize : Int ) : ByteArray

{ <EOL> return java . util . Arrays . copyOf ( this , newSize ) <EOL> }

/**
 * Returns new array which is a copy of the original array, resized to the given [newSize].
 * The copy is either truncated or padded at the end with zero values if necessary.
 *
 * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].
 * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.
 *
 * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf
 */


@ kotlin . internal . InlineOnly <EOL> public actual inline fun ShortArray . copyOf ( newSize : Int ) : ShortArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun IntArray . copyOf ( newSize : Int ) : IntArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun LongArray . copyOf ( newSize : Int ) : LongArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun FloatArray . copyOf ( newSize : Int ) : FloatArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun DoubleArray . copyOf ( newSize : Int ) : DoubleArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun BooleanArray . copyOf ( newSize : Int ) : BooleanArray

/**
 * Returns new array which is a copy of the original array, resized to the given [newSize].
 * The copy is either truncated or padded at the end with `false` values if necessary.
 *
 * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].
 * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `false` values.
 *
 * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf
 */


@ kotlin . internal . InlineOnly <EOL> public actual inline fun CharArray . copyOf ( newSize : Int ) : CharArray

/**
 * Returns new array which is a copy of the original array, resized to the given [newSize].
 * The copy is either truncated or padded at the end with null char (`\u0000`) values if necessary.
 *
 * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].
 * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with null char (`\u0000`) values.
 *
 * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf
 */


@ kotlin . internal . InlineOnly <EOL> public actual inline fun < T > Array < T > . copyOf ( newSize : Int ) : Array < T ? >

/**
 * Returns new array which is a copy of the original array, resized to the given [newSize].
 * The copy is either truncated or padded at the end with `null` values if necessary.
 *
 * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].
 * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `null` values.
 *
 * @sample samples.collections.Arrays.CopyOfOperations.resizingCopyOf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun < T > Array < T > . copyOfRange ( fromIndex : Int , toIndex : Int ) : Array < T >

{ <EOL> return if ( kotlin . internal . apiVersionIsAtLeast ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:0> ) ) { <EOL> copyOfRangeImpl ( fromIndex , toIndex ) <EOL> } else { <EOL> if ( toIndex > size ) throw IndexOutOfBoundsException ( "<STR_LIT>" ) <EOL> java . util . Arrays . copyOfRange ( this , fromIndex , toIndex ) <EOL> } <EOL> }

/**
 * Returns a new array which is a copy of the specified range of the original array.
 *
 * @param fromIndex the start of the range (inclusive) to copy.
 * @param toIndex the end of the range (exclusive) to copy.
 *
 * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 */


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ByteArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : ByteArray


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ShortArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : ShortArray


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun IntArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : IntArray


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun LongArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : LongArray


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun FloatArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : FloatArray


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun DoubleArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : DoubleArray


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun BooleanArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : BooleanArray


@ JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun CharArray . copyOfRange ( fromIndex : Int , toIndex : Int ) : CharArray


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun < T > Array < T > . fill ( element : T , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit

{ <EOL> java . util . Arrays . fill ( this , fromIndex , toIndex , element ) <EOL> }

/**
 * Fills this array or its subrange with the specified [element] value.
 *
 * @param fromIndex the start of the range (inclusive) to fill, 0 by default.
 * @param toIndex the end of the range (exclusive) to fill, size of this array by default.
 *
 * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun ByteArray . fill ( element : Byte , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun ShortArray . fill ( element : Short , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun IntArray . fill ( element : Int , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun LongArray . fill ( element : Long , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun FloatArray . fill ( element : Float , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun DoubleArray . fill ( element : Double , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun BooleanArray . fill ( element : Boolean , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun CharArray . fill ( element : Char , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


public actual operator fun < T > Array < T > . plus ( element : T ) : Array < T >

{ <EOL> val index = size <EOL> val result = java . util . Arrays . copyOf ( this , index + <NUM_LIT:1> ) <EOL> result [ index ] = element <EOL> return result <EOL> }

/**
 * Returns an array containing all elements of the original array and then the given [element].
 */


public actual operator fun ByteArray . plus ( element : Byte ) : ByteArray


public actual operator fun ShortArray . plus ( element : Short ) : ShortArray


public actual operator fun IntArray . plus ( element : Int ) : IntArray


public actual operator fun LongArray . plus ( element : Long ) : LongArray


public actual operator fun FloatArray . plus ( element : Float ) : FloatArray


public actual operator fun DoubleArray . plus ( element : Double ) : DoubleArray


public actual operator fun BooleanArray . plus ( element : Boolean ) : BooleanArray


public actual operator fun CharArray . plus ( element : Char ) : CharArray


public actual operator fun < T > Array < T > . plus ( elements : Collection < T > ) : Array < T >

{ <EOL> var index = size <EOL> val result = java . util . Arrays . copyOf ( this , index + elements . size ) <EOL> for ( element in elements ) result [ index ++ ] = element <EOL> return result <EOL> }

/**
 * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.
 */


public actual operator fun ByteArray . plus ( elements : Collection < Byte > ) : ByteArray


public actual operator fun ShortArray . plus ( elements : Collection < Short > ) : ShortArray


public actual operator fun IntArray . plus ( elements : Collection < Int > ) : IntArray


public actual operator fun LongArray . plus ( elements : Collection < Long > ) : LongArray


public actual operator fun FloatArray . plus ( elements : Collection < Float > ) : FloatArray


public actual operator fun DoubleArray . plus ( elements : Collection < Double > ) : DoubleArray


public actual operator fun BooleanArray . plus ( elements : Collection < Boolean > ) : BooleanArray


public actual operator fun CharArray . plus ( elements : Collection < Char > ) : CharArray


public actual operator fun < T > Array < T > . plus ( elements : Array < out T > ) : Array < T >

{ <EOL> val thisSize = size <EOL> val arraySize = elements . size <EOL> val result = java . util . Arrays . copyOf ( this , thisSize + arraySize ) <EOL> System . arraycopy ( elements , <NUM_LIT:0> , result , thisSize , arraySize ) <EOL> return result <EOL> }

/**
 * Returns an array containing all elements of the original array and then all elements of the given [elements] array.
 */


public actual operator fun ByteArray . plus ( elements : ByteArray ) : ByteArray


public actual operator fun ShortArray . plus ( elements : ShortArray ) : ShortArray


public actual operator fun IntArray . plus ( elements : IntArray ) : IntArray


public actual operator fun LongArray . plus ( elements : LongArray ) : LongArray


public actual operator fun FloatArray . plus ( elements : FloatArray ) : FloatArray


public actual operator fun DoubleArray . plus ( elements : DoubleArray ) : DoubleArray


public actual operator fun BooleanArray . plus ( elements : BooleanArray ) : BooleanArray


public actual operator fun CharArray . plus ( elements : CharArray ) : CharArray


@ kotlin . internal . InlineOnly <EOL> public actual inline fun < T > Array < T > . plusElement ( element : T ) : Array < T >

{ <EOL> return plus ( element ) <EOL> }


public actual fun IntArray . sort ( ) : Unit

{ <EOL> if ( size > <NUM_LIT:1> ) java . util . Arrays . sort ( this ) <EOL> }

/**
 * Sorts the array in-place.
 *
 * @sample samples.collections.Arrays.Sorting.sortArray
 */


public actual fun LongArray . sort ( ) : Unit


public actual fun ByteArray . sort ( ) : Unit


public actual fun ShortArray . sort ( ) : Unit


public actual fun DoubleArray . sort ( ) : Unit


public actual fun FloatArray . sort ( ) : Unit


public actual fun CharArray . sort ( ) : Unit


@ kotlin . internal . InlineOnly <EOL> public actual inline fun < T : Comparable < T > > Array < out T > . sort ( ) : Unit

{ <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> ( this as Array < Any ? > ) . sort ( ) <EOL> }

/**
 * Sorts the array in-place according to the natural order of its elements.
 *
 * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
 *
 * @sample samples.collections.Arrays.Sorting.sortArrayOfComparable
 */


public fun < T > Array < out T > . sort ( ) : Unit

/**
 * Sorts the array in-place according to the natural order of its elements.
 *
 * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
 *
 * @throws ClassCastException if any element of the array is not [Comparable].
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun < T : Comparable < T > > Array < out T > . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit

{ <EOL> java . util . Arrays . sort ( this , fromIndex , toIndex ) <EOL> }

/**
 * Sorts a range in the array in-place.
 *
 * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
 *
 * @param fromIndex the start of the range (inclusive) to sort, 0 by default.
 * @param toIndex the end of the range (exclusive) to sort, size of this array by default.
 *
 * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 *
 * @sample samples.collections.Arrays.Sorting.sortRangeOfArrayOfComparable
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun ByteArray . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit

/**
 * Sorts a range in the array in-place.
 *
 * @param fromIndex the start of the range (inclusive) to sort, 0 by default.
 * @param toIndex the end of the range (exclusive) to sort, size of this array by default.
 *
 * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 *
 * @sample samples.collections.Arrays.Sorting.sortRangeOfArray
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun ShortArray . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun IntArray . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun LongArray . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun FloatArray . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun DoubleArray . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun CharArray . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


public fun < T > Array < out T > . sort ( fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit


public actual fun < T > Array < out T > . sortWith ( comparator : Comparator < in T > ) : Unit

{ <EOL> if ( size > <NUM_LIT:1> ) java . util . Arrays . sort ( this , comparator ) <EOL> }

/**
 * Sorts the array in-place according to the order specified by the given [comparator].
 *
 * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun < T > Array < out T > . sortWith ( comparator : Comparator < in T > , fromIndex : Int = <NUM_LIT:0> , toIndex : Int = size ) : Unit

{ <EOL> java . util . Arrays . sort ( this , fromIndex , toIndex , comparator ) <EOL> }

/**
 * Sorts a range in the array in-place with the given [comparator].
 *
 * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
 *
 * @param fromIndex the start of the range (inclusive) to sort, 0 by default.
 * @param toIndex the end of the range (exclusive) to sort, size of this array by default.
 *
 * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 */


public actual fun ByteArray . toTypedArray ( ) : Array < Byte >

{ <EOL> val result = arrayOfNulls < Byte > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Byte > <EOL> }

/**
 * Returns a *typed* object array containing all of the elements of this primitive array.
 */


public actual fun ShortArray . toTypedArray ( ) : Array < Short >

{ <EOL> val result = arrayOfNulls < Short > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Short > <EOL> }


public actual fun IntArray . toTypedArray ( ) : Array < Int >

{ <EOL> val result = arrayOfNulls < Int > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Int > <EOL> }


public actual fun LongArray . toTypedArray ( ) : Array < Long >

{ <EOL> val result = arrayOfNulls < Long > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Long > <EOL> }


public actual fun FloatArray . toTypedArray ( ) : Array < Float >

{ <EOL> val result = arrayOfNulls < Float > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Float > <EOL> }


public actual fun DoubleArray . toTypedArray ( ) : Array < Double >

{ <EOL> val result = arrayOfNulls < Double > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Double > <EOL> }


public actual fun BooleanArray . toTypedArray ( ) : Array < Boolean >

{ <EOL> val result = arrayOfNulls < Boolean > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Boolean > <EOL> }


public actual fun CharArray . toTypedArray ( ) : Array < Char >

{ <EOL> val result = arrayOfNulls < Char > ( size ) <EOL> for ( index in indices ) <EOL> result [ index ] = this [ index ] <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return result as Array < Char > <EOL> }


public fun < T : Comparable < T > > Array < out T > . toSortedSet ( ) : java . util . SortedSet < T >

{ <EOL> return toCollection ( java . util . TreeSet < T > ( ) ) <EOL> }

/**
 * Returns a new [SortedSet][java.util.SortedSet] of all elements.
 */


public fun ByteArray . toSortedSet ( ) : java . util . SortedSet < Byte >

{ <EOL> return toCollection ( java . util . TreeSet < Byte > ( ) ) <EOL> }


public fun ShortArray . toSortedSet ( ) : java . util . SortedSet < Short >

{ <EOL> return toCollection ( java . util . TreeSet < Short > ( ) ) <EOL> }


public fun IntArray . toSortedSet ( ) : java . util . SortedSet < Int >

{ <EOL> return toCollection ( java . util . TreeSet < Int > ( ) ) <EOL> }


public fun LongArray . toSortedSet ( ) : java . util . SortedSet < Long >

{ <EOL> return toCollection ( java . util . TreeSet < Long > ( ) ) <EOL> }


public fun FloatArray . toSortedSet ( ) : java . util . SortedSet < Float >

{ <EOL> return toCollection ( java . util . TreeSet < Float > ( ) ) <EOL> }


public fun DoubleArray . toSortedSet ( ) : java . util . SortedSet < Double >

{ <EOL> return toCollection ( java . util . TreeSet < Double > ( ) ) <EOL> }


public fun BooleanArray . toSortedSet ( ) : java . util . SortedSet < Boolean >

{ <EOL> return toCollection ( java . util . TreeSet < Boolean > ( ) ) <EOL> }


public fun CharArray . toSortedSet ( ) : java . util . SortedSet < Char >

{ <EOL> return toCollection ( java . util . TreeSet < Char > ( ) ) <EOL> }


public fun < T > Array < out T > . toSortedSet ( comparator : Comparator < in T > ) : java . util . SortedSet < T >

{ <EOL> return toCollection ( java . util . TreeSet < T > ( comparator ) ) <EOL> }

/**
 * Returns a new [SortedSet][java.util.SortedSet] of all elements.
 *
 * Elements in the set returned are sorted according to the given [comparator].
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < T > Array < out T > . sumOf ( selector : ( T ) -> java . math . BigDecimal ) : java . math . BigDecimal

{ <EOL> var sum : java . math . BigDecimal = <NUM_LIT:0> . toBigDecimal ( ) <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }

/**
 * Returns the sum of all values produced by [selector] function applied to each element in the array.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ByteArray . sumOf ( selector : ( Byte ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ShortArray . sumOf ( selector : ( Short ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun IntArray . sumOf ( selector : ( Int ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun LongArray . sumOf ( selector : ( Long ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun FloatArray . sumOf ( selector : ( Float ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun DoubleArray . sumOf ( selector : ( Double ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun BooleanArray . sumOf ( selector : ( Boolean ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharArray . sumOf ( selector : ( Char ) -> java . math . BigDecimal ) : java . math . BigDecimal


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < T > Array < out T > . sumOf ( selector : ( T ) -> java . math . BigInteger ) : java . math . BigInteger

{ <EOL> var sum : java . math . BigInteger = <NUM_LIT:0> . toBigInteger ( ) <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ByteArray . sumOf ( selector : ( Byte ) -> java . math . BigInteger ) : java . math . BigInteger


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ShortArray . sumOf ( selector : ( Short ) -> java . math . BigInteger ) : java . math . BigInteger


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun IntArray . sumOf ( selector : ( Int ) -> java . math . BigInteger ) : java . math . BigInteger


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun LongArray . sumOf ( selector : ( Long ) -> java . math . BigInteger ) : java . math . BigInteger


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun FloatArray . sumOf ( selector : ( Float ) -> java . math . BigInteger ) : java . math . BigInteger


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun DoubleArray . sumOf ( selector : ( Double ) -> java . math . BigInteger ) : java . math . BigInteger


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun BooleanArray . sumOf ( selector : ( Boolean ) -> java . math . BigInteger ) : java . math . BigInteger


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharArray . sumOf ( selector : ( Char ) -> java . math . BigInteger ) : java . math . BigInteger


{ <EOL> val ( train , test ) = fashionMnist ( ) <EOL> val jsonConfigFile = getJSONConfigFile ( ) <EOL> val model = Sequential . loadModelConfiguration ( jsonConfigFile ) <EOL> model . use { <EOL> it . freeze ( ) <EOL> it . layers . last ( ) . unfreeze ( ) <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> println ( it . kGraph ) <EOL> val hdfFile = getWeightsFile ( ) <EOL> it . loadWeights ( hdfFile ) <EOL> var accuracy = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> it . fit ( dataset = train , epochs = <NUM_LIT:1> , batchSize = <NUM_LIT:100> ) <EOL> println ( it . kGraph ) <EOL> accuracy = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( it . kGraph ) <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This examples demonstrates the inference concept:
 *
 * - Weights are loaded from .h5 file, configuration is loaded from .json file.
 * - Model is evaluated after loading to obtain accuracy value.
 * - No additional training.
 * - No new layers are added.
 *
 * NOTE: Model and weights are resources in api module.
 *
 * We demonstrate the workflow on the FashionMnist classification dataset.
 */


{ <EOL> val pathToConfig = "<STR_LIT>" <EOL> val realPathToConfig = OnHeapDataset :: class . java . classLoader . getResource ( pathToConfig ) . path . toString ( ) <EOL> return File ( realPathToConfig ) <EOL> }

/** Returns JSON file with model configuration, saved from Keras 2.x. */


{ <EOL> val pathToWeights = "<STR_LIT>" <EOL> val realPathToWeights = OnHeapDataset :: class . java . classLoader . getResource ( pathToWeights ) . path . toString ( ) <EOL> val file = File ( realPathToWeights ) <EOL> return HdfFile ( file ) <EOL> }

/** Returns .h5 file with model weights, saved from Keras 2.x. */


private fun moveCapturedLocalInside ( capturingFunction : JsFunction , capturedName : JsName , localFunAlias : JsExpression ) : CapturedArgsParams

= <EOL> when ( localFunAlias ) { <EOL> is JsNameRef -> { <EOL> declareAliasInsideFunction ( capturingFunction , capturedName , localFunAlias ) <EOL> CapturedArgsParams ( ) <EOL> } <EOL> is JsInvocation -> <EOL> moveCapturedLocalInside ( capturingFunction , capturedName , localFunAlias ) <EOL> else -> <EOL> throw AssertionError ( "<STR_LIT>" ) <EOL> }

/**
 * Moves captured local inline function inside capturing function.
 *
 * For example:
 * var inc = _.foo.inc(closure) // local fun that captures closure
 * capturingFunction(inc)
 *
 * Is transformed to:
 * capturingFunction(closure) // var inc = _.foo.inc(closure) is moved inside capturingFunction
 */


private fun moveCapturedLocalInside ( capturingFunction : JsFunction , capturedName : JsName , localFunAlias : JsInvocation ) : CapturedArgsParams

{ <EOL> val capturedArgs = localFunAlias . arguments <EOL> val freshNames = getTemporaryNamesInScope ( capturedArgs ) <EOL> val aliasCallArguments = freshNames . map ( JsName :: makeRef ) <EOL> val alias = JsInvocation ( localFunAlias . qualifier , aliasCallArguments ) <EOL> declareAliasInsideFunction ( capturingFunction , capturedName , alias ) <EOL> val capturedParameters = freshNames . map ( :: JsParameter ) <EOL> return CapturedArgsParams ( capturedArgs , capturedParameters ) <EOL> }

/**
 * Processes case when local inline function with capture
 * is captured by capturingFunction.
 *
 * In this case, capturingFunction should
 * capture arguments captured by localFunAlias,
 * and localFunAlias declaration is moved inside.
 *
 * For example:
 *
 * ```
 * val x = 0
 * inline fun id() = x
 * val lambda = {println(id())}
 * ```
 *
 * `lambda` should capture x in this case
 */


public fun OutputStream . asSink ( ) : RawSink

= OutputStreamSink ( this )

/**
 * Returns [RawSink] that writes to an output stream.
 *
 * Use [RawSink.buffered] to create a buffered sink from it.
 *
 * @sample kotlinx.io.samples.KotlinxIoSamplesJvm.outputStreamAsSink
 */


public fun InputStream . asSource ( ) : RawSource

= InputStreamSource ( this )

/**
 * Returns [RawSource] that reads from an input stream.
 *
 * Use [RawSource.buffered] to create a buffered source from it.
 *
 * @sample kotlinx.io.samples.KotlinxIoSamplesJvm.inputStreamAsSource
 */


internal fun pick ( generationState : NativeGenerationState , runtimeLlvmModules : List < LLVMModuleRef > ) : RuntimeLinkageStrategy

{ <EOL> val config = generationState . config <EOL> val binaryOption = config . configuration . get ( BinaryOptions . linkRuntime ) <EOL> return when { <EOL> binaryOption == RuntimeLinkageStrategyBinaryOption . Raw -> Raw ( runtimeLlvmModules ) <EOL> binaryOption == RuntimeLinkageStrategyBinaryOption . Optimize -> LinkAndOptimize ( generationState , runtimeLlvmModules ) <EOL> config . debug -> LinkAndOptimize ( generationState , runtimeLlvmModules ) <EOL> else -> Raw ( runtimeLlvmModules ) <EOL> } <EOL> }

/**
 * Choose runtime linkage strategy based on current compiler configuration and [BinaryOptions.linkRuntime].
 */


@ OptIn ( DokkaPluginApiPreview :: class ) <EOL> protected abstract fun pluginApiPreviewAcknowledgement ( ) : PluginApiPreviewAcknowledgement

/**
 * @see PluginApiPreviewAcknowledgement
 */


fun fromSources ( sources : List < String > ) : List < KotlinSourceFile >

{ <EOL> val counters = hashMapOf < String , Int > ( ) <EOL> return sources . map { fileName -> <EOL> val id = counters [ fileName ] ? : <NUM_LIT:0> <EOL> counters [ fileName ] = id + <NUM_LIT:1> <EOL> KotlinSourceFile ( fileName , id ) <EOL> } <EOL> }

/**
 * Source file paths in one module may clash;
 * for example, common and platform parts of the module could have files with the same root paths.
 * @param sources is a list of the module sources and must be in the same order as they appear in the klib.
 * @return a list of [KotlinSourceFile] containing the file path and the unique id in case of a clash
 */


public open fun anchorForDCI ( dci : DCI , sourceSets : Set < DisplaySourceSet > ) : String

= <EOL> ( dci . dri . shortenToUrl ( ) . toString ( ) + "<STR_LIT:/>" + dci . kind + "<STR_LIT:/>" + sourceSets . shortenToUrl ( ) ) . urlEncoded ( )

/**
 * Anchors should be unique and should contain sourcesets, dri and contentKind.
 * The idea is to make them as short as possible and just use a hashCode from sourcesets in order to match the
 * 2040 characters limit
 */


override fun copyForChild ( ) : CopyForChildCoroutineElement

{ <EOL> return CopyForChildCoroutineElement ( myThreadLocal . get ( ) ) <EOL> }

/**
 * At coroutine launch time, the _current value of the ThreadLocal_ is inherited by the new
 * child coroutine, and that value is copied to a new, unique, ThreadContextElement memory
 * reference for the child coroutine to use uniquely.
 *
 * n.b. the value copied to the child must be the __current value of the ThreadLocal__ and not
 * the value initially passed to the ThreadContextElement in order to reflect writes made to the
 * ThreadLocal between coroutine resumption and the child coroutine launch point. Those writes
 * will be reflected in the parent coroutine's [CopyForChildCoroutineElement] when it yields the
 * thread and calls [restoreThreadContext].
 */


private inline fun < ThreadLocalT , OutputT > ThreadLocal < ThreadLocalT > . setForBlock ( value : ThreadLocalT , crossinline block : ( ) -> OutputT )

{ <EOL> val priorValue = get ( ) <EOL> set ( value ) <EOL> block ( ) <EOL> set ( priorValue ) <EOL> }

/**
 * Calls [block], setting the value of [this] [ThreadLocal] for the duration of [block].
 *
 * When a [CopyForChildCoroutineElement] for `this` [ThreadLocal] is used within a
 * [CoroutineContext], a ThreadLocal set this way will have the "correct" value expected lexically
 * at every statement reached, whether that statement is reached immediately, across suspend and
 * redispatch within one coroutine, or within a child coroutine. Writes made to the `ThreadLocal`
 * by child coroutines will not be visible to the parent coroutine. Writes made to the `ThreadLocal`
 * by the parent coroutine _after_ launching a child coroutine will not be visible to that child
 * coroutine.
 */


@ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class ) <EOL> public fun Sequence < UInt > . sum ( ) : UInt

{ <EOL> var sum : UInt = <NUM_LIT> <EOL> for ( element in this ) { <EOL> sum += element <EOL> } <EOL> return sum <EOL> }

/**
 * Returns the sum of all elements in the sequence.
 *
 * The operation is _terminal_.
 */


@ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class ) <EOL> public fun Sequence < ULong > . sum ( ) : ULong

{ <EOL> var sum : ULong = <NUM_LIT> <EOL> for ( element in this ) { <EOL> sum += element <EOL> } <EOL> return sum <EOL> }


@ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class ) <EOL> public fun Sequence < UByte > . sum ( ) : UInt


@ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class ) <EOL> public fun Sequence < UShort > . sum ( ) : UInt


internal fun suite ( name : String , ignored : Boolean , suiteFn : ( ) -> Unit )

{ <EOL> adapter ( ) . suite ( name , ignored , suiteFn ) <EOL> }

/**
 * The functions below are used by the compiler to describe the tests structure, e.g.
 *
 * suite('a suite', false, function() {
 * suite('a subsuite', false, function() {
 * test('a test', false, function() {...});
 * test('an ignored/pending test', true, function() {...});
 * });
 * suite('an ignored/pending test', true, function() {...});
 * });
 */


= true

/**
 * Validates the rule state just before it getting applied.
 * Returning false will skip the rule silently. To terminate the build instead, throw an error.
 */


open fun dependencies ( versions : NpmVersions ) : Collection < RequiredKotlinJsDependency >

= listOf ( )

/**
 * Provides a list of required npm dependencies for the rule to function.
 */


protected abstract fun loaders ( ) : List < Loader >

/**
 * Provides a loaders sequence to apply to the rule.
 */


@ Composable <EOL> expect fun ActualCartItem ( orderLine : OrderLine , removeSnack : ( Long ) -> Unit , increaseItemCount : ( Long ) -> Unit , decreaseItemCount : ( Long ) -> Unit , onSnackClick : ( Long ) -> Unit , modifier : Modifier = Modifier )

/**
 * Android uses ConstraintLayout which is android-only at the moment.
 * So we provide an alternative implementation of `ActualCartItem` for other platforms.
 */


{ <EOL> _builder . clearProject ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinProjectCoordinatesProto project = 1;
 */


{ <EOL> return _builder . hasProject ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinProjectCoordinatesProto project = 1;
 * @return Whether the project field is set.
 */


{ <EOL> _builder . clearSourceSetName ( ) <EOL> }

/**
 * optional string source_set_name = 2;
 */


fun hasSourceSetName ( ) : kotlin . Boolean

{ <EOL> return _builder . hasSourceSetName ( ) <EOL> }

/**
 * optional string source_set_name = 2;
 * @return Whether the sourceSetName field is set.
 */


private fun buildClangFlags ( configurables : Configurables ) : List < String >

= mutableListOf < String > ( ) . apply { <EOL> require ( configurables is ClangFlags ) <EOL> addAll ( configurables . clangFlags ) <EOL> addAll ( configurables . clangNooptFlags ) <EOL> val targetTriple = if ( configurables is AppleConfigurables ) { <EOL> configurables . targetTriple . withOSVersion ( configurables . osVersionMin ) <EOL> } else { <EOL> configurables . targetTriple <EOL> } <EOL> addAll ( listOf ( "<STR_LIT>" , targetTriple . toString ( ) ) ) <EOL> } . toList ( )

/**
 * Returns a list of Clang -cc1 arguments (including -cc1 itself) that are used for bitcode compilation in Kotlin/Native.
 *
 * See also: [org.jetbrains.kotlin.backend.konan.BitcodeCompiler]
 */


@ Benchmark <EOL> fun addAllLast ( ) : PersistentList . Builder < String >

{ <EOL> val builder = persistentListOf < String > ( ) . builder ( ) <EOL> builder . addAll ( listToAdd ) <EOL> return builder <EOL> }

/**
 * Adds [size] elements to an empty persistent list builder using `addAll` operation.
 */


@ Benchmark <EOL> fun addAllLast_Half ( ) : PersistentList . Builder < String >

{ <EOL> val initialSize = size / <NUM_LIT:2> <EOL> val subListToAdd = listToAdd . subList ( <NUM_LIT:0> , size - initialSize ) <EOL> val builder = persistentListBuilderAdd ( initialSize , immutablePercentage ) <EOL> builder . addAll ( subListToAdd ) <EOL> return builder <EOL> }

/**
 * Adds `size / 2` elements to an empty persistent list builder
 * and then adds `size - size / 2` elements using `addAll` operation.
 */


@ Benchmark <EOL> fun addAllLast_OneThird ( ) : PersistentList . Builder < String >

{ <EOL> val initialSize = size - size / <NUM_LIT:3> <EOL> val subListToAdd = listToAdd . subList ( <NUM_LIT:0> , size - initialSize ) <EOL> val builder = persistentListBuilderAdd ( initialSize , immutablePercentage ) <EOL> builder . addAll ( subListToAdd ) <EOL> return builder <EOL> }

/**
 * Adds `size - size / 3` elements to an empty persistent list builder
 * and then adds `size / 3` elements using `addAll` operation.
 */


@ Benchmark <EOL> fun addAllFirst_Half ( ) : PersistentList . Builder < String >

{ <EOL> val initialSize = size / <NUM_LIT:2> <EOL> val subListToAdd = listToAdd . subList ( <NUM_LIT:0> , size - initialSize ) <EOL> val builder = persistentListBuilderAdd ( initialSize , immutablePercentage ) <EOL> builder . addAll ( <NUM_LIT:0> , subListToAdd ) <EOL> return builder <EOL> }

/**
 * Adds `size / 2` elements to an empty persistent list builder
 * and then inserts `size - size / 2` elements at the beginning using `addAll` operation.
 */


@ Benchmark <EOL> fun addAllFirst_OneThird ( ) : PersistentList . Builder < String >

{ <EOL> val initialSize = size - size / <NUM_LIT:3> <EOL> val subListToAdd = listToAdd . subList ( <NUM_LIT:0> , size - initialSize ) <EOL> val builder = persistentListBuilderAdd ( initialSize , immutablePercentage ) <EOL> builder . addAll ( <NUM_LIT:0> , subListToAdd ) <EOL> return builder <EOL> }

/**
 * Adds `size - size / 3` elements to an empty persistent list builder
 * and then inserts `size / 3` elements at the beginning using `addAll` operation.
 */


@ Benchmark <EOL> fun addAllMiddle_Half ( ) : PersistentList . Builder < String >

{ <EOL> val initialSize = size / <NUM_LIT:2> <EOL> val index = initialSize / <NUM_LIT:2> <EOL> val subListToAdd = listToAdd . subList ( <NUM_LIT:0> , size - initialSize ) <EOL> val builder = persistentListBuilderAdd ( initialSize , immutablePercentage ) <EOL> builder . addAll ( index , subListToAdd ) <EOL> return builder <EOL> }

/**
 * Adds `size / 2` elements to an empty persistent list builder
 * and then inserts `size - size / 2` elements at the middle using `addAll` operation.
 */


@ Benchmark <EOL> fun addAllMiddle_OneThird ( ) : PersistentList . Builder < String >

{ <EOL> val initialSize = size - size / <NUM_LIT:3> <EOL> val index = initialSize / <NUM_LIT:2> <EOL> val subListToAdd = listToAdd . subList ( <NUM_LIT:0> , size - initialSize ) <EOL> val builder = persistentListBuilderAdd ( initialSize , immutablePercentage ) <EOL> builder . addAll ( index , subListToAdd ) <EOL> return builder <EOL> }

/**
 * Adds `size - size / 3` elements to an empty persistent list builder
 * and then inserts `size / 3` elements at the middle using `addAll` operation.
 */


fun documentedVisibilities ( vararg visibilities : VisibilityModifier ) : Unit

= <EOL> documentedVisibilities . set ( visibilities . asList ( ) )

/** Sets [documentedVisibilities] (overrides any previously set values). */


= a

/**
 * Useless function [whatever] // EXPORT_KDOC
 *
 * This kdoc has some additional formatting. // EXPORT_KDOC
 * @param a keep intact and return // EXPORT_KDOC
 * @return value of [a] // EXPORT_KDOC
 * Check for additional comment (note) below // EXPORT_KDOC
 */


internal fun prepareInstallation ( logger : Logger , nodeJsEnvironment : NodeJsEnvironment , packageManagerEnvironment : PackageManagerEnvironment , npmResolutionManager : KotlinNpmResolutionManager , ) : Installation

{ <EOL> synchronized ( projects ) { <EOL> npmResolutionManager . parameters . gradleNodeModulesProvider . get ( ) . close ( ) <EOL> val projectResolutions : List < PreparedKotlinCompilationNpmResolution > = projects . values <EOL> . flatMap { it . npmProjects } <EOL> . map { <EOL> it . close ( npmResolutionManager , logger ) <EOL> } <EOL> nodeJsEnvironment . packageManager . prepareRootProject ( nodeJsEnvironment , packageManagerEnvironment , rootProjectName , rootProjectVersion , projectResolutions , ) <EOL> return Installation ( projectResolutions ) <EOL> } <EOL> }

/**
 * Don't use directly, use [KotlinNpmResolutionManager.installIfNeeded] instead.
 */


private fun PatchBuilder . addObjCPatches ( )

{ <EOL> addProtocolImport ( "<STR_LIT>" ) <EOL> addPrivateSelector ( "<STR_LIT>" ) <EOL> addPrivateSelector ( "<STR_LIT>" ) <EOL> addPrivateClass ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addPrivateClass ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addPrivateClass ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addPrivateClass ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addPrivateClass ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addPrivateClass ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addPrivateClass ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addPrivateCategory ( "<STR_LIT>" ) <EOL> addExportedClass ( objCExportNamer . kotlinAnyName , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> addExportedClass ( objCExportNamer . mutableSetName , "<STR_LIT>" , "<STR_LIT>" ) <EOL> addExportedClass ( objCExportNamer . mutableMapName , "<STR_LIT>" , "<STR_LIT>" ) <EOL> addExportedClass ( objCExportNamer . kotlinNumberName , "<STR_LIT>" ) <EOL> NSNumberKind . values ( ) . mapNotNull { it . mappedKotlinClassId } . forEach { <EOL> addExportedClass ( objCExportNamer . numberBoxName ( it ) , "<STR_LIT>" , "<STR_LIT>" ) <EOL> } <EOL> }


fun File . hasLlFirDivergenceDirective ( ) : Boolean

= useLines { findDirectiveInLines ( it . iterator ( ) ) }

/**
 * Checks whether the [File] contains a legal `LL_FIR_DIVERGENCE` directive without reading the whole file.
 */


private fun findDirectiveInLines ( iterator : Iterator < String > ) : Boolean

{ <EOL> val firstNonBlankLine = iterator . nextNonBlankLineTrimmed ( ) <EOL> if ( firstNonBlankLine != LL_FIR_DIVERGENCE_DIRECTIVE_COMMENT ) return false <EOL> while ( iterator . hasNext ( ) ) { <EOL> val line = iterator . nextNonBlankLineTrimmed ( ) ? : return false <EOL> if ( line . startsWith ( "<STR_LIT>" ) ) { <EOL> if ( line == LL_FIR_DIVERGENCE_DIRECTIVE_COMMENT ) return true <EOL> } else return false <EOL> } <EOL> return false <EOL> }

/**
 * Tries to find the `LL_FIR_DIVERGENCE` directive in the lines given by [iterator] and returns whether this is the case. If the directive
 * was found, [iterator] is guaranteed to be advanced exactly past the `LL_FIR_DIVERGENCE` directive.
 *
 * The format of the directive is as such:
 *
 * ```
 * // LL_FIR_DIVERGENCE
 * // lorem ipsum
 * // dolor sit amet
 * // LL_FIR_DIVERGENCE
 * ```
 *
 * Blank lines before the directive or inside the directive region are ignored.
 */


fun TestProject . assertSimpleConfigurationCacheScenarioWorks ( vararg buildArguments : String , buildOptions : BuildOptions , executedTaskNames : List < String > ? = null , checkUpToDateOnRebuild : Boolean = true , )

{ <EOL> val executedTask : List < String > = executedTaskNames ? : buildArguments . toList ( ) <EOL> build ( * buildArguments , buildOptions = buildOptions ) { <EOL> assertTasksExecuted ( * executedTask . toTypedArray ( ) ) <EOL> if ( gradleVersion < GradleVersion . version ( TestVersions . Gradle . G_8_5 ) ) { <EOL> assertOutputContains ( "<STR_LIT>" ) <EOL> } else { <EOL> assertOutputContains ( "<STR_LIT>" ) <EOL> } <EOL> assertConfigurationCacheStored ( ) <EOL> } <EOL> build ( "<STR_LIT:clean>" , buildOptions = buildOptions ) <EOL> build ( * buildArguments , buildOptions = buildOptions ) { <EOL> assertTasksExecuted ( * executedTask . toTypedArray ( ) ) <EOL> assertConfigurationCacheReused ( ) <EOL> } <EOL> if ( checkUpToDateOnRebuild ) { <EOL> build ( * buildArguments , buildOptions = buildOptions ) { <EOL> assertTasksUpToDate ( * executedTask . toTypedArray ( ) ) <EOL> } <EOL> } <EOL> }

/**
 * Tests whether configuration cache for the tasks specified by [buildArguments] works on simple scenario when project is built twice non-incrementally.
 */


internal fun constArray ( tf : Ops , vararg data : Int ) : Operand < Int >

{ <EOL> return tf . constant ( data ) <EOL> }


internal fun shapeOperand ( tf : Ops , shape : Shape ) : Operand < Int >

{ <EOL> return tf . constant ( shape . toIntArray ( ) ) <EOL> }

/** Creates shape [Operand] from [Shape]. */


internal fun Shape . toIntArray ( ) : IntArray

{ <EOL> return IntArray ( numDimensions ( ) ) { size ( it ) . toInt ( ) } <EOL> }

/** Extracts dimensions as [IntArray] from [Shape]. */


internal fun Shape . toLongArray ( ) : LongArray

{ <EOL> return LongArray ( numDimensions ( ) ) { size ( it ) } <EOL> }

/** Extracts dimensions as [LongArray] from [Shape]. */


internal fun Shape . contentToString ( ) : String

{ <EOL> return toLongArray ( ) . contentToString ( ) <EOL> }

/** Extracts dimensions as a [String] from [Shape]. */


{ <EOL> return size ( <NUM_LIT:0> ) <EOL> }


{ <EOL> return LongArray ( numDimensions ( ) - <NUM_LIT:1> ) { size ( it + <NUM_LIT:1> ) } <EOL> }

/** Returns last dimensions (except first). */


internal fun Shape . numElements ( ) : Long

= numElementsInShape ( toLongArray ( ) )

/** Returns amount of elements in [Shape]. */


internal fun shapeFromDims ( vararg dims : Long ) : Shape

{ <EOL> return Shape . make ( head ( * dims ) , * tail ( * dims ) ) <EOL> }

/** Creates [Shape] object from a few [Long] values in [dims]. */


public fun TensorShape . toShape ( ) : Shape

{ <EOL> val d = dims ( ) <EOL> return Shape . make ( head ( * d ) , * tail ( * d ) ) <EOL> }

/** Converts [TensorShape] to [Shape] object. */


public fun Shape . toTensorShape ( ) : TensorShape

{ <EOL> return TensorShape ( toLongArray ( ) ) <EOL> }

/** Converts [Shape] to [TensorShape] object. */


private fun getShapeOfArray ( data : Array < * > ) : Shape

{ <EOL> return shapeFromDims ( * getDimsOfArray ( data ) ) <EOL> }

/**
 * Get shape of array of arrays (of arrays...) of Array of elems of any type.
 * If the most inner array does not have any elements its size is missed in result */


internal fun head ( vararg dims : Long ) : Long

{ <EOL> return dims [ <NUM_LIT:0> ] <EOL> }

/** Returns first dimension from all dimensions [dims]. */


internal fun tail ( vararg dims : Long ) : LongArray

{ <EOL> return dims . copyOfRange ( <NUM_LIT:1> , dims . size ) <EOL> }

/** Returns last dimensions (except first) from [dims]. */


internal fun numElementsInShape ( shape : LongArray ) : Long

{ <EOL> var prod = <NUM_LIT:1L> <EOL> for ( i in shape . indices ) { <EOL> prod *= abs ( shape [ i ] ) <EOL> } <EOL> return prod <EOL> }

/** Returns amount of elements in Tensor with [shape]. */


{ <EOL> val modelHub = ONNXModelHub ( cacheDirectory = File ( "<STR_LIT>" ) ) <EOL> val modelType = ONNXModels . CV . EfficientNetB0 <EOL> val model = modelHub . loadModel ( modelType ) <EOL> model . printSummary ( ) <EOL> val imageNetClassLabels = Imagenet . V1k . labels ( ) <EOL> model . use { <EOL> println ( it ) <EOL> val fileDataLoader = modelType . createPreprocessing ( it ) . fileLoader ( ) <EOL> for ( i in <NUM_LIT:1> .. <NUM_LIT:8> ) { <EOL> val inputData = fileDataLoader . load ( getFileFromResource ( "<STR_LIT>" ) ) <EOL> val res = it . predictLabel ( inputData ) <EOL> println ( "<STR_LIT>" ) <EOL> val top5 = it . predictTopNLabels ( inputData , imageNetClassLabels ) <EOL> println ( top5 . toString ( ) ) <EOL> } <EOL> } <EOL> }

/**
 * This examples demonstrates the inference concept on EfficientNetB0 (exported from Keras to ONNX) model:
 * - Model configuration, model weights and labels are obtained from [ONNXModelHub].
 * - Model predicts on a few images located in resources.
 * - Special preprocessing (used in ResNet'50 during training on ImageNet dataset) is applied to each image before prediction.
 */


= efficientNetB0Prediction ( )


public open operator fun equals ( other : Any ? ) : Boolean

/**
 * Indicates whether some other object is "equal to" this one. Implementations must fulfil the following
 * requirements:
 *
 * * Reflexive: for any non-null value `x`, `x.equals(x)` should return true.
 * * Symmetric: for any non-null values `x` and `y`, `x.equals(y)` should return true if and only if `y.equals(x)` returns true.
 * * Transitive: for any non-null values `x`, `y`, and `z`, if `x.equals(y)` returns true and `y.equals(z)` returns true, then `x.equals(z)` should return true.
 * * Consistent: for any non-null values `x` and `y`, multiple invocations of `x.equals(y)` consistently return true or consistently return false, provided no information used in `equals` comparisons on the objects is modified.
 * * Never equal to null: for any non-null value `x`, `x.equals(null)` should return false.
 *
 * Read more about [equality](https://kotlinlang.org/docs/reference/equality.html) in Kotlin.
 */


public open fun hashCode ( ) : Int

/**
 * Returns a hash code value for the object. The general contract of `hashCode` is:
 *
 * * Whenever it is invoked on the same object more than once, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified.
 * * If two objects are equal according to the `equals()` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
 */


public open fun toString ( ) : String

/**
 * Returns a string representation of the object.
 */


@ Test <EOL> fun testCreateThrowsOnInvalidArguments ( )

{ <EOL> for ( ctx in invalidContexts ) { <EOL> assertFailsWith < IllegalArgumentException > { <EOL> createTestCoroutineScope ( ctx ) <EOL> } <EOL> } <EOL> }

/** Tests failing to create a [TestCoroutineScope] with incorrect contexts. */


@ Test <EOL> fun testCreateProvidesScheduler ( )

{ <EOL> run { <EOL> val scope = createTestCoroutineScope ( ) <EOL> assertNotNull ( scope . coroutineContext [ TestCoroutineScheduler ] ) <EOL> } <EOL> run { <EOL> val dispatcher = StandardTestDispatcher ( ) <EOL> val scope = createTestCoroutineScope ( dispatcher ) <EOL> assertSame ( dispatcher . scheduler , scope . coroutineContext [ TestCoroutineScheduler ] ) <EOL> } <EOL> run { <EOL> val scheduler = TestCoroutineScheduler ( ) <EOL> val scope = createTestCoroutineScope ( scheduler ) <EOL> assertSame ( scheduler , scope . coroutineContext [ TestCoroutineScheduler ] ) <EOL> assertSame ( scheduler , ( scope . coroutineContext [ ContinuationInterceptor ] as TestDispatcher ) . scheduler ) <EOL> } <EOL> run { <EOL> val scheduler = TestCoroutineScheduler ( ) <EOL> val dispatcher = StandardTestDispatcher ( scheduler ) <EOL> val scope = createTestCoroutineScope ( scheduler + dispatcher ) <EOL> assertSame ( scheduler , scope . coroutineContext [ TestCoroutineScheduler ] ) <EOL> assertSame ( dispatcher , scope . coroutineContext [ ContinuationInterceptor ] ) <EOL> } <EOL> run { <EOL> val scheduler = TestCoroutineScheduler ( ) <EOL> val mainDispatcher = StandardTestDispatcher ( scheduler ) <EOL> Dispatchers . setMain ( mainDispatcher ) <EOL> try { <EOL> val scope = createTestCoroutineScope ( ) <EOL> assertSame ( scheduler , scope . coroutineContext [ TestCoroutineScheduler ] ) <EOL> assertNotSame ( mainDispatcher , scope . coroutineContext [ ContinuationInterceptor ] ) <EOL> } finally { <EOL> Dispatchers . resetMain ( ) <EOL> } <EOL> } <EOL> run { <EOL> val mainDispatcher = StandardTestDispatcher ( ) <EOL> Dispatchers . setMain ( mainDispatcher ) <EOL> try { <EOL> val scheduler = TestCoroutineScheduler ( ) <EOL> val scope = createTestCoroutineScope ( scheduler ) <EOL> assertSame ( scheduler , scope . coroutineContext [ TestCoroutineScheduler ] ) <EOL> assertNotSame ( mainDispatcher . scheduler , scope . coroutineContext [ TestCoroutineScheduler ] ) <EOL> assertNotSame ( mainDispatcher , scope . coroutineContext [ ContinuationInterceptor ] ) <EOL> } finally { <EOL> Dispatchers . resetMain ( ) <EOL> } <EOL> } <EOL> }

/** Tests that a newly-created [TestCoroutineScope] provides the correct scheduler. */


@ Test <EOL> fun testPresentDelaysThrowing ( )

{ <EOL> val scope = createTestCoroutineScope ( ) <EOL> var result = false <EOL> scope . launch { <EOL> delay ( <NUM_LIT:5> ) <EOL> result = true <EOL> } <EOL> assertFalse ( result ) <EOL> assertFailsWith < AssertionError > { scope . cleanupTestCoroutines ( ) } <EOL> assertFalse ( result ) <EOL> }

/** Tests that the cleanup procedure throws if there were uncompleted delays by the end. */


@ Test <EOL> fun testActiveJobsThrowing ( )

{ <EOL> val scope = createTestCoroutineScope ( ) <EOL> var result = false <EOL> val deferred = CompletableDeferred < String > ( ) <EOL> scope . launch { <EOL> deferred . await ( ) <EOL> result = true <EOL> } <EOL> assertFalse ( result ) <EOL> assertFailsWith < AssertionError > { scope . cleanupTestCoroutines ( ) } <EOL> assertFalse ( result ) <EOL> }

/** Tests that the cleanup procedure throws if there were active jobs by the end. */


@ Test <EOL> fun testCancelledDelaysNotThrowing ( )

{ <EOL> val scope = createTestCoroutineScope ( ) <EOL> var result = false <EOL> val deferred = CompletableDeferred < String > ( ) <EOL> val job = scope . launch { <EOL> deferred . await ( ) <EOL> result = true <EOL> } <EOL> job . cancel ( ) <EOL> assertFalse ( result ) <EOL> scope . cleanupTestCoroutines ( ) <EOL> assertFalse ( result ) <EOL> }

/** Tests that the cleanup procedure doesn't throw if it detects that the job is already cancelled. */


@ Test <EOL> fun testThrowsUncaughtExceptionsOnCleanup ( )

{ <EOL> val scope = createTestCoroutineScope ( ) <EOL> val exception = TestException ( "<STR_LIT:test>" ) <EOL> scope . launch { <EOL> throw exception <EOL> } <EOL> assertFailsWith < TestException > { <EOL> scope . cleanupTestCoroutines ( ) <EOL> } <EOL> }

/** Tests that uncaught exceptions are thrown at the cleanup. */


@ Test <EOL> fun testUncaughtExceptionsPrioritizedOnCleanup ( )

{ <EOL> val scope = createTestCoroutineScope ( ) <EOL> val exception = TestException ( "<STR_LIT:test>" ) <EOL> scope . launch { <EOL> throw exception <EOL> } <EOL> scope . launch { <EOL> delay ( <NUM_LIT> ) <EOL> } <EOL> assertFailsWith < TestException > { <EOL> scope . cleanupTestCoroutines ( ) <EOL> } <EOL> }

/** Tests that uncaught exceptions take priority over uncompleted jobs when throwing on cleanup. */


{ <EOL> val scope = createTestCoroutineScope ( ) <EOL> scope . cleanupTestCoroutines ( ) <EOL> assertFailsWith < IllegalStateException > { <EOL> scope . cleanupTestCoroutines ( ) <EOL> } <EOL> }

/** Tests that cleaning up twice is forbidden. */


@ Test <EOL> fun testSuppressedExceptions ( )

{ <EOL> createTestCoroutineScope ( ) . apply { <EOL> launch ( SupervisorJob ( ) ) { throw TestException ( "<STR_LIT:x>" ) } <EOL> launch ( SupervisorJob ( ) ) { throw TestException ( "<STR_LIT:y>" ) } <EOL> launch ( SupervisorJob ( ) ) { throw TestException ( "<STR_LIT:z>" ) } <EOL> try { <EOL> cleanupTestCoroutines ( ) <EOL> fail ( "<STR_LIT>" ) <EOL> } catch ( e : TestException ) { <EOL> assertEquals ( "<STR_LIT:x>" , e . message ) <EOL> assertEquals ( <NUM_LIT:2> , e . suppressedExceptions . size ) <EOL> assertEquals ( "<STR_LIT:y>" , e . suppressedExceptions [ <NUM_LIT:0> ] . message ) <EOL> assertEquals ( "<STR_LIT:z>" , e . suppressedExceptions [ <NUM_LIT:1> ] . message ) <EOL> } <EOL> } <EOL> }

/** Tests that, when reporting several exceptions, the first one is thrown, with the rest suppressed. */


@ Test <EOL> fun testCopyingContexts ( )

{ <EOL> val deferred = CompletableDeferred < Unit > ( ) <EOL> val scope1 = createTestCoroutineScope ( ) <EOL> scope1 . launch { deferred . await ( ) } <EOL> val scope2 = createTestCoroutineScope ( scope1 . coroutineContext ) <EOL> val scope3 = createTestCoroutineScope ( scope1 . coroutineContext ) <EOL> assertEquals ( scope1 . coroutineContext . minusKey ( CoroutineExceptionHandler ) , scope2 . coroutineContext . minusKey ( CoroutineExceptionHandler ) ) <EOL> scope2 . launch ( SupervisorJob ( ) ) { throw TestException ( "<STR_LIT:x>" ) } <EOL> try { <EOL> scope2 . cleanupTestCoroutines ( ) <EOL> fail ( "<STR_LIT>" ) <EOL> } catch ( e : TestException ) { } <EOL> scope3 . cleanupTestCoroutines ( ) <EOL> try { <EOL> scope1 . cleanupTestCoroutines ( ) <EOL> fail ( "<STR_LIT>" ) <EOL> } catch ( e : UncompletedCoroutinesError ) { <EOL> } <EOL> }

/** Tests that constructing a new [TestCoroutineScope] using another one's scope works and overrides the exception
 * handler. */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < T : Number , D : Dimension > Math . sin ( a : MultiArray < T , D > ) : NDArray < Double , D >

= this . mathEx . sin ( a )

/**
 * Returns an ndarray of Double from the given ndarray to each element of which a sin function has been applied.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < D : Dimension > Math . sin ( a : MultiArray < Float , D > ) : NDArray < Float , D >

= this . mathEx . sinF ( a )

/**
 * Returns an ndarray of Float from the given ndarray to each element of which a sin function has been applied.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < D : Dimension > Math . sin ( a : MultiArray < ComplexFloat , D > ) : NDArray < ComplexFloat , D >

= this . mathEx . sinCF ( a )

/**
 * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a sin function has been applied.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < D : Dimension > Math . sin ( a : MultiArray < ComplexDouble , D > ) : NDArray < ComplexDouble , D >

= this . mathEx . sinCD ( a )

/**
 * Returns an ndarray of [ComplexDouble] from the given ndarray to each element of which a sin function has been applied.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun String ? . toBoolean ( ) : Boolean

= this != null && this . lowercase ( ) == "<STR_LIT:true>"

/**
 * Returns `true` if this string is not `null` and its content is equal to the word "true", ignoring case, and `false` otherwise.
 *
 * There are also strict versions of the function available on non-nullable String, [toBooleanStrict] and [toBooleanStrictOrNull].
 */


public actual fun String . toByte ( ) : Byte

= toByteOrNull ( ) ? : numberFormatError ( this )

/**
 * Parses the string as a signed [Byte] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public actual fun String . toByte ( radix : Int ) : Byte

= toByteOrNull ( radix ) ? : numberFormatError ( this )

/**
 * Parses the string as a signed [Byte] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public actual fun String . toShort ( ) : Short

= toShortOrNull ( ) ? : numberFormatError ( this )

/**
 * Parses the string as a [Short] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public actual fun String . toShort ( radix : Int ) : Short

= toShortOrNull ( radix ) ? : numberFormatError ( this )

/**
 * Parses the string as a [Short] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public actual fun String . toInt ( ) : Int

= toIntOrNull ( ) ? : numberFormatError ( this )

/**
 * Parses the string as an [Int] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public actual fun String . toInt ( radix : Int ) : Int

= toIntOrNull ( radix ) ? : numberFormatError ( this )

/**
 * Parses the string as an [Int] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public actual fun String . toLong ( ) : Long

= toLongOrNull ( ) ? : numberFormatError ( this )

/**
 * Parses the string as a [Long] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public actual fun String . toLong ( radix : Int ) : Long

= toLongOrNull ( radix ) ? : numberFormatError ( this )

/**
 * Parses the string as a [Long] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public actual fun String . toDouble ( ) : Double

= ( + ( this . asDynamic ( ) ) ) . unsafeCast < Double > ( ) . also { <EOL> if ( it . isNaN ( ) && ! this . isNaN ( ) || it == <NUM_LIT:0.0> && this . isBlank ( ) ) <EOL> numberFormatError ( this ) <EOL> }

/**
 * Parses the string as a [Double] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


@ kotlin . internal . InlineOnly <EOL> public actual inline fun String . toFloat ( ) : Float

= toDouble ( ) . unsafeCast < Float > ( )

/**
 * Parses the string as a [Float] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public actual fun String . toDoubleOrNull ( ) : Double ?

= ( + ( this . asDynamic ( ) ) ) . unsafeCast < Double > ( ) . takeIf { <EOL> ! ( it . isNaN ( ) && ! this . isNaN ( ) || it == <NUM_LIT:0.0> && this . isBlank ( ) ) <EOL> }

/**
 * Parses the string as a [Double] number and returns the result
 * or `null` if the string is not a valid representation of a number.
 */


@ kotlin . internal . InlineOnly <EOL> public actual inline fun String . toFloatOrNull ( ) : Float ?

= toDoubleOrNull ( ) . unsafeCast < Float ? > ( )

/**
 * Parses the string as a [Float] number and returns the result
 * or `null` if the string is not a valid representation of a number.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun Byte . toString ( radix : Int ) : String

= this . toInt ( ) . toString ( radix )

/**
 * Returns a string representation of this [Byte] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun Short . toString ( radix : Int ) : String

= this . toInt ( ) . toString ( radix )

/**
 * Returns a string representation of this [Short] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun Int . toString ( radix : Int ) : String

= asDynamic ( ) . toString ( checkRadix ( radix ) )

/**
 * Returns a string representation of this [Int] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun Long . toString ( radix : Int ) : String

= <EOL> this . toStringImpl ( checkRadix ( radix ) )

/**
 * Returns a string representation of this [Long] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


@ PublishedApi <EOL> internal actual fun checkRadix ( radix : Int ) : Int

{ <EOL> if ( radix !in <NUM_LIT:2> .. <NUM_LIT> ) { <EOL> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> } <EOL> return radix <EOL> }

/**
 * Checks whether the given [radix] is valid radix for string to number and number to string conversion.
 */


actual fun < T > CoroutineScope . asyncWithDealy ( delay : Long , block : suspend ( ) -> T ) : Deferred < T >

{ <EOL> TODO ( "<STR_LIT:NotU+0020yetU+0020implemented>" ) <EOL> }

/**
 * Linux actual implementation for `asyncWithDelay`
 */


fun serializeSingleFileMetadata ( file : SourceFile ) : ProtoBuf . PackageFragment

/**
 * Serializes the metadata of a single source file to a protobuf message and returns the message.
 */


fun forEachFile ( block : ( Int , SourceFile , KtSourceFile , FqName ) -> Unit )

/**
 * Iterates through each file whose metadata is to be serialized, providing an opportunity to call [serializeSingleFileMetadata]
 * and perform additional processing of the serialized data.
 *
 * @param block A closure that accepts the index of the file in the list of source files, the source file, its corresponding
 * [KtSourceFile], and the fully qualified name of the package containing the file.
 */


private fun KotlinToolingDiagnosticsCollector . reportForDefaultPlatformCompilations ( compilations : Collection < KotlinCompilation < * > > )

{ <EOL> val alreadyReportedSourceSet = mutableSetOf < KotlinSourceSet > ( ) <EOL> for ( compilation in compilations ) { <EOL> val expectedSourceSetRoot = when { <EOL> compilation . isMain ( ) -> COMMON_MAIN_SOURCE_SET_NAME <EOL> compilation . isTest ( ) -> COMMON_TEST_SOURCE_SET_NAME <EOL> else -> continue <EOL> } <EOL> val unexpectedSourceSetRoots = compilation . sourceSetRoots ( ) . filter { it . name != expectedSourceSetRoot } <EOL> unexpectedSourceSetRoots . forEach { unexpectedSourceSetRoot -> <EOL> if ( ! alreadyReportedSourceSet . add ( unexpectedSourceSetRoot ) ) return@forEach <EOL> val includedIntoCompilations = unexpectedSourceSetRoot . internal <EOL> . compilations <EOL> . filter { it . platformType != KotlinPlatformType . common } <EOL> if ( includedIntoCompilations . isEmpty ( ) ) return@forEach <EOL> val singleCompilation = includedIntoCompilations . singleOrNull ( ) <EOL> val diagnostic = if ( singleCompilation != null ) { <EOL> MultipleSourceSetRootsInCompilation ( singleCompilation , unexpectedSourceSetRoot . name , expectedSourceSetRoot ) <EOL> } else { <EOL> MultipleSourceSetRootsInCompilation ( targetNames = includedIntoCompilations . map { it . target . name } , unexpectedSourceSetRoot . name , expectedSourceSetRoot ) <EOL> } <EOL> report ( compilation . project , diagnostic ) <EOL> } <EOL> } <EOL> }

/**
 * Report for 'main' and 'test' compilations.
 * These are special because we know that all source sets should depend on `commonMain` or `commonTest` accordingly.
 */


private fun KotlinToolingDiagnosticsCollector . reportForNonDefaultCompilations ( compilations : Collection < KotlinCompilation < * > > )

{ <EOL> for ( compilation in compilations ) { <EOL> if ( compilation . target . platformType == KotlinPlatformType . androidJvm ) continue <EOL> val diagnostic = MultipleSourceSetRootsInCompilation ( compilation , compilation . sourceSetRoots ( ) . map { it . name } ) <EOL> report ( compilation . project , diagnostic ) <EOL> } <EOL> }

/**
 * For non-default compilations, we don't know which of the multiple source set roots should win so report diagnostic differently
 */


fun render ( libraryAbi : LibraryAbi , settings : AbiRenderingSettings ) : String

= <EOL> buildString { render ( libraryAbi , this , settings ) }

/**
 * Render the [LibraryAbi] to the string representation.
 *
 * @param libraryAbi The [LibraryAbi] instance previously read by [LibraryAbiReader].
 * @param settings The rendering settings.
 */


fun render ( libraryAbi : LibraryAbi , output : Appendable , settings : AbiRenderingSettings ) : Unit

= <EOL> AbiRendererImpl ( libraryAbi , settings , output ) . render ( )

/**
 * Render the [LibraryAbi] to the string representation.
 *
 * @param libraryAbi The [LibraryAbi] instance previously read by [LibraryAbiReader].
 * @param output The output to write the rendered text to.
 * @param settings The rendering settings.
 */


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> override fun typeParameter ( name : Name , variance : Variance , isReified : Boolean , key : GeneratedDeclarationKey , config : TypeParameterBuildingContext . ( ) -> Unit )

{ <EOL> shouldNotBeCalled ( ) <EOL> }

/**
 * Type parameters of constructor are inherited from constructed class
 */


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> override fun contextReceiver ( type : ConeKotlinType )

{ <EOL> shouldNotBeCalled ( ) <EOL> }

/**
 * Context receivers of constructor are inherited from constructed class
 */


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> override fun contextReceiver ( typeProvider : ( List < FirTypeParameterRef > ) -> ConeKotlinType )

{ <EOL> shouldNotBeCalled ( ) <EOL> }


public fun FirExtension . createConstructor ( owner : FirClassSymbol < * > , key : GeneratedDeclarationKey , isPrimary : Boolean = false , generateDelegatedNoArgConstructorCall : Boolean = false , config : ConstructorBuildingContext . ( ) -> Unit = { } ) : FirConstructor

{ <EOL> return ConstructorBuildingContext ( session , key , owner , isPrimary ) . apply ( config ) . apply { <EOL> status { <EOL> isExpect = owner . isExpect <EOL> } <EOL> } . build ( ) . also { <EOL> if ( generateDelegatedNoArgConstructorCall ) { <EOL> it . generateNoArgDelegatingConstructorCall ( session ) <EOL> } <EOL> } <EOL> }

/**
 * Creates constructor for [owner] class.
 * Created constructor is public, unless [config] changes this.
 *
 * [generateDelegatedNoArgConstructorCall] specifies whether default delegating constructor call to superclass should be generated.
 * This generation works only if superclass of the [owner] has constructor without arguments.
 * Custom delegated constructor calls should be generated in IR backend (see `IrGenerationExtension`).
 */


public fun FirExtension . createDefaultPrivateConstructor ( owner : FirClassSymbol < * > , key : GeneratedDeclarationKey , generateDelegatedNoArgConstructorCall : Boolean = true ) : FirConstructor

{ <EOL> return createConstructor ( owner , key , isPrimary = true , generateDelegatedNoArgConstructorCall ) { <EOL> visibility = Visibilities . Private <EOL> } <EOL> }

/**
 * Creates private primary constructor without parameters for [owner] object.
 *
 * This is a shorthand for [createConstructor] which is useful for creating constructors for companions and other objects, as they should be private.
 *
 * [generateDelegatedNoArgConstructorCall] specifies whether default delegating constructor call to superclass should be generated.
 * This generation works only if superclass of the [owner] has constructor without arguments.
 * Custom delegated constructor calls should be generated in IR backend (see `IrGenerationExtension`).
 */


public fun Scheduler . asCoroutineDispatcher ( ) : SchedulerCoroutineDispatcher

= SchedulerCoroutineDispatcher ( this )

/**
 * Converts an instance of [Scheduler] to an implementation of [CoroutineDispatcher].
 */


override fun dispatch ( context : CoroutineContext , block : Runnable )

{ <EOL> scheduler . schedule ( block ) <EOL> }


override fun scheduleResumeAfterDelay ( timeMillis : Long , continuation : CancellableContinuation < Unit > )

{ <EOL> val disposable = scheduler . schedule ( { <EOL> with ( continuation ) { resumeUndispatched ( Unit ) } <EOL> } , timeMillis , TimeUnit . MILLISECONDS ) <EOL> continuation . disposeOnCancellation ( disposable . asDisposableHandle ( ) ) <EOL> }


override fun invokeOnTimeout ( timeMillis : Long , block : Runnable , context : CoroutineContext ) : DisposableHandle

= <EOL> scheduler . schedule ( block , timeMillis , TimeUnit . MILLISECONDS ) . asDisposableHandle ( )


= scheduler . toString ( )


override fun equals ( other : Any ? ) : Boolean

= other is SchedulerCoroutineDispatcher && other . scheduler === scheduler


= System . identityHashCode ( scheduler )


= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> val job = launch { expect ( <NUM_LIT:3> ) } <EOL> assertFalse ( Dispatchers . Main . immediate . isDispatchNeeded ( currentCoroutineContext ( ) ) ) <EOL> withContext ( Dispatchers . Main . immediate ) { <EOL> expect ( <NUM_LIT:2> ) <EOL> } <EOL> job . join ( ) <EOL> finish ( <NUM_LIT:4> ) <EOL> }

/** Tests that [MainCoroutineDispatcher.immediate] doesn't require dispatches from the test context. */


public fun facet ( variable : ColumnReference < * > , order : OrderDirection = OrderDirection . ASCENDING , format : String ? = null )

{ <EOL> facets . add ( variable ) <EOL> orders . add ( order ) <EOL> formats . add ( format ) <EOL> }

/**
 * Adds a new facet to the plot, defined by the specified variable.
 * This method allows the division of data into different subsets,
 * where each subset is represented as a separate panel in the plot.
 *
 * @param variable a reference to the column that defines the variable for this facet.
 * The values in this column are used to create different subsets of the data, which are then plotted as separate panels.
 * @param order specifies the ordering direction of the values in this facet.
 * It can be either [OrderDirection.ASCENDING] or [OrderDirection.DESCENDING].
 * The default value is [OrderDirection.ASCENDING].
 * @param format a string that specifies the format pattern for displaying the values in this facet in rows.
 * This can either be a simple number format (like "d")
 * or a string template where the number format is surrounded by curly braces (for example, "{d} cylinders").
 * > That the "$" character must be escaped as "\$".
 *
 *
 * Examples of format patterns:
 * - ".2f" -> "12.45"
 * - "Score: {.2f}" -> "Score: 12.45"
 * - "'Score: {}'" -> "Score: 12.454789"
 */


@ OptIn ( UnsafeWasmMemoryApi :: class ) <EOL> internal fun MemoryAllocator . storeString ( value : String ) : Pair < Pointer , Int >

{ <EOL> val bytes = value . encodeToByteArray ( ) <EOL> val ptr = allocate ( bytes . size + <NUM_LIT:1> ) <EOL> ptr . storeBytes ( bytes ) <EOL> ptr . storeByte ( bytes . size , <NUM_LIT:0> ) <EOL> return ptr to ( bytes . size + <NUM_LIT:1> ) <EOL> }

/**
 * Encoding [value] into a NULL-terminated byte sequence using UTF-8 encoding
 * and writes it to a memory region allocated to fit the sequence.
 * Return a pointer to the beginning of the written byte sequence and its length.
 */


internal fun Pointer . allocateString ( value : String ) : Int

{ <EOL> val bytes = value . encodeToByteArray ( ) <EOL> storeBytes ( bytes ) <EOL> storeByte ( bytes . size , <NUM_LIT:0> ) <EOL> return bytes . size + <NUM_LIT:1> <EOL> }

/**
 * Encodes [value] into a NULL-terminated byte sequence using UTF-8 encoding,
 * stores it in memory starting at the position this pointer points to,
 * and returns the length of the stored bytes sequence.
 */


@ UnsafeWasmMemoryApi <EOL> internal fun MemoryAllocator . allocateInt ( ) : Pointer

= allocate ( Int . SIZE_BYTES )

/**
 * Allocates memory to hold a single integer value.
 */


public fun < T > fillColor ( column : ColumnReference < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Color > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Color >

{ <EOL> return addNonPositionalMapping < T , Color > ( FILL , column . name ( ) , LetsPlotNonPositionalMappingParametersContinuous < T , Color > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `fillColor` aesthetic to a data column by [ColumnReference].
 *
 * @param column the data column to map to the color.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun < T > fillColor ( column : KProperty < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Color > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Color >

{ <EOL> return addNonPositionalMapping < T , Color > ( FILL , column . name , LetsPlotNonPositionalMappingParametersContinuous < T , Color > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `fillColor` aesthetic to a data column by [KProperty].
 *
 * @param column the data column to map to the color.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun fillColor ( column : String , parameters : LetsPlotNonPositionalMappingParametersContinuous < Any ? , Color > . ( ) -> Unit = { } ) : NonPositionalMapping < Any ? , Color >

{ <EOL> return addNonPositionalMapping < Any ? , Color > ( FILL , column , LetsPlotNonPositionalMappingParametersContinuous < Any ? , Color > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `fillColor` aesthetic to a data column by [String].
 *
 * @param column the data column to map to the color.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun < T > fillColor ( values : Iterable < T > , name : String ? = null , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Color > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Color >

{ <EOL> return addNonPositionalMapping < T , Color > ( FILL , values . toList ( ) , name , LetsPlotNonPositionalMappingParametersContinuous < T , Color > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `fillColor` aesthetic to an iterable collection of discrete values.
 *
 * @param values an iterable collection containing the discrete values.
 * @param name optional name for this aesthetic mapping.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun < T > fillColor ( values : DataColumn < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Color > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Color >

{ <EOL> return addNonPositionalMapping < T , Color > ( FILL , values , LetsPlotNonPositionalMappingParametersContinuous < T , Color > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `fillColor` aesthetic to a data column.
 *
 * @param values the data column to map to the color.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


@ ExamplesTest ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> fun CheckerContext . testResolveConfigurationInExecuteTime ( )

{ <EOL> assertFalse ( output . contains ( "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> assertFalse ( output . contains ( "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> }

/**
 * Check that Kover artifact files are not resolved during the task dependency tree construction process.
 *
 * The task tree is built at the configuration stage, so getting artifacts from dependencies can lead to premature task launches, deadlocks, and performance degradation.
 *
 * If a resolution is detected during configuration, the message "Configuration 'koverExternalArtifactsRelease' was resolved during configuration time" is printed.
 * This message may be changed in future versions, so it's worth double-checking for this error.
 */


public fun useInProcessStrategy ( ) : CompilerExecutionStrategyConfiguration

/**
 * Marks the compilation to be run inside the same JVM as the caller.
 * The default strategy.
 */


public fun useDaemonStrategy ( jvmArguments : List < String > , ) : CompilerExecutionStrategyConfiguration

/**
 * Marks the compilation to be run in Kotlin daemon launched as a separate process and shared across similar compilation requests.
 * See Kotlin daemon documentation here: https://kotlinlang.org/docs/gradle-compilation-and-caches.html#the-kotlin-daemon-and-how-to-use-it-with-gradle
 * @param jvmArguments a list of JVM startup arguments for the daemon
 */


public fun ImageProxy . toBitmap ( applyRotation : Boolean = false ) : Bitmap

{ <EOL> val bitmap = when ( format ) { <EOL> ImageFormat . YUV_420_888 -> yuv4208888ToBitmap ( this ) <EOL> PixelFormat . RGBA_8888 -> rgba8888ToBitmap ( this ) <EOL> else -> throw IllegalStateException ( "<STR_LIT>" ) <EOL> } <EOL> return if ( applyRotation ) { <EOL> val rotatedBitmap = Rotate ( imageInfo . rotationDegrees . toFloat ( ) ) . apply ( bitmap ) <EOL> if ( rotatedBitmap != bitmap ) { <EOL> bitmap . recycle ( ) <EOL> } <EOL> rotatedBitmap <EOL> } else { <EOL> bitmap <EOL> } <EOL> }

/**
 * Converts an [ImageProxy] to a [Bitmap].
 * Currently only supports [ImageFormat.YUV_420_888] and [PixelFormat.RGBA_8888].
 *
 * @param applyRotation if true the resulting bitmap will be rotated to match target orientation of a use case.
 * @throws [IllegalStateException] if the input format is [ImageFormat.YUV_420_888] and jpeg encoding of [YuvImage] fails.
 * @see ImageAnalysis supported output formats
 */


public fun imageToByteBuffer ( image : ImageProxy , outputBuffer : ByteArray , pixelCount : Int )

{ <EOL> assert ( image . format == ImageFormat . YUV_420_888 ) <EOL> val imageCrop = image . cropRect <EOL> val imagePlanes = image . planes <EOL> imagePlanes . forEachIndexed { planeIndex , plane -> <EOL> val outputStride : Int <EOL> var outputOffset : Int <EOL> when ( planeIndex ) { <EOL> <NUM_LIT:0> -> { <EOL> outputStride = <NUM_LIT:1> <EOL> outputOffset = <NUM_LIT:0> <EOL> } <EOL> <NUM_LIT:1> -> { <EOL> outputStride = <NUM_LIT:2> <EOL> outputOffset = pixelCount + <NUM_LIT:1> <EOL> } <EOL> <NUM_LIT:2> -> { <EOL> outputStride = <NUM_LIT:2> <EOL> outputOffset = pixelCount <EOL> } <EOL> else -> { <EOL> return@forEachIndexed <EOL> } <EOL> } <EOL> val planeBuffer = plane . buffer <EOL> val rowStride = plane . rowStride <EOL> val pixelStride = plane . pixelStride <EOL> val planeCrop = if ( planeIndex == <NUM_LIT:0> ) { <EOL> imageCrop <EOL> } else { <EOL> Rect ( imageCrop . left / <NUM_LIT:2> , imageCrop . top / <NUM_LIT:2> , imageCrop . right / <NUM_LIT:2> , imageCrop . bottom / <NUM_LIT:2> ) <EOL> } <EOL> val planeWidth = planeCrop . width ( ) <EOL> val planeHeight = planeCrop . height ( ) <EOL> val rowBuffer = ByteArray ( plane . rowStride ) <EOL> val rowLength = if ( pixelStride == <NUM_LIT:1> && outputStride == <NUM_LIT:1> ) { <EOL> planeWidth <EOL> } else { <EOL> ( planeWidth - <NUM_LIT:1> ) * pixelStride + <NUM_LIT:1> <EOL> } <EOL> for ( row in <NUM_LIT:0> until planeHeight ) { <EOL> planeBuffer . position ( ( row + planeCrop . top ) * rowStride + planeCrop . left * pixelStride ) <EOL> if ( pixelStride == <NUM_LIT:1> && outputStride == <NUM_LIT:1> ) { <EOL> planeBuffer . get ( outputBuffer , outputOffset , rowLength ) <EOL> outputOffset += rowLength <EOL> } else { <EOL> planeBuffer . get ( rowBuffer , <NUM_LIT:0> , rowLength ) <EOL> for ( col in <NUM_LIT:0> until planeWidth ) { <EOL> outputBuffer [ outputOffset ] = rowBuffer [ col * pixelStride ] <EOL> outputOffset += outputStride <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Decoding of YUV_420_888 image to NV21 byte representation.
 */


public fun Plot . save ( filename : String , scale : Number = <NUM_LIT:1> , dpi : Number ? = null , path : String ? = null ) : String

= ggsave ( toLetsPlot ( ) , filename , scale , dpi , path )

/**
 * Exports a plot to a file in one of the supported formats: `SVG`, `HTML`, `PNG`, `JPG`/`JPEG`, or `TIFF`.
 *
 * > In certain configurations, raster formats might not be supported.
 *
 * The exported file will be created in the directory `${user.dir}/lets-plot-images`,
 * unless a different directory is specified using the [path] parameter.
 *
 * @receiver [Plot] - the plot to export.
 * @param filename the name of the output file.
 * The filename must include an extension corresponding to one of the supported formats:
 * **svg**, **html** (or **htm**), **png**, **jpeg** (or **jpg**), or **tiff** (or **tif**).
 * @param scale The scaling is applied to the plot when exporting to raster formats (`PNG`, `JPEG`, `TIFF`).
 * This parameter is ignored for vector formats (`SVG`, `HTML`).
 * The default value is 1.
 * @param dpi the resolution of the exported image in dots per inch (DPI) when exporting to raster formats.
 * This parameter is ignored for vector formats.
 * By default, no DPI metadata is stored in the file.
 * @param path the path to the directory where the image files will be saved.
 * If not specified, the default directory is `${user.dir}/lets-plot-images`.
 *
 * @return The absolute pathname of the created file.
 */


public fun PlotGrid . save ( filename : String , scale : Number = <NUM_LIT:1> , dpi : Number ? = null , path : String ? = null ) : String

= ggsave ( wrap ( ) , filename , scale , dpi , path )

/**
 * Exports a plot grid to a file in one of the supported formats: `SVG`, `HTML`, `PNG`, `JPG`/`JPEG`, or `TIFF`.
 *
 * > In certain configurations, raster formats might not be supported.
 *
 * The exported file will be created in the directory `${user.dir}/lets-plot-images`,
 * unless a different directory is specified using the [path] parameter.
 *
 * @receiver [Plot] - the plot to export.
 * @param filename the name of the output file.
 * The filename must include an extension corresponding to one of the supported formats:
 * **svg**, **html** (or **htm**), **png**, **jpeg** (or **jpg**), or **tiff** (or **tif**).
 * @param scale The scaling is applied to the plot when exporting to raster formats (`PNG`, `JPEG`, `TIFF`).
 * This parameter is ignored for vector formats (`SVG`, `HTML`).
 * The default value is 1.
 * @param dpi the resolution of the exported image in dots per inch (DPI) when exporting to raster formats.
 * This parameter is ignored for vector formats.
 * By default, no DPI metadata is stored in the file.
 * @param path the path to the directory where the image files will be saved.
 * If not specified, the default directory is `${user.dir}/lets-plot-images`.
 *
 * @return The absolute pathname of the created file.
 */