From ade4eec96ea19f07ef833602412716e43a6f1cdc Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 30 Oct 2019 17:13:31 +0300 Subject: [PATCH] Make putted values optional in MetaBuilder --- .../kotlin/hep/dataforge/meta/MetaBuilder.kt | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/MetaBuilder.kt b/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/MetaBuilder.kt index 671d1f13..c5ad3831 100644 --- a/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/MetaBuilder.kt +++ b/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/MetaBuilder.kt @@ -15,55 +15,55 @@ class MetaBuilder : AbstractMutableMeta() { override fun wrapNode(meta: Meta): MetaBuilder = if (meta is MetaBuilder) meta else meta.builder() override fun empty(): MetaBuilder = MetaBuilder() - infix fun String.put(value: Value){ - set(this,value) + infix fun String.put(value: Value?) { + set(this, value) } - infix fun String.put(string: String){ - set(this,string.asValue()) + infix fun String.put(string: String?) { + set(this, string?.asValue()) } - infix fun String.put(number: Number){ - set(this,number.asValue()) + infix fun String.put(number: Number?) { + set(this, number?.asValue()) } - infix fun String.put(boolean: Boolean){ - set(this, boolean.asValue()) + infix fun String.put(boolean: Boolean?) { + set(this, boolean?.asValue()) } - infix fun String.put(enum: Enum<*>){ + infix fun String.put(enum: Enum<*>) { set(this, EnumValue(enum)) } @JvmName("putValues") - infix fun String.put(iterable: Iterable){ + infix fun String.put(iterable: Iterable) { set(this, iterable.asValue()) } @JvmName("putNumbers") - infix fun String.put(iterable: Iterable){ + infix fun String.put(iterable: Iterable) { set(this, iterable.map { it.asValue() }.asValue()) } @JvmName("putStrings") - infix fun String.put(iterable: Iterable){ + infix fun String.put(iterable: Iterable) { set(this, iterable.map { it.asValue() }.asValue()) } - infix fun String.put(array: DoubleArray){ + infix fun String.put(array: DoubleArray) { set(this, array.asValue()) } - infix fun String.putValue(any: Any?){ + infix fun String.putValue(any: Any?) { set(this, Value.of(any)) } - infix fun String.put(meta: Meta) { + infix fun String.put(meta: Meta?) { this@MetaBuilder[this] = meta } - infix fun String.put(repr: MetaRepr){ - set(this,repr.toMeta()) + infix fun String.put(repr: MetaRepr?) { + set(this, repr?.toMeta()) } @JvmName("putMetas") @@ -75,37 +75,37 @@ class MetaBuilder : AbstractMutableMeta() { this@MetaBuilder[this] = MetaBuilder().apply(metaBuilder) } - infix fun Name.put(value: Value){ - set(this,value) + infix fun Name.put(value: Value?) { + set(this, value) } - infix fun Name.put(string: String){ - set(this,string.asValue()) + infix fun Name.put(string: String?) { + set(this, string?.asValue()) } - infix fun Name.put(number: Number){ - set(this,number.asValue()) + infix fun Name.put(number: Number?) { + set(this, number?.asValue()) } - infix fun Name.put(boolean: Boolean){ - set(this, boolean.asValue()) + infix fun Name.put(boolean: Boolean?) { + set(this, boolean?.asValue()) } - infix fun Name.put(enum: Enum<*>){ + infix fun Name.put(enum: Enum<*>) { set(this, EnumValue(enum)) } @JvmName("putValues") - infix fun Name.put(iterable: Iterable){ + infix fun Name.put(iterable: Iterable) { set(this, iterable.asValue()) } - infix fun Name.put(meta: Meta) { + infix fun Name.put(meta: Meta?) { this@MetaBuilder[this] = meta } - infix fun Name.put(repr: MetaRepr){ - set(this,repr.toMeta()) + infix fun Name.put(repr: MetaRepr?) { + set(this, repr?.toMeta()) } @JvmName("putMetas")