Blame view

src/main/kotlin/application/model/ObservableVessel.kt 473 Bytes
b350f9dfe   lsagona   import vessels an...
1
  package application.model
53f01ecc3   lsagona   display message o...
2
  import java.util.*
b350f9dfe   lsagona   import vessels an...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  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)
                  }
              }
          }
      )
  
  }