diff --git a/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/ConfigProperty.kt b/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/MetaProperty.kt similarity index 72% rename from dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/ConfigProperty.kt rename to dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/MetaProperty.kt index c51f809e..9e6964c3 100644 --- a/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/ConfigProperty.kt +++ b/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/MetaProperty.kt @@ -1,6 +1,6 @@ package space.kscience.dataforge.properties -import space.kscience.dataforge.meta.Config +import space.kscience.dataforge.meta.ObservableMeta import space.kscience.dataforge.meta.get import space.kscience.dataforge.meta.set import space.kscience.dataforge.meta.transformations.MetaConverter @@ -11,25 +11,25 @@ import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.startsWith @DFExperimental -public class ConfigProperty( - public val config: Config, +public class MetaProperty( + public val meta: ObservableMeta, public val name: Name, public val converter: MetaConverter, ) : Property { override var value: T? - get() = converter.nullableItemToObject(config[name]) + get() = converter.nullableItemToObject(meta[name]) set(value) { - config[name] = converter.nullableObjectToMetaItem(value) + meta[name] = converter.nullableObjectToMetaItem(value) } override fun onChange(owner: Any?, callback: (T?) -> Unit) { - config.onChange(owner) { name, oldItem, newItem -> + meta.onChange(owner) { name, oldItem, newItem -> if (name.startsWith(this.name) && oldItem != newItem) callback(converter.nullableItemToObject(newItem)) } } override fun removeChangeListener(owner: Any?) { - config.removeListener(owner) + meta.removeListener(owner) } } \ No newline at end of file diff --git a/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/schemeProperty.kt b/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/schemeProperty.kt index 798154d5..63695bb4 100644 --- a/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/schemeProperty.kt +++ b/dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/schemeProperty.kt @@ -1,13 +1,14 @@ package space.kscience.dataforge.properties -import space.kscience.dataforge.meta.ItemPropertyProvider + +import space.kscience.dataforge.meta.ObservableItemProvider import space.kscience.dataforge.misc.DFExperimental import space.kscience.dataforge.names.startsWith import space.kscience.dataforge.names.toName import kotlin.reflect.KMutableProperty1 @DFExperimental -public fun

P.property(property: KMutableProperty1): Property = +public fun

P.property(property: KMutableProperty1): Property = object : Property { override var value: T? get() = property.get(this@property)