commonMain.jetbrains.datalore.base.json.FluentArray.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lets-plot-common Show documentation
Show all versions of lets-plot-common Show documentation
Lets-Plot JVM package without rendering part
/*
* Copyright (c) 2020. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
package jetbrains.datalore.base.json
class FluentArray: FluentValue {
private val myArray: ArrayList
constructor() {
myArray = ArrayList()
}
constructor(array: List) {
myArray = ArrayList(array)
}
fun getDouble(index: Int) = myArray[index] as Double
fun add(v: String?) = apply { myArray.add(v) }
fun add(v: Double?) = apply { myArray.add(v) }
fun addStrings(values: List) = apply { myArray.addAll(values) }
fun addAll(values: List) = apply { values.forEach { v -> myArray.add(v.get()) } }
fun addAll(vararg values: FluentValue) = apply { addAll(listOf(*values)) }
fun stream() = streamOf(myArray)
fun objectStream() = objectsStreamOf(myArray)
fun fluentObjectStream() = objectsStreamOf(myArray).map(::FluentObject)
override fun get() = myArray
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy