Observable Indexed Collection
Observable Idx collection allows to track all the changes by subscribing to onChange
event
- Source
- __.scala
trait Collection.Observable[Idx.Observable.A]
trait Observable
trait Idx[Idx.Observable.A]
trait Collection[Idx.Observable.A]
trait Able.Size
trait Able.Stream[Idx.Observable.A]
class java.lang.Object
trait scala.Matchable
class Any
trait Idx.ObservableMutable[Idx.ObservableMutable.A]
class Idx.ObservableMutable.X.Abstract[Idx.ObservableMutable.X.Abstract.A]
class Idx.ObservableMutable.X.Basic[Idx.ObservableMutable.X.Basic.A]
class Idx.Observable.X.Abstract[Idx.Observable.X.Abstract.A]
trait Idx.Observable.X.Base[Idx.Observable.X.Base.A]
Def
On element add
On element add
Subscribes given function to element add event
val co: Collection.ObservableMutable[Int] = Collection.OM[Int]()
co.onAdd("Added: "+ _ tp())
co ++= 1 <> 3
// Output
Added: 1
Added: 2
Added: 3
- Definition Classes
- Source
- __.scala
On event
On event
Subscribes given function to all element changes
val idx: Idx.OM[Int] = Idx.OM[Int]()
idx.onChange(_.stream.tp)
idx ++= 1 <> 5
idx(2) = 22
idx.removeRange(3 <> 4)
idx.stream.tp
// Output
Stream(IdxChange{type=Add,range=0 <> 4,items=[1,2,3,4,5]})
Stream(IdxChange{type=Update,range=2 <> 2,items=22,oldItems=3})
Stream(IdxChange{type=Remove,range=3 <> 4,items=[4,5]})
Stream(1, 2, 22)
- Source
- __.scala
On element remove
On element remove
Subscribes given function to element remove event
val co: Collection.ObservableMutable[Int] = Collection.OM[Int]()
co.onRemove("Removed: "+ _ tp())
co ++= 1 <> 10
co --= 5 <> 7
// Output
Removed: 7
Removed: 6
Removed: 5
- Definition Classes
- Source
- __.scala