FileDocCategorySizeDatePackage
BookDB.javaAPI DocExample3428Tue Dec 12 18:59:38 GMT 2000database

BookDB

public class BookDB extends Object

Fields Summary
private HashMap
database
private ArrayList
al
private static BookDB
onlyInstance
Constructors Summary
public BookDB()



       
        BookDetails book;
        database = new HashMap();

        book = new BookDetails("201", "Duke", "",
                     "My Early Years: Growing up on *7",
                     (float)10.75, 1995, "What a cool book.");
        database.put(new Integer(201), book);

        book = new BookDetails("202", "Jeeves", "",
                     "Web Servers for Fun and Profit", (float)10.75,
                     1996, "What a cool book.");
        database.put(new Integer(202), book);

        book = new BookDetails("203", "Masterson", "Webster",
                     "Servlets: A Web Developers Dream Come True",
                     (float)17.75, 1995, "What a cool book.");
        database.put(new Integer(203), book);

        book = new BookDetails("204", "RealGood", "Coad",
                     "Moving from C++ to the Java(tm) Programming Language",
                     (float)10.75, 1996, "What a cool book.");
        database.put(new Integer(204), book);

        book = new BookDetails("205", "Novation", "Kevin",
                     "From Oak to Java: The Revolution of a Language",
                     (float)10.75, 1998, "What a cool book.");
        database.put(new Integer(205), book);

        book = new BookDetails("206", "Gosling", "James",
                     "Oak Intermediate Bytecodes", (float)10.75,
                     1998, "What a cool book.");
        database.put(new Integer(206), book);

        book = new BookDetails("207", "Thrilled", "Ben",
                     "The Green Project: Programming for Consumer Devices",
                     (float)10.75, 1998, "What a cool book");
        database.put(new Integer(207), book);

        book = new BookDetails("208", "Duke", "",
                     "100% Pure: Making Cross Platform Deployment a Reality",
                     (float)10.75, 1998, "What a cool book.");
        database.put(new Integer(208), book);

        book = new BookDetails("209", "Tru", "Itzal",
                     "Duke: A Biography of the Java Evangelist",
                     (float)10.75, 1998, "What a cool book.");
        database.put(new Integer(209), book);

        book = new BookDetails("210", "Sidence", "Cohen",
                     "I Think Not: Duke's Likeness to the Federation Insignia",
                     (float)10.75, 1998, "What a cool book.");
        database.put(new Integer(210), book);
			  al = new ArrayList(database.values());
				Collections.sort(al);
    
Methods Summary
public BookDetailsgetBookDetails(java.lang.String bookId)

        Integer key = new Integer(bookId);
        return (BookDetails)database.get(key);
    
public java.util.CollectiongetBooks()

				return al;
    
public intgetNumberOfBooks()

        return database.size();
    
public static database.BookDBinstance()

      if (onlyInstance == null)
        onlyInstance = new BookDB();
      return onlyInstance;