| 
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Library
Library class, not instantiated, all static methods for one library. Date started 2004.Oct.26 Part of Blab2.java (Second = 035B Java college-class, lab assignment #2)
| Field Summary | |
private static java.util.Vector | 
books
 | 
private static boolean | 
changed
 | 
private static java.util.Calendar | 
datime
 | 
private static java.lang.String | 
fn
 | 
| Constructor Summary | |
Library()
 | 
|
| Method Summary | |
static void | 
addBook(int id,
        java.lang.String title,
        java.lang.String author,
        java.lang.String isbn)
Given that all fields verified valid, make new book record and add it to the library's collection.  | 
static java.util.Enumeration | 
allBooks()
 | 
static void | 
authorSortList(java.lang.String key)
Given key (part of author name), find all books by such athors, and print full info about each.  | 
static Book2 | 
bookAtIndex(int ix)
Given index in list of books, retrieve full Book2 record  | 
static int | 
bookDueDiff(Book2 bk)
 | 
static int | 
bookDynamicFine(Book2 bk)
Compute dynamic fine for one book  | 
static boolean | 
checkOutBook(int ix,
             Patron pt)
Make sure book is currently in the library, and assuming that, check it out, setting due date in 3 days.  | 
static boolean | 
confirmFullword(java.lang.String question)
Similar to yes-or-no-p in CL, asks a question and expects full word yes or no as the answer.  | 
static int | 
findById(int id)
Search for a book with given ID.  | 
static int | 
findByIsbn(java.lang.String isbn)
Search for a book with given ISBN.  | 
static int | 
findByTitle(java.lang.String title)
Look for any book by specified title, complain if more than one (and show first two).  | 
static void | 
markChanged()
Mark the library database as changed, so it'll be saved upon exit.  | 
private static void | 
matchesSortList(java.util.Vector match)
Common code for author/title search.  | 
static void | 
mayLoadBooksDatabase()
If library database exists, load it, else ask user if it's OK to start with empty database.  | 
static void | 
maySaveBooksDatabase()
If any changes since last save/restore, save entire books database to disk file.  | 
static java.util.Enumeration | 
overdueBooks()
 | 
static boolean | 
removeBook(int ix)
Delete record of book from the library database  | 
static void | 
renewBook(java.util.Calendar due,
          int ndays)
Renew a book  | 
static void | 
reserveBook(int ix,
            Patron pt)
Reserve a book  | 
static boolean | 
returnBook(int ix)
Make sure book was checked out, and assuming that, check it back in.  | 
static void | 
titleSortList(java.lang.String key)
Given key (part of title), find all books with such titles, and print full info about each.  | 
static void | 
updateDatime(int ndays)
If datime is not yet the current date&time, make it so.  | 
| Methods inherited from class java.lang.Object | 
 | 
| Field Detail | 
private static java.util.Vector books
private static boolean changed
private static final java.lang.String fn
private static java.util.Calendar datime
| Constructor Detail | 
public Library()
| Method Detail | 
public static void authorSortList(java.lang.String key)
public static void titleSortList(java.lang.String key)
private static void matchesSortList(java.util.Vector match)
public static void markChanged()
public static void reserveBook(int ix,
                               Patron pt)
ix - int index of book in list of bookspt - Patron full record of patron who wants to reserve this book
public static void renewBook(java.util.Calendar due,
                             int ndays)
due - Calendar The due-date which is part of the Book recordndays - int The number of days to renew the bookpublic static Book2 bookAtIndex(int ix)
ix - int Indexpublic static boolean returnBook(int ix)
ix - Index where book was found in vector books.public static java.util.Enumeration overdueBooks()
public static int bookDueDiff(Book2 bk)
public static int bookDynamicFine(Book2 bk)
bk - Book2 The full book record of the bookpublic static java.util.Enumeration allBooks()
public static int findByTitle(java.lang.String title)
title - The title or a substring thereof
public static boolean checkOutBook(int ix,
                                   Patron pt)
ix - Index where book was found in vector books.
public static void addBook(int id,
                           java.lang.String title,
                           java.lang.String author,
                           java.lang.String isbn)
id - Library's ID number for book.title - Title of book.author - Name of author of book.isbn -  public static int findById(int id)
id - Library's ID for bookpublic static int findByIsbn(java.lang.String isbn)
isbn -  public static void updateDatime(int ndays)
ndays - Number of days to fudge from current date&timepublic static boolean confirmFullword(java.lang.String question)
question - Question to ask the user.public static boolean removeBook(int ix)
ix - Index where book was found in vector books.public static void mayLoadBooksDatabase()
public static void maySaveBooksDatabase()
  | 
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||