package MusicLandscape.util.formatters;
import MusicLandscape.entities.Track;package MusicLandscape.util.formatters;
import MusicLandscape.entities.Track;Implementation of the MyTrackFormatter abstract class.
Note: real CSV as specified in RFC 4180 is more complicated. The CSV that is compatible with Microsoft Excel looks even more different.
/**
* This class represents the concept of csv-formatting of a track.
*
* @author Jonas Altrock (ew20b126@technikum-wien.at)
* @version 1
* @since ExerciseSheet04
*/
public class MyCSVTrackFormatter extends MyTrackFormatter {
/**
* Creates a CSV format of a track.
* <p>
* The csv representation of a track is "title","performer","writer","year","duration"; (without quotes)<br>
* No new line is added at the end of the String!
*
* @param t the track to be formatted
* @return the formatted String representing the track
*/
@Override
public String format(Track t) {
return t.getTitle() +
"," +
t.getPerformer() +
"," +
t.getWriter() +
"," +
t.getYear() +
"," +
t.getDuration() +
";";
}
}