GDML model in progress

This commit is contained in:
Alexander Nozik 2019-04-02 20:24:30 +03:00
parent 4e679b8971
commit 41acd879d8
2 changed files with 5 additions and 0 deletions

View File

@ -245,6 +245,7 @@ class MutableNumberDelegate<M : MutableMeta<M>>(
} }
val double get() = ReadWriteDelegateWrapper(this, reader = { it?.toDouble() }, writer = { it }) val double get() = ReadWriteDelegateWrapper(this, reader = { it?.toDouble() }, writer = { it })
val float get() = ReadWriteDelegateWrapper(this, reader = { it?.toFloat() }, writer = { it })
val int get() = ReadWriteDelegateWrapper(this, reader = { it?.toInt() }, writer = { it }) val int get() = ReadWriteDelegateWrapper(this, reader = { it?.toInt() }, writer = { it })
val short get() = ReadWriteDelegateWrapper(this, reader = { it?.toShort() }, writer = { it }) val short get() = ReadWriteDelegateWrapper(this, reader = { it?.toShort() }, writer = { it })
val long get() = ReadWriteDelegateWrapper(this, reader = { it?.toLong() }, writer = { it }) val long get() = ReadWriteDelegateWrapper(this, reader = { it?.toLong() }, writer = { it })
@ -303,6 +304,7 @@ class MutableSafeNumberDelegate<M : MutableMeta<M>>(
} }
val double get() = ReadWriteDelegateWrapper(this, reader = { it.toDouble() }, writer = { it }) val double get() = ReadWriteDelegateWrapper(this, reader = { it.toDouble() }, writer = { it })
val float get() = ReadWriteDelegateWrapper(this, reader = { it.toFloat() }, writer = { it })
val int get() = ReadWriteDelegateWrapper(this, reader = { it.toInt() }, writer = { it }) val int get() = ReadWriteDelegateWrapper(this, reader = { it.toInt() }, writer = { it })
val short get() = ReadWriteDelegateWrapper(this, reader = { it.toShort() }, writer = { it }) val short get() = ReadWriteDelegateWrapper(this, reader = { it.toShort() }, writer = { it })
val long get() = ReadWriteDelegateWrapper(this, reader = { it.toLong() }, writer = { it }) val long get() = ReadWriteDelegateWrapper(this, reader = { it.toLong() }, writer = { it })

View File

@ -118,6 +118,7 @@ operator fun <M : MutableMetaNode<M>> M.set(name: Name, value: Any?) {
is MetaItem.NodeItem<*> -> setNode(name, value.node) is MetaItem.NodeItem<*> -> setNode(name, value.node)
} }
is Meta -> setNode(name, value) is Meta -> setNode(name, value)
is Specification -> setNode(name, value.config)
else -> setValue(name, Value.of(value)) else -> setValue(name, Value.of(value))
} }
} }
@ -183,3 +184,5 @@ fun <M : MutableMetaNode<M>> M.append(name: Name, value: Any?) {
set(name.withIndex(index.toString()), value) set(name.withIndex(index.toString()), value)
} }
} }
fun <M : MutableMetaNode<M>> M.append(name: String, value: Any?) = append(name.toName(), value)