Linkable.Utility
Class AuthorDatabase

java.lang.Object
  |
  +--Linkable.Utility.AuthorDatabase

public class AuthorDatabase
extends java.lang.Object


Field Summary
private static java.util.Hashtable authors
           
private static boolean DEBUG
           
private static java.lang.String ME
           
 
Constructor Summary
AuthorDatabase()
           
 
Method Summary
static void delete(java.lang.String key)
          delete - remove the entire entry from the hashtable
static void dump()
          dump - Print out current contents of the Author database
static void dump(java.lang.String fname)
          dump - Write current contents of the Author database to file
static java.util.Vector fetchAuthor(java.lang.String lastName)
          fetchAuthor - returns a vector of Author objects with this last name or returns null if lookup fails
static Author fetchSpecificAuthor(Author a)
          fetchAuthor - this form returns the particular element in the database that matches Author a ( or null )
static boolean isInDatabase(Author a)
          isInDatabase - return true if this author is already there (flesh out author data in the process)
static void reload()
          reload - initialize the hash table from storage (partially) from the file specified in CONFIG.java.
static void save()
           
static void stashAuthor(Author a)
          stashAuthor - adds a specified Author to the hash table.
static void updateAuthor(java.lang.String key, java.util.Vector v)
          updateAuthor - The author vector at the specified key is replaced by the new Vector (good for deleting Authors)
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

ME

private static final java.lang.String ME

DEBUG

private static final boolean DEBUG

authors

private static java.util.Hashtable authors
Constructor Detail

AuthorDatabase

public AuthorDatabase()
Method Detail

fetchAuthor

public static java.util.Vector fetchAuthor(java.lang.String lastName)
fetchAuthor - returns a vector of Author objects with this last name or returns null if lookup fails
Parameters:
- - last name of author to be fetched

fetchSpecificAuthor

public static Author fetchSpecificAuthor(Author a)
fetchAuthor - this form returns the particular element in the database that matches Author a ( or null )

stashAuthor

public static void stashAuthor(Author a)
stashAuthor - adds a specified Author to the hash table. As a side-effect, if there is a hash conflict, but the values are consistent with each other, then fields get completed and the merged Author stays at this key and at this Vector index. We assume the Author given to this routine will be discarded during garbage collection. If the two entries are inconsistent, then assume that we have a new author with the same last name as another one.
Parameters:
the - Author that should be inserted into the table

isInDatabase

public static boolean isInDatabase(Author a)
isInDatabase - return true if this author is already there (flesh out author data in the process)
Parameters:
the - Author object to be looked up

delete

public static void delete(java.lang.String key)
delete - remove the entire entry from the hashtable

updateAuthor

public static void updateAuthor(java.lang.String key,
                                java.util.Vector v)
updateAuthor - The author vector at the specified key is replaced by the new Vector (good for deleting Authors)

reload

public static void reload()
reload - initialize the hash table from storage (partially) from the file specified in CONFIG.java. format for the record in file is (author-last-name, Vector of Author objects)

save

public static void save()

dump

public static void dump()
dump - Print out current contents of the Author database

dump

public static void dump(java.lang.String fname)
dump - Write current contents of the Author database to file