package Ġb aa ah s . controller Ċ Ċ import Ġb aa ah s . Pub Sub Ċ import Ġb aa ah s . plugin . Plugins Ċ import Ġb aa ah s . sm . web api . Topics Ċ import Ġb aa ah s . ui . Observable Ċ import Ġb aa ah s . util . Time Ċ import Ġkotlinx . serialization . Serializable Ċ Ċ class ĠCont rollers Publisher ( ĊĠĠĠ Ġpub Sub : ĠPub Sub . Server , ĊĠĠĠ Ġplugins : ĠPlugins Ċ ) Ġ: ĠController Listener Ġ{ ĊĠĠĠ Ġprivate Ġval Ġcontroller States Channel Ġ= Ġpub Sub . open Channel ( Topics . create Controller States ( plugins ), Ġempty Map ()) Ġ{} ĊĠĠĠ Ġprivate Ġval Ġcontroller States Ġ= Ġmutable Map Of < Controller Id , ĠController State >() ĊĊĠĠĠ Ġoverride Ġfun Ġon Add ( controller : ĠController ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontroller States [ controller . controller Id ] Ġ= Ġcontroller . state ĊĠĠĠĠĠĠĠ Ġcontroller States Channel . onChange ( controller States ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Remove ( controller : ĠController ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontroller States . remove ( controller . controller Id ) ĊĠĠĠĠĠĠĠ Ġcontroller States Channel . onChange ( controller States ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonError ( controller : ĠController ) Ġ{ ĊĠĠĠ Ġ} Ċ } Ċ Ċ @ Serializable Ċ abstract Ġclass ĠController State Ġ: ĠObservable () Ġ{ ĊĠĠĠ Ġabstract Ġval Ġtitle : ĠString ĊĠĠĠ Ġabstract Ġval Ġaddress : ĠString ? ĊĠĠĠ Ġabstract Ġval Ġonline Since : ĠTime ? ĊĊĠĠĠ Ġopen Ġfun Ġmatches ( controller Matcher : ĠController Matcher ): ĠBoolean Ġ= ĊĠĠĠĠĠĠĠ Ġcontroller Matcher . matches ( title , Ġaddress ) Ċ }