package Ġnam . tran . command Ċ Ċ class ĠRemote Control Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġon Command Ġ= ĠarrayOf < Command >( No Command (), No Command (), No Command (), No Command (), No Command (), No Command (), No Command ()) ĊĠĠĠ Ġprivate Ġvar Ġoff Command Ġ= ĠarrayOf < Command >( No Command (), No Command (), No Command (), No Command (), No Command (), No Command (), No Command ()) ĊĠĠĠ Ġprivate Ġvar Ġundo Command Ġ: ĠCommand Ġ= ĠNo Command () ĊĊĠĠĠ Ġfun Ġset Command ( slot : ĠInt , Ġon Command : ĠCommand , Ġoff Command : ĠCommand ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . on Command [ slot ] Ġ= Ġon Command ĊĠĠĠĠĠĠĠ Ġthis . off Command [ slot ] Ġ= Ġoff Command ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠonPress ( slot : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġon Command [ slot ]. exc ute () ĊĠĠĠĠĠĠĠ Ġundo Command Ġ= Ġon Command [ slot ] ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġoff Press ( slot : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoff Command [ slot ]. exc ute () ĊĠĠĠĠĠĠĠ Ġundo Command Ġ= Ġoff Command [ slot ] ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġundo Press (){ ĊĠĠĠĠĠĠĠ Ġundo Command . undo () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= ĠStringBuffer () ĊĠĠĠĠĠĠĠ Ġresult . append (" ----- ĠRemote ĠControl Ġ----- \ n ") ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġon Command . indices ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresult . append ("[ slot Ġ$ i ] Ġ${ on Command [ i ]. java Class . name } Ġ- Ġ${ off Command [ i ]. java Class . name }\ n ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġresult . append (" undo ĠCommand Ġ- Ġ${ undo Command . java Class . name }") ĊĠĠĠĠĠĠĠ Ġreturn Ġresult . toString () ĊĠĠĠ Ġ} Ċ }