From be2daca25ef699ec85e2a9d704a95767f7139591 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 7 Aug 2021 14:06:00 +0300 Subject: [PATCH] Add force-invalidate to ObservableMeta --- .../space/kscience/dataforge/meta/MutableMeta.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt index 5b3265d9..bb23049a 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt @@ -267,7 +267,7 @@ private class MutableMetaImpl( private val listeners = HashSet() - private fun changed(name: Name) { + override fun invalidate(name: Name) { listeners.forEach { it.callback(this, name) } } @@ -276,7 +276,7 @@ private class MutableMetaImpl( val oldValue = field field = value if (oldValue != value) { - changed(Name.EMPTY) + invalidate(Name.EMPTY) } } @@ -301,7 +301,7 @@ private class MutableMetaImpl( private fun ObservableMeta.adoptBy(parent: MutableMetaImpl, key: NameToken) { onChange(parent) { name -> - parent.changed(key + name) + parent.invalidate(key + name) } } @@ -346,7 +346,7 @@ private class MutableMetaImpl( newItem.adoptBy(this, key) children[key] = newItem } - changed(key.asName()) + invalidate(key.asName()) } } @@ -372,7 +372,7 @@ private class MutableMetaImpl( items[token]?.setMeta(name.cutFirst(), node) } } - changed(name) + invalidate(name) } }