-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
33 lines (20 loc) · 963 Bytes
/
Copy pathTest.java
File metadata and controls
33 lines (20 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package TheCommandPattern;
public class Test {
public static void main(String[] args){
RemoteControl remoteControl = new RemoteControl();
Light light_1 = new Light();
Light light_2 = new Light();
Stereo stereo = new Stereo();
LightOnCommand lightOnCommand = new LightOnCommand(light_1);
LightOffCommand lightOffCommand = new LightOffCommand(light_1);
LightOnCommand lightOnCommand_1 = new LightOnCommand(light_2);
LightOffCommand lightOffCommand_1 = new LightOffCommand(light_2);
SteroOnWithCD steroOnWithCD = new SteroOnWithCD(stereo);
remoteControl.setCommand(0,lightOnCommand,lightOffCommand);
remoteControl.setCommand(1,lightOnCommand_1,lightOffCommand_1);
remoteControl.setCommand(2,steroOnWithCD,null);
remoteControl.offButtonWasPushed(1);
remoteControl.onButtonWasPushed(1);
remoteControl.onButtonWasPushed(2);
}
}