bookdbfrontend.java
来自「初期JAVA学习非常有用的资料。帮助深入了解API。特别是Applet。」· Java 代码 · 共 75 行
JAVA
75 行
/*Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.This software is the confidential and proprietary information of SunMicrosystems, Inc. ("Confidential Information"). You shall notdisclose such Confidential Information and shall use it only inaccordance with the terms of the license agreement you entered intowith Sun.SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THESOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THEIMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULARPURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGESSUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTINGTHIS SOFTWARE OR ITS DERIVATIVES.CopyrightVersion 1.0*/package database;import java.io.*;/** * Object that gets information from the Duke's Bookstore database. */public class BookDBFrontEnd { private BookStoreDB books; private static BookDBFrontEnd onlyInstance = null; /* Private no-args constructor */ private BookDBFrontEnd() { init(); } /** Static factory method that makes a single instance of this * class. */ public static BookDBFrontEnd instance () { if (onlyInstance == null) onlyInstance = new BookDBFrontEnd(); return onlyInstance; } /** Initialize the book database, and store it in this. */ public void init() { // Load the database to prepare for requests books = new BookStoreDB(); } /** Set the database to null so that it can be garbage collected. */ public void destroy() { books = null; } /** Return information about the book associated with the given * book identifier. */ public BookDetails getBookDetails(String bookId) { return books.getBookDetails(bookId); } /** Return information about all the books in the bookstore. * Sort the books into alphabetical order using their title * as the key. */ public BookDetails[] getBooksSortedByTitle() { return books.getBooksSortedByTitle(); } /** Return the number of books in the bookstore database. */ public int getNumberOfBooks() { return books.getNumberOfBooks(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?