-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientListener.java
More file actions
92 lines (67 loc) · 2.76 KB
/
ClientListener.java
File metadata and controls
92 lines (67 loc) · 2.76 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
public class ClientListener {
public static void main(String[] args) {
//Creating instances of SongLibrary, a MusicPlayer, and an AdvancedControl
SongLibrary myLibrary = new SongLibrary();
MusicPlayer vlc = new MusicPlayer(myLibrary);
AdvancedControl controls = new AdvancedControl(myLibrary);
//creating songs
Song song1 = new Song("Don't Stop Me Now", "Queen", 5*60,1978);
Song song2 = new Song("Doctor Who Opening 9 Season", "Murray Gold", 60,2018);
Song song3 = new Song("Smells Like Teen Spirit", "Nirvana", 5*60+1,1991);
Song song4 = new Song("William Tell Overture", "Rossini", 3*60+6,1829);
Song song5 = new Song("Colgera's Theme", "Hajime Wakai", 3*60,2023);
Song song6 = new Song("Bohemian Rhapsody", "Queen", 6*60,1975);
Song song7 = new Song("Francesca", "Hozier", 4*60+30,2023);
Song song8 = new Song("London Calling", "The Clash", 3*60+20,1979);
Song song9 = new Song("Clara's Theme", "Murray Gold",3*60+24,2013);
Song song10 = new Song("Another One Bites the Dust", "Queen", 3*60+34,1980);
//adding the songs to the instance of the library
myLibrary.addSong(song1);
myLibrary.addSong(song2);
myLibrary.addSong(song3);
myLibrary.addSong(song4);
myLibrary.addSong(song5);
myLibrary.addSong(song6);
myLibrary.addSong(song7);
myLibrary.addSong(song8);
myLibrary.addSong(song9);
myLibrary.addSong(song10);
//using the "vlc" player
vlc.playMusic();
vlc.switchMode();
vlc.nextSong();
vlc.playMusic();
vlc.switchMode();
vlc.switchMode();
vlc.nextSong();
vlc.playMusic();
vlc.nextSong();
vlc.playMusic();
vlc.nextSong();
vlc.playMusic();
vlc.prevSong();
vlc.playMusic();
vlc.switchMode();
vlc.playMusic();
//Demostration of the AdvancedControl controls -- Sorter
controls.sortByTitle();
vlc.playMusic();
controls.sortByAuthor();
vlc.playMusic();
controls.sortByYear();
vlc.playMusic();
System.out.println("Controls = Find songs by Queen");
//Demostration of the AdvancedControl controls -- Finder
controls.findByWhom("Queen");
vlc.playMusic();
System.out.println("Back to library");
controls.backToLibrary();
vlc.playMusic();
System.out.println("Controls = Find songs by The Beatles");
controls.findByWhom("The Beatles");
vlc.playMusic();
System.out.println("Back to library");
controls.backToLibrary();
controls.findAllAuthors();
}
}