2 * DemosceneMusic - Track.java - Copyright © 2012 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.demoscenemusic.data;
20 import java.util.Collection;
21 import java.util.List;
25 * Default implementation of a track data container.
27 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
29 public class DefaultTrack extends DefaultBase implements Track {
32 * Creates a new track data container.
37 public DefaultTrack(String id) {
49 public String getName() {
50 return getValue("name", String.class).get();
57 public Track setName(String name) {
58 getValue("name", String.class).set(name);
66 @SuppressWarnings("unchecked")
67 public List<Artist> getArtists() {
68 return getValue("artists", List.class).get();
75 public Track setArtists(List<Artist> artists) {
76 getValue("artists", List.class).set(artists);
84 @SuppressWarnings("unchecked")
85 public Collection<Style> getStyles() {
86 return getValue("styles", Collection.class).get();
93 public Track setStyles(Collection<? extends Style> styles) {
94 getValue("styles", Collection.class).set(styles);
102 public String getRemix() {
103 return getValue("remix", String.class).get();
110 public Track setRemix(String remix) {
111 getValue("remix", String.class).set(remix);
119 @SuppressWarnings("unchecked")
120 public List<Artist> getRemixArtists() {
121 return getValue("remixArtists", List.class).get();
128 public Track setRemixArtists(List<Artist> remixArtists) {
129 getValue("remixArtists", List.class).set(remixArtists);
137 @SuppressWarnings("unchecked")
138 public Collection<TrackDerivative> getDerivatives() {
139 return getValue("derivatives", Collection.class).get();
146 public Track setDerivatives(Collection<TrackDerivative> derivatives) {
147 getValue("derivatives", Collection.class).set(derivatives);
155 @SuppressWarnings("unchecked")
156 public Map<Relationship, Collection<Track>> getRelatedTracks() {
157 return getValue("relatedTracks", Map.class).get();
164 public Track setRelatedTracks(Map<Relationship, Collection<Track>> relatedTracks) {
165 getValue("relatedTracks", Map.class).set(relatedTracks);
173 @SuppressWarnings("unchecked")
174 public Collection<Party> getParties() {
175 return getValue("parties", Collection.class).get();
182 public Track setParties(Collection<Party> parties) {
183 getValue("parties", Collection.class).set(parties);
195 public int hashCode() {
196 return getId().hashCode();
203 public boolean equals(Object object) {
204 if (!(object instanceof Track)) {
207 return ((Track) object).getId().equals(getId());