英语翻译大哥大姐们帮我翻译下这段短文,可以用软件翻译,但是希望能帮我整理成通顺的句子,Demultiplexing.A class can implement a specific method from an interface only once.If the same object is going to listen to mul

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 01:54:08
英语翻译大哥大姐们帮我翻译下这段短文,可以用软件翻译,但是希望能帮我整理成通顺的句子,Demultiplexing.A class can implement a specific method from an interface only once.If the same object is going to listen to mul

英语翻译大哥大姐们帮我翻译下这段短文,可以用软件翻译,但是希望能帮我整理成通顺的句子,Demultiplexing.A class can implement a specific method from an interface only once.If the same object is going to listen to mul
英语翻译
大哥大姐们帮我翻译下这段短文,可以用软件翻译,但是希望能帮我整理成通顺的句子,
Demultiplexing.A class can implement a specific method from an interface only once.If the same object is going to listen to multiple sources of the same event,but the reaction should be different based on the source,the implementation of the listener method has to change for every new source and the method will become bloated with large switch statements.Here the Adapter pattern is used to demultiplex.That means an Adapter instance is created for every event source and that instance is registered with the source.When the listener method gets called,the Adapter invokes another method on the actual listener,a different method for each different source.
Now the actual listener no longer needs to determine where the event came from.That is the responsibility of the adapter.
Connect a source and a listener.This is useful when the event source and actual listener are of different event types.Its functionality is essentially that of the “true” Adapter ,as described in the Adapter pattern.

英语翻译大哥大姐们帮我翻译下这段短文,可以用软件翻译,但是希望能帮我整理成通顺的句子,Demultiplexing.A class can implement a specific method from an interface only once.If the same object is going to listen to mul
多路解编.类可能只一次执行从接口的一个具体方法.如果同一个对象听同一个事件的复合源,但是根据来源应该是不同的反应,听众方法的实施必须为每个新的来源改变,并且方法将变得膨胀与大开关语句.这里适配器样式被用于多路解编.那意味适配器事例为每个事件来源被创造,并且那个事例向来源登记.当听众方法接到呼叫时,适配器祈求在实际听众的另一个方法,每个另外来源的一个不同的方法.实际听众不再需要确定的Now事件何处来自.那是适配器的责任.
Connect来源和听众.当事件来源和实际听众是不同的事件类型时,这是有用的.它的功能本质上是那“true”适配器,正如适配器样式所描述.