Examples of Song


Examples of Database.Primitives.Song

    private void formatSong(String dataLine) {
        //song\trating
        int[] splitData = strArrayToIntArray(dataLine.split("\t"));
        if (splitData.length == 2) {
            Song newSong;
            if (songs.containsSong(splitData[0])) {
                newSong = songs.getSong(splitData[0]);
                newSong.addRating(splitData[1]);
            } else {
                newSong = new Song(splitData[0], splitData[1]);
            }
            songs.addSong(newSong);

            currentUser.addRating(new Song(splitData[0], splitData[1]));

        } else {
            //System.err.println("Unexpected format for song line: " + dataLine);
        }
    }
View Full Code Here

Examples of Song

     * @throws {@link Exception} To signal a problem creating the new song
     * (e.g. a song with that title already exists).
     */
    public static Song createSong(String title) throws Exception {

        Song song = null;
        try {
       
            song = (Song)db.createObject( SongImpl.class.getName(),
                                      OzoneInterface.Public);

            song.setTitle(title);
            allSongs.addSong(title.toUpperCase(), song);

        } catch (Exception e){
            System.out.println("createSong(): something went wrong adding to Ozone.");
            throw e;           
View Full Code Here

Examples of Song

     * @return true if successful. False if not found.
     */
    public static boolean deleteSong(String title)  {
        System.out.println("deleteSong <" + title + ">" );

        Song song = allSongs.deleteSong(title.toUpperCase());
      
        return  (song != null);
    }
View Full Code Here

Examples of Song

     *
     * @return A proxy object for the requested Song object, or null if not found.
     */
    public static Song songForTitle(String title){

        Song song = null;
        try {
            song = allSongs.findSong(title.toUpperCase());

            if (song == null) {
                System.out.println("Song not found by title <" + title + ">" );
View Full Code Here

Examples of Song

     *
     * @return A proxy object for the requested Song object, or null if not found.
     */
    public static Song songForHandle(String handle) {

        Song song = null;
        try {
       
            song = (Song)db.objectForHandle(handle);

            if (song == null) {
View Full Code Here

Examples of Song

    /**
     * Adds a Song to the SongCollection
     *
     */
    public void addSong(String title, Song song) throws Exception {
        Song old = (Song) songMap.put(title, song);
        if (old != null) {
            System.out.println("SongCollection.addSong: song already exists, not added : " + title);
            songMap.put(old.getTitle(), old);

            throw new  Exception ("Duplicate song title");
        }
    }
View Full Code Here

Examples of Song

    /**
     * Deletes a Song from the SongCollection and database
     *
     */
    public Song deleteSong(String  title) {
        Song song = null;
        try{
            song = (Song)songMap.remove(title);
            if (song != null){
                database().deleteObject(song);
            }
View Full Code Here

Examples of Song

        System.out.println( " PrintAllSongs");
    }           
       

    private static void addSong(String title, String author, String publisher, String copyright) throws Exception{
        Song song = SongServices.createSong(title);
        song.setAuthor(author);
        song.setPublisher(publisher);
        song.setCopyright(copyright);
        printSong(song);

    }
View Full Code Here

Examples of Song

    }
    private static void removeSong(String title){
        SongServices.deleteSong(title);
    }
    private static void printSongForTitle(String title){
        Song song = SongServices.songForTitle(title);
        printSong(song);
    }
View Full Code Here

Examples of Song

    private static void printSongForTitle(String title){
        Song song = SongServices.songForTitle(title);
        printSong(song);
    }
    private static void printSongForHandle(String handle){
        Song song = SongServices.songForHandle(handle);
        printSong(song);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.