-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlbums.java
More file actions
46 lines (41 loc) · 1.15 KB
/
Copy pathAlbums.java
File metadata and controls
46 lines (41 loc) · 1.15 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
import java.io.Serializable;
import java.util.ArrayList;
/**
* The Responder class keeping creating Album for better serialize
*
* @author omid mahyar and pouyan hesabi *
* @version 1.0 (1398/04/05)
*/
public class Albums implements Serializable {
private ArrayList<Album> albumArrayList = new ArrayList<>();
public void setAlbum(Album a) {
albumArrayList.add(a);
}
/**
* replacing a album in albums
*
* @param album a Album for replacing when album cliced
*/
public void replace(Album album) {
if (!album.equals(albumArrayList.get(0))) {
albumArrayList.remove(album);
albumArrayList.add(0, album);
}
}
/**
* removing a album from albums
*
* @param name a string for founding album
*/
public void removeAlbum(String name) {
for (int i = 0; i < albumArrayList.size(); i++) {
if (albumArrayList.get(i).getName().equals(name)) {
albumArrayList.remove(albumArrayList.get(i));
break;
}
}
}
public ArrayList<Album> getAlbumArrayList() {
return albumArrayList;
}
}