4 import interfaces
.Album
;
5 import interfaces
.HasMetadata
;
7 import java
.io
.IOException
;
8 import java
.io
.InputStream
;
9 import java
.util
.HashMap
;
12 public abstract class Track
implements HasMetadata
{
15 private final long persistentId
;
17 private final Map
<Integer
, Object
> tags
= new HashMap
<Integer
, Object
>();
19 public Track(int id
, long persistentId
) {
21 this.persistentId
= persistentId
;
22 this.tags
.put(1835624804, id
);
23 this.tags
.put(1836082546, persistentId
);
30 public long persistentId() {
34 public boolean equals(Object o
) {
35 if (o
instanceof Track
) {
36 return ((Track
)o
).persistentId
== this.persistentId
;
41 public int hashCode() {
42 return ((Long
)persistentId
).hashCode();
45 public Album
getAlbum() {
49 public void setAlbum(Album album
) {
53 public Object
get(int tag
) {
57 public void put(int tag
, Object value
) {
61 public Iterable
<Integer
> getAllTags() {
66 * Returns the track as a playable stream of data.
68 * @return A stream, possibly null
71 public abstract InputStream
getStream() throws IOException
;
73 public interface TrackFactory
{
74 public Track
create(int id
, long persistentId
);