Help me implement these in playlistImpl

The user needs to be able to:

* Create playlists
* Delete playlists
* Edit playlists
* play playlists

com.xxx.iopackage.inputstreams.mp3player.playlist.PlayList

com.xxx.iopackage.inputstreams.mp3player.playlist.PlayListImpl

PlayList.java

package com.xxx.iopackage.inputstreams.mp3player.playlist;

import java.io.File;
import java.util.LinkedHashSet;


/**
 * Models a playlist of MP3. A Playlist is a group of mp3s which are played
 * one after another. 
 */
public interface PlayList {

    /**
     * Adds a mp3 to the playlist
     * 
     * @param mp3
     */
    public void addMp3( File mp3 );
    
    
    /**
     * Gets the Mp3 as a LinkedHashSet. A LinkedHashSet returns the elements
     * in the order they were added to the LinkedHashSet
     * 
     * @return list of Mp3 for this playlist
     */
    public LinkedHashSet<File> getMp3PlayList();
  
    
    /**
     * Removes a mp3 from the playlist
     * 
     * @param mp3 the mp3 to remove from the playlist
     */
    public void removeFromPlayList( File mp3 ); 
    
    
    /**
     * Removes all mp3 from the playlist 
     */
    public void removeAllMp3FromPlaylist();
    
    
    /**
     * Sets the name of the mp3 playlist
     * 
     * @param playListName the name of the playlist
     */
    public void setName( String playListName );
    
    
    /**
     * Gets the name of the mp3 playlist
     * 
     * @return the name of the mp3 playlist
     */
    public String getPlayListName();
}






[U]PlayListImpl.java[/U]


package com.xxx.iopackage.inputstreams.mp3player.playlist;

import java.io.File;
import java.util.LinkedHashSet;

/**
 * Class modelling a playlist of Mp3 tunes
 * 
  */
public class PlayListImpl implements PlayList {

    /**
     * Constructor 
     */
    public PlayListImpl() {
        
        super();
    }

    /* (non-Javadoc)
     * @see com.xxx.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#addMp3(java.io.File)
     */
    public void addMp3( File mp3 ) {
        
        // YOU NEED TO IMPLEMENT THIS METHOD
    }

    
    /* (non-Javadoc)
     * @see com.xxx.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#getMp3PlayList()
     */
    public LinkedHashSet<File> getMp3PlayList() {
        
        // YOU NEED TO IMPLEMENT THIS METHOD
        return null;
    }

    
    /* (non-Javadoc)
     * @see com.xxx.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#getPlayListName()
     */
    public String getPlayListName() {
        
        // YOU NEED TO IMPLEMENT THIS METHOD
        return null;
    }

    
    /* (non-Javadoc)
     * @see com.xxx.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#removeAllMp3FromPlaylist()
     */
    public void removeAllMp3FromPlaylist() {
        
        // YOU NEED TO IMPLEMENT THIS METHOD
    }

    
    /* (non-Javadoc)
     * @see com.xxx.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#removeFromPlayList(java.io.File)
     */
    public void removeFromPlayList( File mp3 ) {
        
        // YOU NEED TO IMPLEMENT THIS METHOD
    }

    
    /* (non-Javadoc)
     * @see com.xxx.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#setName(java.lang.String)
     */
    public void setName( String playListName ) {
        
        // YOU NEED TO IMPLEMENT THIS METHOD
    }
}

Mate. I was searching google with the same problem, I was looking for a shortcut just like you. Funny huh! but I think I might be able to help you coz I'm doing this java course and your problem is exactly the same problem I have. Give me a day or two from now and I will send you the solution. But if you get the result before I do, please post it.
this is where I've reached so far, and it is running

/*
 * @author JDickerson
 * Created on 17 Oct 2008
 */
package com.jjpeople.iopackage.readerwriter.mp3player.playlist;

import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.LinkedHashSet;

/**
 * Class modelling a playlist of Mp3 tunes
 * 
 * @author JDickerson
 * Created on 17 Oct 2008
 */
public class PlayListImpl implements PlayList {

    /**
     * Constructor 
     */
    public PlayListImpl() {

        super();
    }

    /* (non-Javadoc)
     * @see com.jjpeople.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#addMp3(java.io.File)
     */
    public void addMp3( File mp3 ) {

        // YOU NEED TO IMPLEMENT THIS METHOD
    }


    /* (non-Javadoc)
     * @see com.jjpeople.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#getMp3PlayList()
     */
    public LinkedHashSet<File> getMp3PlayList() {

        // YOU NEED TO IMPLEMENT THIS METHOD
        return null;
    }


    /* (non-Javadoc)
     * @see com.jjpeople.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#getPlayListName()
     */
    public String getPlayListName() {

        // YOU NEED TO IMPLEMENT THIS METHOD
        //Get the name and pass to the method that creates a new playlist
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

        System.out.println("PLEASE ENTER THE NAME OF YOUR PLAYLIST: ");

        try {
            String playListName = bufferedReader.readLine();
            setName(playListName);  
            }
        catch (IOException e) {
        }       

        return null;
    }


    /* (non-Javadoc)
     * @see com.jjpeople.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#removeAllMp3FromPlaylist()
     */
    public void removeAllMp3FromPlaylist() {

        // YOU NEED TO IMPLEMENT THIS METHOD
    }


    /* (non-Javadoc)
     * @see com.jjpeople.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#removeFromPlayList(java.io.File)
     */
    public void removeFromPlayList( File mp3 ) {

        // YOU NEED TO IMPLEMENT THIS METHOD
    }


    /* (non-Javadoc)
     * @see com.jjpeople.iopackage.inputstreams.mp3player.playlist.
     *          PlayList#setName(java.lang.String)
     */
    public void setName( String playListName ) {

        // YOU NEED TO IMPLEMENT THIS METHOD
        //Create a new file. text or binary. I think binary. with the name playListName

        String userHomeDirPath = System.getProperty( "user.dir" );
        File userHomeDirectory = new File(userHomeDirPath);
        File playListDirectory = new File(userHomeDirectory, "MP3_PLAYLISTS" );

        if ( ! playListDirectory.exists() ) {

            if ( ! playListDirectory.mkdir() ) {

                System.out.println(
                        "Could not make directory, " +
                            playListDirectory.getAbsolutePath() );
            }
        }
    }
}

Cheers!

check vector/list :add(),remove(),clear() and so on.
put the codes together by urself and u will be happy and satisfied.happy coding and lets meet in the next stage.am also doing the exercise and still struggling to join the dick puzzles .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.