I should probably go to sleep
This commit is contained in:
parent
70782e0fa2
commit
d5ef860d15
@ -4,7 +4,7 @@ kotlin.code.style=official
|
|||||||
specifyKotlinAsDependency=false
|
specifyKotlinAsDependency=false
|
||||||
|
|
||||||
projectGroup=ru.dbotthepony.kommons
|
projectGroup=ru.dbotthepony.kommons
|
||||||
projectVersion=2.9.9
|
projectVersion=2.9.10
|
||||||
|
|
||||||
guavaDepVersion=33.0.0
|
guavaDepVersion=33.0.0
|
||||||
gsonDepVersion=2.8.9
|
gsonDepVersion=2.8.9
|
||||||
|
@ -41,6 +41,7 @@ import kotlin.concurrent.withLock
|
|||||||
* Attached delegates can be safely mutated by multiple threads concurrently
|
* Attached delegates can be safely mutated by multiple threads concurrently
|
||||||
* (attached [ListenableDelegate] can call [Listenable.addListener] callback concurrently).
|
* (attached [ListenableDelegate] can call [Listenable.addListener] callback concurrently).
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST", "UNUSED")
|
||||||
class DelegateSyncher : Observer {
|
class DelegateSyncher : Observer {
|
||||||
private val lock = ReentrantLock()
|
private val lock = ReentrantLock()
|
||||||
private val slots = ArrayList<AbstractSlot?>()
|
private val slots = ArrayList<AbstractSlot?>()
|
||||||
@ -283,6 +284,10 @@ class DelegateSyncher : Observer {
|
|||||||
it.changelist.add(SetAction(KOptional(), CLEAR))
|
it.changelist.add(SetAction(KOptional(), CLEAR))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listeners.forEach {
|
||||||
|
it.listener.onClear()
|
||||||
|
}
|
||||||
|
|
||||||
it.markDirty()
|
it.markDirty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,6 +301,10 @@ class DelegateSyncher : Observer {
|
|||||||
it.changelist.add(SetAction(KOptional(codec.copy(element)), ADD))
|
it.changelist.add(SetAction(KOptional(codec.copy(element)), ADD))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listeners.forEach {
|
||||||
|
it.listener.onValueAdded(element)
|
||||||
|
}
|
||||||
|
|
||||||
it.markDirty()
|
it.markDirty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,6 +318,10 @@ class DelegateSyncher : Observer {
|
|||||||
it.changelist.add(SetAction(KOptional(codec.copy(element)), REMOVE))
|
it.changelist.add(SetAction(KOptional(codec.copy(element)), REMOVE))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listeners.forEach {
|
||||||
|
it.listener.onValueRemoved(element)
|
||||||
|
}
|
||||||
|
|
||||||
it.markDirty()
|
it.markDirty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,6 +400,10 @@ class DelegateSyncher : Observer {
|
|||||||
it.changelist.add(MapAction(KOptional(), KOptional(), CLEAR))
|
it.changelist.add(MapAction(KOptional(), KOptional(), CLEAR))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listeners.forEach {
|
||||||
|
it.listener.onClear()
|
||||||
|
}
|
||||||
|
|
||||||
it.markDirty()
|
it.markDirty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -400,6 +417,10 @@ class DelegateSyncher : Observer {
|
|||||||
it.changelist.add(MapAction(KOptional(keyCodec.copy(key)), KOptional(valueCodec.copy(value)), ADD))
|
it.changelist.add(MapAction(KOptional(keyCodec.copy(key)), KOptional(valueCodec.copy(value)), ADD))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listeners.forEach {
|
||||||
|
it.listener.onValueAdded(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
it.markDirty()
|
it.markDirty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,6 +434,10 @@ class DelegateSyncher : Observer {
|
|||||||
it.changelist.add(MapAction(KOptional(keyCodec.copy(key)), KOptional(), REMOVE))
|
it.changelist.add(MapAction(KOptional(keyCodec.copy(key)), KOptional(), REMOVE))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listeners.forEach {
|
||||||
|
it.listener.onValueRemoved(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
it.markDirty()
|
it.markDirty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user