translator: add print to Long and Short arrays
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import ByteArray
|
import ByteArray
|
||||||
import IntArray
|
import IntArray
|
||||||
|
import LongArray
|
||||||
|
import ShortArray
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Library for console interaction
|
* Library for console interaction
|
||||||
@@ -85,6 +87,16 @@ fun print(message: IntArray) {
|
|||||||
message.print()
|
message.print()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Prints the given message and newline to the standard output stream. */
|
||||||
|
fun print(message: LongArray) {
|
||||||
|
message.print()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prints the given message and newline to the standard output stream. */
|
||||||
|
fun print(message: ShortArray) {
|
||||||
|
message.print()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Prints the given message and newline to the standard output stream. */
|
/** Prints the given message and newline to the standard output stream. */
|
||||||
fun println(message: Int) {
|
fun println(message: Int) {
|
||||||
@@ -146,6 +158,16 @@ fun println(message: IntArray) {
|
|||||||
message.println()
|
message.println()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Prints the given message and newline to the standard output stream. */
|
||||||
|
fun println(message: LongArray) {
|
||||||
|
message.println()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prints the given message and newline to the standard output stream. */
|
||||||
|
fun println(message: ShortArray) {
|
||||||
|
message.println()
|
||||||
|
}
|
||||||
|
|
||||||
/** Prints newline to the standard output stream. */
|
/** Prints newline to the standard output stream. */
|
||||||
fun println() {
|
fun println() {
|
||||||
kotlinclib_println()
|
kotlinclib_println()
|
||||||
|
|||||||
@@ -43,6 +43,25 @@ class LongArray(var size: Int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun LongArray.print() {
|
||||||
|
var index = 0
|
||||||
|
print('[')
|
||||||
|
while (index < size) {
|
||||||
|
print(get(index))
|
||||||
|
index++
|
||||||
|
if (index < size) {
|
||||||
|
print(';')
|
||||||
|
print(' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print(']')
|
||||||
|
}
|
||||||
|
|
||||||
|
fun LongArray.println() {
|
||||||
|
this.print()
|
||||||
|
println()
|
||||||
|
}
|
||||||
|
|
||||||
fun LongArray.copyOf(newSize: Int): LongArray {
|
fun LongArray.copyOf(newSize: Int): LongArray {
|
||||||
val newInstance = LongArray(newSize)
|
val newInstance = LongArray(newSize)
|
||||||
var index = 0
|
var index = 0
|
||||||
|
|||||||
@@ -44,6 +44,26 @@ class ShortArray(var size: Int) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun ShortArray.print() {
|
||||||
|
var index = 0
|
||||||
|
print('[')
|
||||||
|
while (index < size) {
|
||||||
|
print(get(index))
|
||||||
|
index++
|
||||||
|
if (index < size) {
|
||||||
|
print(';')
|
||||||
|
print(' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print(']')
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ShortArray.println() {
|
||||||
|
this.print()
|
||||||
|
println()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun ShortArray.copyOf(newSize: Int): ShortArray {
|
fun ShortArray.copyOf(newSize: Int): ShortArray {
|
||||||
val newInstance = ShortArray(newSize)
|
val newInstance = ShortArray(newSize)
|
||||||
var index = 0
|
var index = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user