translator: add print to Long and Short arrays
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import ByteArray
|
||||
import IntArray
|
||||
import LongArray
|
||||
import ShortArray
|
||||
|
||||
/*
|
||||
* Library for console interaction
|
||||
@@ -85,6 +87,16 @@ fun print(message: IntArray) {
|
||||
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. */
|
||||
fun println(message: Int) {
|
||||
@@ -146,6 +158,16 @@ fun println(message: IntArray) {
|
||||
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. */
|
||||
fun 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 {
|
||||
val newInstance = LongArray(newSize)
|
||||
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 {
|
||||
val newInstance = ShortArray(newSize)
|
||||
var index = 0
|
||||
|
||||
Reference in New Issue
Block a user