-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFullPlaylistMode.java
More file actions
39 lines (32 loc) · 1.24 KB
/
FullPlaylistMode.java
File metadata and controls
39 lines (32 loc) · 1.24 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
/**ConcreteStateA implements MyDisplay*/
public class FullPlaylistMode implements MyDisplay{
private SongLibrary songlib;
private String modeTitle = "FullPlaylist";
public FullPlaylistMode(SongLibrary sl){
this.songlib = sl;
}
/** This implementation allows to print the full playlist every time
* a song is played, through the method `private void printAllList()`
* of the same class.
* @param s : Song that needs to be visualized at the end of the printed
* playlist.
*/
public void visualize(Song s){
System.out.println("Printing library...");
printAllList();
System.out.println(songlib.getWhereInList()+1 + " ------ " +s);
System.out.println("-----\n");
}
public String getModeTitle() {
return modeTitle;
}
private void printAllList(){
int i = 1;
System.out.println("-----");
for (Song song : songlib.getMyLibrary()){
System.out.println(i + " -- " + song.getTitle() + " by " + song.getAuthor());
i++;
}
System.out.println("-----");
}
}