-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeTheaterFacade.java
47 lines (43 loc) · 1.28 KB
/
HomeTheaterFacade.java
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package structural.facade;
public class HomeTheaterFacade {
private final DVDPlayer dvd;
private final Projector projector;
private final SoundSystem sound;
private final Lights lights;
public HomeTheaterFacade(DVDPlayer dvd, Projector projector, SoundSystem sound, Lights lights) {
this.dvd = dvd;
this.projector = projector;
this.sound = sound;
this.lights = lights;
}
public void watchMovie(String movie) throws InterruptedException {
Main.println("Getting ready to watch a movie...");
Thread.sleep(1000);
lights.dim();
Thread.sleep(1000);
projector.on();
Thread.sleep(1000);
projector.setInput("DVD");
Thread.sleep(1000);
sound.on();
Thread.sleep(1000);
sound.setVolume(10);
Thread.sleep(1000);
dvd.on();
Thread.sleep(1000);
dvd.play(movie);
Thread.sleep(1000);
}
public void endMovie() throws InterruptedException {
Main.println("Shutting movie theater down...");
Thread.sleep(1000);
dvd.off();
Thread.sleep(1000);
projector.off();
Thread.sleep(1000);
sound.off();
Thread.sleep(1000);
lights.on();
Thread.sleep(1000);
}
}