ColumnarData returns nullable column

This commit is contained in:
Alexander Nozik 2021-05-14 12:42:27 +03:00
parent 6eb95f26eb
commit fff7377687
4 changed files with 6 additions and 5 deletions

View File

@ -29,6 +29,7 @@
- Separated benchmarks and examples - Separated benchmarks and examples
- Rewritten EJML module without ejml-simple - Rewritten EJML module without ejml-simple
- Stability of kmath-ast and kmath-kotilngrad promoted to EXPERIMENTAL. - Stability of kmath-ast and kmath-kotilngrad promoted to EXPERIMENTAL.
- ColumnarData returns nullable column
### Deprecated ### Deprecated

View File

@ -19,7 +19,7 @@ import space.kscience.kmath.structures.Buffer
public interface ColumnarData<out T> { public interface ColumnarData<out T> {
public val size: Int public val size: Int
public operator fun get(symbol: Symbol): Buffer<T> public operator fun get(symbol: Symbol): Buffer<T>?
} }
/** /**

View File

@ -27,10 +27,10 @@ public interface XYColumnarData<T, out X : T, out Y : T> : ColumnarData<T> {
*/ */
public val y: Buffer<Y> public val y: Buffer<Y>
override fun get(symbol: Symbol): Buffer<T> = when (symbol) { override fun get(symbol: Symbol): Buffer<T>? = when (symbol) {
Symbol.x -> x Symbol.x -> x
Symbol.y -> y Symbol.y -> y
else -> error("A column for symbol $symbol not found") else -> null
} }
} }

View File

@ -17,10 +17,10 @@ import space.kscience.kmath.structures.Buffer
public interface XYZColumnarData<T, out X : T, out Y : T, out Z : T> : XYColumnarData<T, X, Y> { public interface XYZColumnarData<T, out X : T, out Y : T, out Z : T> : XYColumnarData<T, X, Y> {
public val z: Buffer<Z> public val z: Buffer<Z>
override fun get(symbol: Symbol): Buffer<T> = when (symbol) { override fun get(symbol: Symbol): Buffer<T>? = when (symbol) {
Symbol.x -> x Symbol.x -> x
Symbol.y -> y Symbol.y -> y
Symbol.z -> z Symbol.z -> z
else -> error("A column for symbol $symbol not found") else -> null
} }
} }