package Ġde . fl ap do od le . fx . lazy Ċ Ċ class ĠMerged < A Ġ: ĠAny , ĠB Ġ: ĠAny , ĠT Ġ: ĠAny >( ĊĠĠĠ Ġprivate Ġval Ġsource A : ĠLazy Value < A >, ĊĠĠĠ Ġprivate Ġval Ġsource B : ĠLazy Value < B >, ĊĠĠĠ Ġprivate Ġval Ġmap : Ġ( A , ĠB ) Ġ-> ĠT Ċ ) Ġ: ĠAbstract Lazy < T >(), ĠLazy Value < T > Ġ{ ĊĊĠ Ġprivate Ġvar Ġlast Source A Ġ= Ġsource A . value () ĊĠ Ġprivate Ġvar Ġlast Source B Ġ= Ġsource B . value () ĊĠ Ġprivate Ġvar Ġsource A Has Changed Ġ= Ġfalse ĊĠ Ġprivate Ġvar Ġsource B Has Changed Ġ= Ġfalse ĊĊĠ Ġprivate Ġvar Ġcurrent Ġ= Ġmap ( last Source A , Ġlast Source B ) ĊĊĠ Ġprivate Ġval Ġlistener A Ġ= ĠChanged Listener < A > Ġ{ ĊĠĠĠ Ġsource A Has Changed Ġ= Ġtrue ĊĠĠĠ Ġchange Listener . forEach Ġ{ ĊĠĠĠĠĠ Ġit . has Changed ( this ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĠ Ġprivate Ġval Ġlistener B Ġ= ĠChanged Listener < B > Ġ{ ĊĠĠĠ Ġsource B Has Changed Ġ= Ġtrue ĊĠĠĠ Ġchange Listener . forEach Ġ{ ĊĠĠĠĠĠ Ġit . has Changed ( this ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġinit Ġ{ ĊĠĠĠ Ġsource A . addListener ( Weak ChangeListener Delegate ( listener A )) ĊĠĠĠ Ġsource B . addListener ( Weak ChangeListener Delegate ( listener B )) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġvalue (): ĠT Ġ{ ĊĠĠĠ Ġval Ġcurrent Source A Ġ= Ġsource A . value () ĊĠĠĠ Ġval Ġcurrent Source B Ġ= Ġsource B . value () ĊĠĠĠ Ġif Ġ( current Source A Ġ!= Ġlast Source A Ġ|| Ġcurrent Source B Ġ!= Ġlast Source B Ġ|| Ġsource A Has Changed Ġ|| Ġsource B Has Changed ) Ġ{ ĊĠĠĠĠĠ Ġcurrent Ġ= Ġmap ( current Source A , Ġcurrent Source B ) ĊĠĠĠĠĠ Ġlast Source A Ġ= Ġcurrent Source A ĊĠĠĠĠĠ Ġlast Source B Ġ= Ġcurrent Source B ĊĠĠĠĠĠ Ġsource A Has Changed Ġ= Ġfalse ĊĠĠĠĠĠ Ġsource B Has Changed Ġ= Ġfalse ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġcurrent ĊĠ Ġ} Ċ }