⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 songcollectionimpl.java

📁 Java的面向对象数据库系统的源代码
💻 JAVA
字号:
package song;// $Id: song.SongCollectionImpl.java,v 1.1 2002/05/17 08:28:18 per_nyfelt Exp $import org.ozoneDB.OzoneObject;import java.util.AbstractMap;import java.util.TreeMap;/** * Persistenet object that represents a catalog of Songs. * * @version $Revision: 1.1 $ * @author James Stiefel */public class SongCollectionImpl extends OzoneObject implements SongCollection {    /**     * The serialization version id used by the Java serialization.     */    final static long serialVersionUID = 1L;    TreeMap      songMap = new TreeMap();    /**     * Adds a song.Song to the song.SongCollection     *     */    public void addSong(String title, Song song) throws Exception {        Song old = (Song) songMap.put(title, song);        if (old != null) {            System.out.println("song.SongCollection.addSong: song already exists, not added : " + title);            songMap.put(old.getTitle(), old);            throw new  Exception ("Duplicate song title");        }    }    /**     * Deletes a song.Song from the song.SongCollection and database     *     */    public Song deleteSong(String  title) {        Song song = null;        try{            song = (Song)songMap.remove(title);            if (song != null){                database().deleteObject(song);            }        } catch (Exception e) {            System.out.println("Failure removing song.");            e.printStackTrace();        }        return null;    }    /**     * Finds a song in song.SongCollection     *     */    public Song findSong(String song_title) {        return (Song)songMap.get(song_title);    }    /**     * Returns the collection of Songs represented by     * this song.SongCollection.     *     */    public AbstractMap getAllSongs(){        return songMap;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -