3 import interfaces
.Album
;
4 import interfaces
.Constants
;
5 import interfaces
.Track
;
7 import java
.io
.IOException
;
8 import java
.util
.ArrayList
;
10 public class CollectionTrack
implements Track
{
12 private final Track track
;
13 private final int container
;
14 private final int containerItemId
;
16 public CollectionTrack(Track track
, int container
, int containerItemId
) {
18 this.container
= container
;
19 this.containerItemId
= containerItemId
;
22 public int hashCode() {
26 public boolean equals(Object o
) {
27 if (o
== this) return true;
28 else if (o
instanceof Track
) {
29 return ((Track
)o
).id() == track
.id();
34 public Object
get(Constants tag
) {
36 case dmap_containeritemid
:
37 return containerItemId
;
38 case dmap_parentcontainerid
:
41 return track
.get(tag
);
45 public Object
get(Constants tag
, Object defaultValue
) {
46 Object ret
= get(tag
);
55 public Album
getAlbum() {
56 return track
.getAlbum();
59 public Iterable
<Constants
> getAllTags() {
60 ArrayList
<Constants
> tags
= new ArrayList
<Constants
>();
61 for (Constants c
: track
.getAllTags()) {
64 tags
.add(Constants
.dmap_containeritemid
);
65 tags
.add(Constants
.dmap_parentcontainerid
);
69 public void getStream(StreamReader reader
) throws IOException
{
70 track
.getStream(reader
);
77 public long persistentId() {
78 return track
.persistentId();
81 public void put(Constants tag
, Object value
) {
82 track
.put(tag
, value
);
85 public void setAlbum(Album album
) {
86 track
.setAlbum(album
);
89 public String
toString() {
90 return track
.toString();