package Ġcom . the d ancer codes . android . cre atures . domain . inter actor Ċ Ċ import Ġcom . the d ancer codes . android . cre atures . domain . executor . Post Execution Thread Ċ import Ġcom . the d ancer codes . android . cre atures . domain . executor . Thread Executor Ċ import Ġio . reactivex . Flow able Ċ import Ġio . reactivex . Single Ċ import Ġio . reactivex . dis pos ables . Composite Disposable Ċ import Ġio . reactivex . dis pos ables . Disposable Ċ import Ġio . reactivex . schedul ers . Schedulers Ċ import Ġio . reactivex . subscribers . Disposable Subscriber ĊĊ Ċ /** Ċ Ġ* ĠAbstract Ġclass Ġfor Ġa ĠUse Case Ġthat Ġreturns Ġan Ġinstance Ġof Ġa Ġ[ Single ]. Ċ Ġ*/ Ċ abstract Ġclass ĠFlow able UseCase < T , Ġin ĠParams > Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġthread Executor : ĠThread Executor , ĊĠĠĠ Ġprivate Ġval Ġpost Execution Thread : ĠPost Execution Thread ) Ġ{ ĊĊĠ Ġprivate Ġval Ġdis pos ables Ġ= ĠComposite Disposable () ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠBuilds Ġa Ġ[ Single ] Ġwhich Ġwill Ġbe Ġused Ġwhen Ġthe Ġcurrent Ġ[ Flow able UseCase ] Ġis Ġexecuted . ĊĠĠ Ġ*/ ĊĠ Ġprotected Ġabstract Ġfun Ġbuild UseCase Observable ( params : ĠParams ? Ġ= Ġnull ): ĠFlow able < T > ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠExec utes Ġthe Ġcurrent Ġuse Ġcase . ĊĠĠ Ġ*/ ĊĠ Ġopen Ġfun Ġexecute ( observer : ĠDis posable Subscriber < T >, Ġparams : ĠParams ? Ġ= Ġnull ) Ġ{ ĊĠĠĠ Ġval Ġobservable Ġ= Ġthis . build UseCase Observable ( params ) ĊĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . from ( thread Executor )) ĊĠĠĠĠĠĠĠ Ġ. observe On ( post Execution Thread . scheduler ) Ġas ĠFlow able < T > ĊĠĠĠ Ġadd Disposable ( observable . subscribe With ( observer )) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠDispose Ġfrom Ġcurrent Ġ[ Composite Disposable ]. ĊĠĠ Ġ*/ ĊĠ Ġfun Ġdispose () Ġ{ ĊĠĠĠ Ġif Ġ(! dis pos ables . is Disposed ) Ġdis pos ables . dispose () ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠDispose Ġfrom Ġcurrent Ġ[ Composite Disposable ]. ĊĠĠ Ġ*/ ĊĠ Ġprivate Ġfun Ġadd Disposable ( dis posable : ĠDis posable ) Ġ{ ĊĠĠĠ Ġdis pos ables . add ( dis posable ) ĊĠ Ġ} Ċ }