package Ġli rand . api . dsl . command . implementation . tree Ċ Ċ import Ġcom . moj ang . b rig ad ier . Command Ċ import Ġcom . moj ang . b rig ad ier . arguments . Argument Type Ċ import Ġcom . moj ang . b rig ad ier . context . Command Context Ċ import Ġcom . moj ang . b rig ad ier . suggestion . Suggestion Provider Ċ import Ġcom . moj ang . b rig ad ier . suggestion . Suggestions Builder Ċ import Ġcom . moj ang . b rig ad ier . tree . Argument Command Node Ċ import Ġcom . moj ang . b rig ad ier . tree . Command Node Ċ import Ġcom . moj ang . b rig ad ier . tree . Literal Command Node Ċ import Ġcom . moj ang . b rig ad ier . tree . Root Command Node Ċ import Ġli rand . api . dsl . command . implementation . tree . nodes . B rig ad ier Argument Ċ import Ġli rand . api . dsl . command . implementation . tree . nodes . B rig ad ier Literal Ċ import Ġjava . util . function . Predicate Ċ Ċ internal Ġopen Ġclass ĠMapper < T , ĠR > Ġ{ ĊĊ ĉ fun Ġmap Node ( node : ĠCommand Node < T >): ĠCommand Node < R > Ġ{ Ċĉ ĉ return Ġwhen Ġ( node ) Ġ{ Ċĉĉ ĉ is ĠArgument Command Node < *, Ġ*> Ġ-> Ġ{ Ċĉĉĉ ĉ map Argument Node ( node ) Ċĉĉ ĉ } Ċĉĉ ĉ is ĠLiteral Command Node < *> Ġ-> Ġ{ Ċĉĉĉ ĉ map Literal Node ( node ) Ċĉĉ ĉ } Ċĉĉ ĉ is ĠRoot Command Node < *> Ġ-> Ġ{ Ċĉĉĉ ĉ map Root Node ( node ) Ċĉĉ ĉ } Ċĉĉ ĉ else Ġ-> Ġ{ Ċĉĉĉ ĉ throw ĠIllegalArgumentException (" Unsupported Ġcommand , Ġ'${ node . name }' Ġof Ġtype : Ġ${ node . java Class . name }") Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ protected Ġfun Ġmap Argument Node ( node : ĠCommand Node < T >): ĠCommand Node < R > Ġ{ Ċĉ ĉ val Ġargument Ġ= Ġnode Ġas ĠArgument Command Node < T , Ġ*> ĊĊĉ ĉ return ĠB rig ad ier Argument ( Ċĉĉ ĉ argument . name , Ċĉĉ ĉ getType ( argument ), Ċĉĉ ĉ map Command ( argument ), Ċĉĉ ĉ map Requirement ( argument ), Ċĉĉ ĉ map Suggestions ( argument ) Ċĉ ĉ ) Ċ ĉ } ĊĊ ĉ protected Ġfun Ġmap Literal Node ( node : ĠCommand Node < T >): ĠCommand Node < R > Ġ{ Ċĉ ĉ return ĠB rig ad ier Literal ( node . name , Ġcommand Ġ= Ġmap Command ( node ), Ġrequirement Ġ= Ġmap Requirement ( node )) Ċ ĉ } ĊĊ ĉ protected Ġfun Ġmap Root Node ( node : ĠCommand Node < T >? ): ĠCommand Node < R > Ġ{ Ċĉ ĉ return ĠRoot Command Node () Ċ ĉ } ĊĊ ĉ protected Ġopen Ġfun ĠgetType ( node : ĠArgument Command Node < T , Ġ* >): ĠArgument Type < *> ? Ġ{ Ċĉ ĉ return Ġnode . type Ċ ĉ } ĊĊ ĉ protected Ġfun Ġmap Command ( node : ĠCommand Node < T >? ): ĠCommand < R > Ġ{ Ċĉ ĉ return ĠNONE Ġas ĠCommand < R > Ċ ĉ } ĊĊ ĉ protected Ġopen Ġfun Ġmap Requirement ( node : ĠCommand Node < T >): ĠPredicate < R > Ġ{ Ċĉ ĉ return ĠTRUE Ġas ĠPredicate < R > Ċ ĉ } ĊĊ ĉ protected Ġopen Ġfun Ġmap Suggestions ( node : ĠArgument Command Node < T , Ġ* >): ĠSuggest ion Provider < R >? Ġ{ Ċĉ ĉ return Ġnull Ċ ĉ } ĊĊ ĉ protected Ġcompanion Ġobject Ġ{ ĊĊĉ ĉ val ĠNONE : ĠCommand < Any > Ġ= ĠCommand Ġ{ Ġcontext : ĠCommand Context < Any > Ġ-> Ġ 0 Ġ} ĊĊĉ ĉ val ĠTRUE : ĠPredicate < Any > Ġ= ĠPredicate Ġ{ Ġsource : ĠAny Ġ-> Ġtrue Ġ} ĊĊĉ ĉ val ĠEMPTY : ĠSuggest ion Provider < Any > Ġ= Ċĉĉ ĉ Suggestion Provider Ġ{ Ġsuggestions : ĠCommand Context < Any >, Ġbuilder : ĠSuggest ions Builder Ġ-> Ġbuilder . build Future () Ġ} Ċ ĉ } Ċ }