Blame view

src/main/kotlin/application/model/ObservableVessel.kt 454 Bytes
b350f9dfe   lsagona   import vessels an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  package application.model
  
  import kotlin.properties.Delegates
  
  class ObservableVessel {
      val listeners: MutableList<MessageListener> = mutableListOf()
  
      var vessels: MutableMap<Int?, Vessel> by Delegates.observable(
          initialValue = mutableMapOf(),
          onChange = {
              _, _, new ->
              run {
                  listeners.forEach {
                      it.onValueChanged(new)
                  }
              }
          }
      )
  
  }