Name: OP, the faggot 2012-06-10 7:51
Hey /prog/, I need some orientation!
I am new to Java, learning it since begin of semester. We were given an assignment where we have to simulate a Music Library. Each Artist have Albums, and Albums have Songs. It could be that there are more than one song with the same name but from different artists. My problem is with the complexity of the data administration. We have to parse all this info from .dat files (Album.dat, Artist.dat, Songs.dat) not only with names but with Artist-ID and Album-ID too! I though "yeah, this could be helpful- I can use this as Key in a TreeMap or whatever", thing is, I was thinking of making a HashMap of Artists using Artist-ID as Key, where each Artist contains Albums, and each album contains a Set of Songs, BUT, I know (and understand) it should work the whole way around! Songs contain Albums and Artist, along name Bitrate, etc. Why? Objects look like this:
<code>public class Artist {
private String name;
private String style; // Set of strings
private String website;
}
public class Album {
private String mainArtist;
private String name;
private int numberOfTracks;
private String label;
}
public class Songs {
private Artist artist;
private Album album;
private String titel;
private int trackNumber;
private String format;
private int lenght; // seconds
private int bitrate; // beats per minute
}</code>
Now, if the data in the .dat files look like this, e.g.:
<code>//File: artist.dat
//Columns: Artist-ID; Name; Style; Website;
1;Vangelis;new age,electronic;-;
2;Jean-Michel Jarre;electronic;http://www.jeanmicheljarre.com/</code>;
<code>//File: albums.dat
//Columns: Album-ID; Artist-ID; Name; Number Tracks; Label;
1;1;Chariots Of Fire;7;Polydor;
2;1; 1492: Conquest of Paradise;12;Atlantic;
3;2;Aero;20;Wea;
4;2;Equinoxe;8;Dreyfus;</code>
<code>//File: songs.dat
//Columns: Artist-ID; Album-ID; Title; Track Number; Format; Length; Bitrate
1;1;Titles;1;mp3;213;192kbps;
2;4; Equinoxe Part 1;1;mp3;143;192kbps;</code>
which Collection(s) should I use
>implying I do have to use both IDs, but maybe you, kind sir have a better idea
and how, please tell me how, can I use the collection(s) in order to store all elements. I thought about ignoring IDs, but as you can see, there is no artist-names in albums.dat and songs.dat. Help please!
I am new to Java, learning it since begin of semester. We were given an assignment where we have to simulate a Music Library. Each Artist have Albums, and Albums have Songs. It could be that there are more than one song with the same name but from different artists. My problem is with the complexity of the data administration. We have to parse all this info from .dat files (Album.dat, Artist.dat, Songs.dat) not only with names but with Artist-ID and Album-ID too! I though "yeah, this could be helpful- I can use this as Key in a TreeMap or whatever", thing is, I was thinking of making a HashMap of Artists using Artist-ID as Key, where each Artist contains Albums, and each album contains a Set of Songs, BUT, I know (and understand) it should work the whole way around! Songs contain Albums and Artist, along name Bitrate, etc. Why? Objects look like this:
<code>public class Artist {
private String name;
private String style; // Set of strings
private String website;
}
public class Album {
private String mainArtist;
private String name;
private int numberOfTracks;
private String label;
}
public class Songs {
private Artist artist;
private Album album;
private String titel;
private int trackNumber;
private String format;
private int lenght; // seconds
private int bitrate; // beats per minute
}</code>
Now, if the data in the .dat files look like this, e.g.:
<code>//File: artist.dat
//Columns: Artist-ID; Name; Style; Website;
1;Vangelis;new age,electronic;-;
2;Jean-Michel Jarre;electronic;http://www.jeanmicheljarre.com/</code>;
<code>//File: albums.dat
//Columns: Album-ID; Artist-ID; Name; Number Tracks; Label;
1;1;Chariots Of Fire;7;Polydor;
2;1; 1492: Conquest of Paradise;12;Atlantic;
3;2;Aero;20;Wea;
4;2;Equinoxe;8;Dreyfus;</code>
<code>//File: songs.dat
//Columns: Artist-ID; Album-ID; Title; Track Number; Format; Length; Bitrate
1;1;Titles;1;mp3;213;192kbps;
2;4; Equinoxe Part 1;1;mp3;143;192kbps;</code>
which Collection(s) should I use
>implying I do have to use both IDs, but maybe you, kind sir have a better idea
and how, please tell me how, can I use the collection(s) in order to store all elements. I thought about ignoring IDs, but as you can see, there is no artist-names in albums.dat and songs.dat. Help please!