/* ĠGenerated Ġby ĠAN ĠDIS I ĠUni bo Ġ*/ Ġ Ċ package Ġit . uni bo . smart bell Ċ Ċ import Ġit . uni bo . k actor .* Ċ import Ġalice . tup ro log .* Ċ import Ġkotlinx . coroutines . Coroutine Scope Ċ import Ġkotlinx . coroutines . delay Ċ import Ġkotlinx . coroutines . launch Ċ import Ġkotlinx . coroutines . run Blocking Ċĉ Ċ class ĠSmart bell Ġ( Ġname : ĠString , Ġscope : ĠCor outine Scope Ġ Ġ) Ġ: ĠActor Basic F sm ( Ġname , Ġscope Ġ){ ĊĊ ĉ override Ġfun Ġget InitialState () Ġ: ĠString { Ċĉ ĉ return Ġ" s 0 " Ċ ĉ } Ċ ĉ @ kotlin x . coroutines . Obsolete Cor outines Api Ċ ĉ @ kotlin x . coroutines . Experimental Cor outines Api ĉĉĉ Ċ ĉ override Ġfun Ġget Body () Ġ: Ġ( Actor Basic F sm . () Ġ-> ĠUnit ){ ĊĉĉĠ Ċĉĉĉ ĉ val ĠTemp _ max Ġ= Ġ 3 7 . 5 Ċĉĉĉ ĉ var ĠID _ client Ġ= Ġ 1 ĠĊĉĉĉ ĉ var ĠN _ client _ rejected Ġ= Ġ 0 Ċĉĉĉ ĉ var ĠClient Temp Ġ: Double Ġ= Ġ 0 . 0 Ċĉ ĉ return Ġ{ Ġ// this : Action B asci F sm Ċĉĉĉ ĉ state (" s 0 ") Ġ{ Ġ// this : State Ċĉĉĉĉ ĉ action Ġ{ Ġ// it : State Ċĉĉĉĉĉ ĉ println (" smart bell Ġĉ ĉ || ĠSTART ") Ċĉĉĉĉĉ ĉ update Resource Rep ( Ġ" START " ĠĠ Ċĉĉĉĉĉ ĉ ) Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ Ġtransition ( Ġedge Name =" goto ", target State =" wait Ring ", Ġcond = dos witch () Ġ) Ċĉĉĉ ĉ } ĉ ĠĊĉĉĉ ĉ state (" wait Ring ") Ġ{ Ġ// this : State Ċĉĉĉĉ ĉ action Ġ{ Ġ// it : State Ċĉĉĉĉĉ ĉ println (" smart bell Ġĉ ĉ || Ġwait Ring ") Ċĉĉĉĉĉ ĉ update Resource Rep ( Ġ" wait Ring " ĠĠ Ċĉĉĉĉĉ ĉ ) Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ Ġtransition ( edge Name =" t 0 1 9 ", target State =" check Temp Client ", cond = when Request (" client Ring Entry Request ")) Ċĉĉĉĉ ĉ transition ( edge Name =" t 0 2 0 ", target State =" end State ", cond = when Dispatch (" end ")) Ċĉĉĉ ĉ } ĉ ĠĊĉĉĉ ĉ state (" check Temp Client ") Ġ{ Ġ// this : State Ċĉĉĉĉ ĉ action Ġ{ Ġ// it : State Ċĉĉĉĉĉĉ ĠClient Temp Ġ= Ġkotlin . math . round ( Ġ Ġ( Math . random ()* 6 + 3 5 )* 1 0 Ġ) / 1 0 ĠĠ Ċĉĉĉĉĉ ĉ println (" smart bell Ġĉ ĉ || Ġcheck Temp Client ") Ċĉĉĉĉĉ ĉ update Resource Rep ( Ġ" check Temp Client " ĠĠ Ċĉĉĉĉĉ ĉ ) Ċĉĉĉĉĉ ĉ if ( Ġ ĠClient Temp Ġ< ĠTemp _ max ĠĠ Ċĉĉĉĉĉĉ Ġ){ println (" smart bell Ġĉ ĉ || Ġcliente Acc ett ato Da Smart B ell Ġ|| Ġtemp er atura Ġ= Ġ$ Client Temp Ġ|| Ġid _ client Ġ= Ġ$ ID _ client ") Ċĉĉĉĉĉ ĉ request (" smart bell Entry Request ", Ġ" smart bell Entry Request ($ ID _ client )" Ġ," wait erm ind " Ġ) ĠĠ Ċĉĉĉĉĉĉ ĠID _ client ++ ĠĠ Ċĉĉĉĉĉ ĉ } Ċĉĉĉĉĉ ĉ else Ċĉĉĉĉĉĉ Ġ{ println (" smart bell Ġĉ ĉ || Ġcliente R ifi ut ato Da Smart B ell Ġ|| Ġtemp er atura Ġ= Ġ$ Client Temp ") Ċĉĉĉĉĉĉ Ġforward (" smart bell Client Rejected ", Ġ" smart bell Client Rejected ($ Client Temp )" Ġ," smart bell " Ġ) ĠĊĉĉĉĉĉĉ Ġ} Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ Ġtransition ( edge Name =" t 1 2 1 ", target State =" check Wait er Reply ", cond = when Reply (" smart bell Entry Reply ")) Ċĉĉĉĉ ĉ transition ( edge Name =" t 1 2 2 ", target State =" client Rejected ", cond = when Dispatch (" smart bell Client Rejected ")) Ċĉĉĉ ĉ } ĉ ĠĊĉĉĉ ĉ state (" check Wait er Reply ") Ġ{ Ġ// this : State Ċĉĉĉĉ ĉ action Ġ{ Ġ// it : State Ċĉĉĉĉĉ ĉ if ( Ġcheck Msg Content ( ĠTerm . create Term (" smart bell Entry Reply ( ID )"), ĠTerm . create Term (" smart bell Entry Reply ( ID )"), ĠĊĉĉĉĉĉĉ ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcurrent Msg . msg Content ()) Ġ) Ġ{ Ġ// set Ġmsg Arg List Ċĉĉĉĉĉĉĉ ĉ println (" smart bell Ġĉ ĉ || Ġr ice v uta Ġreply ĠID Ġ: Ġ${ Ġpayload Arg ( 0 ) Ġ} ") Ċĉĉĉĉĉĉĉ ĉ answer (" client Ring Entry Request ", Ġ" client Ring Entry Reply ", Ġ" client Ring Entry Reply (${ payload Arg ( 0 )}) " ĠĠ Ġ) ĠĠ Ċĉĉĉĉĉ ĉ } Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ Ġtransition ( Ġedge Name =" goto ", target State =" wait Ring ", Ġcond = dos witch () Ġ) Ċĉĉĉ ĉ } ĉ ĠĊĉĉĉ ĉ state (" client Rejected ") Ġ{ Ġ// this : State Ċĉĉĉĉ ĉ action Ġ{ Ġ// it : State Ċĉĉĉĉĉĉ ĠN _ client _ rejected ++ ĠĠ Ċĉĉĉĉĉ ĉ if ( Ġcheck Msg Content ( ĠTerm . create Term (" smart bell Client Rejected ( TEMP )"), ĠTerm . create Term (" smart bell Client Rejected ( TEMP )"), ĠĊĉĉĉĉĉĉ ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcurrent Msg . msg Content ()) Ġ) Ġ{ Ġ// set Ġmsg Arg List Ċĉĉĉĉĉĉĉ ĉ answer (" client Ring Entry Request ", Ġ" client Ring Entry Reply ", Ġ" client Ring Entry Reply ( payload Arg ( 0 )) " ĠĠ Ġ) ĠĠ Ċĉĉĉĉĉ ĉ } Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ Ġtransition ( Ġedge Name =" goto ", target State =" wait Ring ", Ġcond = dos witch () Ġ) Ċĉĉĉ ĉ } ĉ ĠĊĉĉĉ ĉ state (" end State ") Ġ{ Ġ// this : State Ċĉĉĉĉ ĉ action Ġ{ Ġ// it : State Ċĉĉĉĉĉ ĉ println (" smart bell Ġĉ ĉ || ĠEND ") Ċĉĉĉĉĉ ĉ terminate ( 0 ) Ċĉĉĉĉ ĉ } Ċĉĉĉ ĉ } ĉ ĠĊĉĉ ĉ } Ċĉ ĉ } Ċ } Ċ