-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlbum.java
More file actions
60 lines (51 loc) · 1.16 KB
/
Album.java
File metadata and controls
60 lines (51 loc) · 1.16 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
import java.io.Serializable;
import java.util.ArrayList;
/**
* The Responder class keeping creating song
*
* @author omid mahyar and pouyan hesabi *
* @version 1.0 (1398/04/01)
*/
public class Album implements Serializable {
private String name;
private ArrayList<Song> songs = new ArrayList<>();
public Album(String name) {
this.name = name;
}
public String getName() {
return name;
}
/**
* Addingn a song to album
*
* @param song a Song for adding too album
*/
public void setSong(Song song) {
songs.add(song);
}
/**
* Removing a song to album
*
* @param song a Song for removing from album
*/
public void removeSong(Song song) {
songs.remove(song);
}
public void setNewName(String s) {
name = s;
}
/**
* replacing a song in album
*
* @param song a Song for replacing in album
*/
public void replace(Song song) {
if (!song.equals(songs.get(0))) {
songs.remove(song);
songs.add(0, song);
}
}
public ArrayList<Song> getSongs() {
return songs;
}
}