阅读下列说明和Java代码,回答问题,将解答填入答题纸的对应栏内。
【说明】
某灯具厂商欲生产一个灯具遥控器,该遥控器具有7个可编程的插槽,每个插槽都有开关按钮,对应着一个不同的灯。利用该遥控器能够统一控制房间中该厂商所有品牌灯具的开关,现采用Command(命令)模式实现该遥控器的软件部分。Command模式的类图如下图所示。
【Java代码】
class Light { public Light() {} public Light(String name) { /* 代码省略 */ } public void on() { /* 代码省略 */ } // 开灯 public void off() { /* 代码省略 */ } // 关灯 // 其余代码省略} (1) { public void execute();} class LightOnCommandimplements Command { // 开灯命令 Light light; public LightOnCommand(Light light) {this.light=light; } public void execute() { (2) ; }}class LightOffCommandimplements Command { // 关灯命令 Light light; public LightOffCommand(Light light) {this.light=light; } public void execute(){ (3) ; }}class RemoteControl { //遥控器 Command[] onCommands=new Command[7]; Command[] offCommands=new Command[7]; public RemoteControl() { /* 代码省略 */ } public void setCommand(int slot, CommandonCommand, Command offCommand) { (4) =onCommand; (5) =offCommand; } public void onButtonWasPushed(int slot) { (6) ; } public void offlButtonWasPushed(int slot){ (7) ; }}class RemoteLoader { public static void main(String[] args) { RemoteControl remoteControl=newRemoteControl(); Light livingRoomLight=newLight("Living Room"); Light kitchenLight=newLight("kitchen"); LightOnCommand livingRoomLightOn=newLightOnCommand(livingRoomLight); LightOffCommand livingRoomLightOff=newLightOffCommand(livingRoomLight); LightOnCommand kitchenLightOn=newLightOnCommand(kitchenLight); LightOffCommand kitchenLightOff=newLightOffCommand(kitchenLight); remoteControl.setCommand(0,livingRoomLightOn, livingRoomLightOff); remoteControl.setCommand(1, kitchenLightOn,kitchenLightOff); remoteControl.onButtonWasPushed(0); remoteControl.offButtonWasPushed(0); remoteControl.onButtonWasPushed(1); remoteControl.offButtonWasPushed(1); }}
(1)interface Command
(2)light.on()
(3)light.off()
(4)onCommands[slot]
(5)offCommands[slot]
(6)onCommands[slot].execute()
(7)offCommands[slot].execute()
( )is the process of transforming information so it is unintelligible to anyone but the intended recipient.
As each application module is completed,it undergoes( )to ensure that it operates correctly and reliably.
( )algorithm specifies the way to arrange data in a particular order.
After analyzing the source code,( )generates machine instructions that will carry out the meaning of the program at a later time.
( )can help organizations to better understand the information contained within the data and will also help identify the data that is most important to the business and future business decisions.
浏览器开启无痕浏览模式后,( )依然会被保存下来。
下列协议中,不属于TCP/IP协议簇的是( )。
下列传输介质中,带宽最宽、抗干扰能力最强的是( )。
数控编程常需要用参数来描述需要加工的零件的图形。在平面坐标系内,确定一个点需要2个独立的参数,确定一个正方形需要( )个独立的参数。
某书的页码为1,2,3,...,共用数字900个(一个多位数页码包含多个数字),据此可以推断,该书最大的页码为( )。