package Ġio . github . leg ion 2 . to sca _ orche strator . to sca . model . resolved Ċ Ċ import Ġio . github . leg ion 2 . to sca _ orche strator . to sca . definitions . Interface Definition Ċ import Ġio . github . leg ion 2 . to sca _ orche strator . to sca . definitions . Notification Definition Ċ import Ġio . github . leg ion 2 . to sca _ orche strator . to sca . model . Type Resolver Ċ import Ġio . github . leg ion 2 . to sca _ orche strator . to sca . model . ref ine Or Add Ċ import Ġio . github . leg ion 2 . to sca _ orche strator . to sca . model . resolved . type . Resolved Interface Type Ċ Ċ data Ġclass ĠResolved Interface ( ĊĠĠĠ Ġval Ġtype : ĠResolved Interface Type , ĊĠĠĠ Ġval Ġinputs : ĠMap < String , ĠResolved Property > Ġ= Ġempty Map (), ĊĠĠĠ Ġval Ġoperations : ĠMap < String , ĠResolved Operation > Ġ= Ġempty Map (), ĊĠĠĠ Ġval Ġnotifications : ĠMap < String , ĠNotification Definition > Ġ= Ġempty Map () Ċ ) Ġ{ ĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġfrom ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinterface Definition : ĠInterface Definition , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġproperty Resolver Context : ĠProperty Resolver Context , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinterface Type Resolver : ĠType Resolver < Resolved Interface Type >, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoperation Resolver Context : ĠOperation Resolver Context ĊĠĠĠĠĠĠĠ Ġ): ĠResolved Interface Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinterface Definition . type ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠIllegalArgumentException (" Interface Ġmust Ġdeclare Ġa Ġtype Ġif Ġthey Ġdo Ġnot Ġref ine Ġan Ġexisting ĠInterface ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġinterface Type Ġ= Ġinterface Type Resolver ( interface Definition . type ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( interface Definition . deprecated Operations Syntax . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" deprecated ĠInterface Ġdefinition Ġwithout Ġ' operations ' Ġkey name Ġis Ġnot Ġsupported : Ġ$ interface Definition ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġinputs Ġ= Ġinterface Type . inputs . ref ine ( interface Definition . inputs . or Empty (), Ġproperty Resolver Context ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġoperations Ġ= Ġinterface Type . operations . add Implementation ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinterface Definition . operations . or Empty (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġproperty Resolver Context , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġoperation Resolver Context ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġnotifications Ġ= Ġinterface Type . notifications Ġ+ Ġinterface Definition . notifications . or Empty () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( notifications . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTODO (" notifications Ġare Ġnot Ġimplemented ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠResolved Interface ( interface Type , Ġinputs , Ġoperations , Ġempty Map ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ private Ġfun ĠResolved Interface . ref ine ( ĊĠĠĠ Ġinterface Definition : ĠInterface Definition , ĊĠĠĠ Ġexpression Resolver Context : ĠProperty Resolver Context , ĊĠĠĠ Ġinterface Type Resolver : ĠType Resolver < Resolved Interface Type >, ĊĠĠĠ Ġoperation Resolver Context : ĠOperation Resolver Context Ċ ): ĠResolved Interface Ġ{ ĊĠĠĠ Ġif Ġ( interface Definition . type Ġ!= Ġnull Ġ&& Ġinterface Type Resolver ( interface Definition . type ) Ġ!= Ġtype ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" The Ġtype Ġof Ġan ĠInterface Ġcan Ġnot Ġbe Ġchanged Ġby Ġre def ining Ġan ĠInterface ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġinputs Ġ= Ġinputs . ref ine ( interface Definition . inputs . or Empty (), Ġexpression Resolver Context ) ĊĠĠĠ Ġval Ġoperations Ġ= ĊĠĠĠĠĠĠĠ Ġoperations . ref ine ( interface Definition . operations . or Empty (), Ġexpression Resolver Context , Ġoperation Resolver Context ) ĊĠĠĠ Ġval Ġnotifications Ġ= Ġnotifications Ġ+ Ġinterface Definition . notifications . or Empty () ĊĠĠĠ Ġreturn ĠResolved Interface ( type , Ġinputs , Ġoperations , Ġnotifications ) Ċ } Ċ Ċ fun ĠMap < String , ĠResolved Interface >. ref ine ( ĊĠĠĠ Ġinterface Definitions : ĠMap < String , ĠInterface Definition >, ĊĠĠĠ Ġinterface Type Resolver : ĠType Resolver < Resolved Interface Type >, ĊĠĠĠ Ġproperty Resolver Context : ĠProperty Resolver Context , ĊĠĠĠ Ġoperation Resolver Context : ĠOperation Resolver Context Ċ ): ĠMap < String , ĠResolved Interface > Ġ{ ĊĠĠĠ Ġreturn Ġref ine Or Add ( ĊĠĠĠĠĠĠĠ Ġinterface Definitions , ĊĠĠĠĠĠĠĠ Ġ{ Ġref ine ( it , Ġproperty Resolver Context , Ġinterface Type Resolver , Ġoperation Resolver Context ) Ġ}, ĊĠĠĠĠĠĠĠ Ġ{ ĠResolved Interface . from ( it , Ġproperty Resolver Context , Ġinterface Type Resolver , Ġoperation Resolver Context ) Ġ}) Ċ } Ċ