v0.8.2 #80
@ -5,6 +5,7 @@
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
- Simplify inheritance logic in `MutableTypedMeta`
|
||||
|
||||
### Deprecated
|
||||
- MetaProvider `spec` is replaced by `readable`. `listOfSpec` replaced with `listOfReadable`
|
||||
|
@ -159,7 +159,17 @@ public interface MutableTypedMeta<M : MutableTypedMeta<M>> : TypedMeta<M>, Mutab
|
||||
*/
|
||||
@DFExperimental
|
||||
public fun attach(name: Name, node: M)
|
||||
override fun get(name: Name): M?
|
||||
|
||||
override fun get(name: Name): M? {
|
||||
tailrec fun M.find(name: Name): M? = if (name.isEmpty()) {
|
||||
self
|
||||
} else {
|
||||
items[name.firstOrNull()!!]?.find(name.cutFirst())
|
||||
}
|
||||
|
||||
return self.find(name)
|
||||
}
|
||||
|
||||
override fun getOrCreate(name: Name): M
|
||||
}
|
||||
|
||||
@ -388,7 +398,7 @@ public fun MutableMeta.reset(newMeta: Meta) {
|
||||
(items.keys - newMeta.items.keys).forEach {
|
||||
remove(it.asName())
|
||||
}
|
||||
newMeta.items.forEach { (token, item)->
|
||||
newMeta.items.forEach { (token, item) ->
|
||||
set(token, item)
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,6 @@ package space.kscience.dataforge.meta
|
||||
|
||||
import space.kscience.dataforge.misc.ThreadSafe
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.cutFirst
|
||||
import space.kscience.dataforge.names.firstOrNull
|
||||
import space.kscience.dataforge.names.isEmpty
|
||||
|
||||
|
||||
internal data class MetaListener(
|
||||
@ -39,20 +36,7 @@ public interface ObservableMeta : Meta {
|
||||
* A [Meta] which is both observable and mutable
|
||||
*/
|
||||
public interface ObservableMutableMeta : ObservableMeta, MutableMeta, MutableTypedMeta<ObservableMutableMeta> {
|
||||
|
||||
override val self: ObservableMutableMeta get() = this
|
||||
|
||||
override fun getOrCreate(name: Name): ObservableMutableMeta
|
||||
|
||||
override fun get(name: Name): ObservableMutableMeta? {
|
||||
tailrec fun ObservableMutableMeta.find(name: Name): ObservableMutableMeta? = if (name.isEmpty()) {
|
||||
this
|
||||
} else {
|
||||
items[name.firstOrNull()!!]?.find(name.cutFirst())
|
||||
}
|
||||
|
||||
return find(name)
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class AbstractObservableMeta : ObservableMeta {
|
||||
|
Loading…
Reference in New Issue
Block a user