/**
 * Rahman, Asif
 * Assignment #5: Hash_DB.h
 * UserID: arahman2@fau.edu
 * Course: COP3530 Term: Fall 2008
 * Instructor: Dr. Lofton Bullard
 *
 * Hash_DB.h
 * ------
 * Hash_DB.h describes the hash table adt 
 * Functions available to the hash table are:
 *	- isEmpty: Checks to see if the linked list is empty
 *  - insert: Adds a record to the linked list and bst
 *  - load: Silently load record to the linked list and bst
 *	- remove: Removes a record from the linked list and bst
 *  - search: Searches the BST and returns pointer to found node
 *  - searchKey: Generates the searchkey from lastname and firstname
 *  - getIndex: Hashing function to obtain hash index from lastname's first letter (case-insenstive)
 *	- Default constructor: The default constructor will initialize the hash table
 */
#ifndef _HASH_DB_H
#define _HASH_DB_H

#include "List.h"
#include "BST.h"

using namespace std;

class Hash_DB
{
friend class Address_DB;
public:
    Hash_DB();
    bool isEmpty() { return Records.isEmpty(); }
    int size() { return Records.size; }
    void insert(Record *rec);
    void load(Record *rec); //Same as insert but silent (used for loading data from file)
    void remove(string &lastname, string &firstname);
    node *search(string &lastname, string &firstname);
private:    
    string searchKey(string &lastname, string &firstname);
    int getIndex(string &lastname);
    List Records;
    BST B[26];
};

#endif