All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.math.array.float32.AbstractArrayBuilder.kt Maven / Gradle / Ivy

package ru.casperix.math.array.float32

abstract class AbstractArrayBuilder(initialSize: Int = 16) : ArrayBuilder {
//    abstract fun createArray(size: Int): CustomArray
//    abstract fun copy(target:CustomArray, source: CustomArray, offset:Int): CustomArray
//
//    private var usage: Int = 0
//    private var buffer = createArray(initialSize)
//
//    override fun append(data: CustomArray) {
//        val end = usage
//        length = end + data.size
//        copy(buffer, data, end)
////        data.copyInto(buffer, end)
//    }
//
//    override var length: Int
//        get() = usage
//        set(value) {
//            if (value > buffer.size) {
//                val next = FloatArray(max(value, buffer.size * 2))
//                buffer.copyInto(next)
//                buffer = next
//            }
//            usage = value
//        }
//
//    override fun build(): FloatArray {
//        return buffer.sliceArray(0 until usage)
//    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy