Professional Documents
Culture Documents
h
#ifndef FHHASHQPWFIND_H
#define FHHASHQPWFIND_H
#include "FHhashQP.h"
public:
const Object find(const KeyType & key);
class NotFoundException {};
};
return hashVal;
}
return index;
}
if (mArray[index].state == ACTIVE)
return (mArray[index]).data;
throw NotFoundException();
}
#endif
// Assignment #6
// CS 2C, Foothill College, Cory Phillips
#include <string>
#include "EBookEntry.h"
#include "FHhashQPwFind.h"
#include <time.h>
using namespace std;
int main()
{
EBookEntryReader bookInput("catalog-short4.txt");
EBookEntry book;
// FHhashQPwFind<EBookEntry, int> hashTable; // for ID equality
FHhashQPwFind<EBookEntry, string> hashTable; // for any string equality
// EBookEntry::setSortType(EBookEntry::SORT_BY_ID);
EBookEntry::setSortType(EBookEntry::SORT_BY_CREATOR);
int randomIndices[NUM_RANDOM_INDICES];
cout << NUM_RANDOM_INDICES << " Random Books" << endl << endl;
// more failures
try
{
// book = hashTable.find(INT_MAX);
book = hashTable.find( "Liam Neeson" );
cout << "Found book: " << book.getTitle() << endl;
}
catch (...)
{
cout << "no. ";
}
try
{
//book = hashTable.find(-1);
book = hashTable.find( "Brobotic Jack" );
cout << "Found book: " << book.getTitle() << endl;
}
catch (...)
{
cout << "no. ";
}
}
return retVal;
}
//return key.getETextNum();
catalog-short4.txt
4863
25 Random Books
BOOK 0:
Title: Dick and His Cat and Other Tales
Creator: (no data found)
Subject: Animals -- Juvenile fiction
ETextNum: 28351
BOOK 1:
Title: The Slant Book
Creator: Newell, Peter, 1862-1924
Subject: Children's poetry
ETextNum: 26271
BOOK 2:
Title: The Book of Tea
Creator: Okakura, Kakuzo, 1862-1913
Subject: Tea
ETextNum: 28911
BOOK 3:
Title: Journeys Through Bookland, Vol. 5
Creator: Sylvester, Charles Herbert
Subject: Children's literature
ETextNum: 11250
BOOK 4:
Title: The Border WatchA Story of the Great Chief's Last Stand
Creator: Altsheler, Joseph A. (Joseph Alexander), 1862-1919
Subject: Frontier and pioneer life -- Juvenile fiction
ETextNum: 25186
BOOK 5:
Title: The Heroic Enthusiasts (Gli Eroici Furori) Part the SecondAn Ethical Poem
Creator: Bruno, Giordano, 1548-1600
Subject: (no data found)
ETextNum: 19833
BOOK 6:
Title: The Red Hand of Ulster
Creator: Birmingham, George A., 1865-1950
Subject: Ulster (Northern Ireland and Ireland) -- Fiction
ETextNum: 29533
BOOK 7:
Title: The Nursery, July 1877, XXII. No. 1A Monthly Magazine for Youngest Readers
Creator: Various
Subject: Children's literature, American -- Periodicals
ETextNum: 28135
BOOK 8:
Title: The Gospels in Four Part Harmony
Creator: Clontz, J.
Subject: Bible. N.T. Gospels -- Harmonies, English
ETextNum: 4319
BOOK 9:
Title: The Road to Frontenac
Creator: Merwin, Samuel, 1874-1936
Subject: Canada -- History -- To 1763 (New France) -- Fiction
ETextNum: 28958
BOOK 10:
Title: History of Education
Creator: Seeley, Levi, 1847-1928
Subject: Education -- History
ETextNum: 27963
BOOK 11:
Title: Ravensdene Court
Creator: Fletcher, J. S. (Joseph Smith), 1863-1935
Subject: Detective and mystery stories
ETextNum: 26324
BOOK 12:
Title: Casa Braccio, Volumes 1 and 2 (of 2)
Creator: Crawford, F. Marion (Francis Marion), 1854-1909
Subject: Italy -- Fiction
ETextNum: 26327
BOOK 13:
Title: Musical Memories
Creator: Saint-Sa+�ns, Camille, 1835-1921
Subject: Music -- History and criticism
ETextNum: 16459
BOOK 14:
Title: Lives of the Most Eminent Painters Sculptors and ArchitectsVol. 05 ( of 10)
Andrea da Fiesole to Lorenzo Lotto
Creator: Vasari, Giorgio, 1511-1574
Subject: Artists -- Italy -- Biography
ETextNum: 28421
BOOK 15:
Title: The Helpful Robots
Creator: Shea, Robert, 1933-1994
Subject: Science fiction
ETextNum: 28438
BOOK 16:
Title: A Letter to the Right Honorable the Lord Chancellor, on the Nature and
Interpretation of Unsoundness of Mind, and Imbecility of Intellect
Creator: Haslam, John, 1764-1844
Subject: Mental illness -- Jurisprudence
ETextNum: 27740
BOOK 17:
Title: Hold Up Your Heads, Girls! : Helps for Girls, in School and Out
Creator: Ryder, Annie H
Subject: Girls
ETextNum: 6636
BOOK 18:
Title: Blow The Man DownA Romance Of The Coast - 1916
Creator: Day, Holman, 1865-1935
Subject: Ship captains -- Fiction
ETextNum: 24793
BOOK 19:
Title: The Copper-Clad World
Creator: Vincent, Harl, 1893-1968
Subject: Science fiction
ETextNum: 28883
BOOK 20:
Title: The Cult of Incompetence
Creator: Faguet, +�mile, 1847-1916
Subject: Democracy
ETextNum: 27368
BOOK 21:
Title: The Works Of George MeredithA Linked Index to the Project Gutenberg Editions
Creator: Meredith, George, 1828-1909
Subject: Indexes
ETextNum: 28823
BOOK 22:
Title: The History of the Peloponnesian War
Creator: Thucydides, 455? BC-395 BC
Subject: Greece -- History -- Peloponnesian War, 431-404 B.C.
ETextNum: 26245
BOOK 23:
Title: Keene, Louis
Creator: Keene, Louis
Subject: World War, 1914-1918 -- Personal narratives, Canadian
ETextNum: 28964
BOOK 24:
Title: The Grecian Daughter
Creator: Murphy, Arthur, 1727-1805
Subject: English drama
ETextNum: 30271
FOUND BOOK 1:
Title: The Slant Book
Creator: Newell, Peter, 1862-1924
Subject: Children's poetry
ETextNum: 26271
FOUND BOOK 2:
Title: The Book of Tea
Creator: Okakura, Kakuzo, 1862-1913
Subject: Tea
ETextNum: 28911
FOUND BOOK 3:
Title: Journeys Through Bookland, Vol. 5
Creator: Sylvester, Charles Herbert
Subject: Children's literature
ETextNum: 11250
FOUND BOOK 4:
Title: The Border WatchA Story of the Great Chief's Last Stand
Creator: Altsheler, Joseph A. (Joseph Alexander), 1862-1919
Subject: Frontier and pioneer life -- Juvenile fiction
ETextNum: 25186
FOUND BOOK 5:
Title: The Heroic Enthusiasts (Gli Eroici Furori) Part the SecondAn Ethical Poem
Creator: Bruno, Giordano, 1548-1600
Subject: (no data found)
ETextNum: 19833
FOUND BOOK 6:
Title: The Red Hand of Ulster
Creator: Birmingham, George A., 1865-1950
Subject: Ulster (Northern Ireland and Ireland) -- Fiction
ETextNum: 29533
FOUND BOOK 7:
Title: The Nursery, July 1877, XXII. No. 1A Monthly Magazine for Youngest Readers
Creator: Various
Subject: Children's literature, American -- Periodicals
ETextNum: 28135
FOUND BOOK 8:
Title: The Gospels in Four Part Harmony
Creator: Clontz, J.
Subject: Bible. N.T. Gospels -- Harmonies, English
ETextNum: 4319
FOUND BOOK 9:
Title: The Road to Frontenac
Creator: Merwin, Samuel, 1874-1936
Subject: Canada -- History -- To 1763 (New France) -- Fiction
ETextNum: 28958
-----------------------------------------------------------------------------------
-----------------------*/
BOOK 0:
Title: Dick and His Cat and Other Tales
Creator: (no data found)
Subject: Animals -- Juvenile fiction
ETextNum: 28351
BOOK 1:
Title: The Slant Book
Creator: Newell, Peter, 1862-1924
Subject: Children's poetry
ETextNum: 26271
BOOK 2:
Title: The Book of Tea
Creator: Okakura, Kakuzo, 1862-1913
Subject: Tea
ETextNum: 28911
BOOK 3:
Title: Journeys Through Bookland, Vol. 5
Creator: Sylvester, Charles Herbert
Subject: Children's literature
ETextNum: 11250
BOOK 4:
Title: The Border WatchA Story of the Great Chief's Last Stand
Creator: Altsheler, Joseph A. (Joseph Alexander), 1862-1919
Subject: Frontier and pioneer life -- Juvenile fiction
ETextNum: 25186
BOOK 5:
Title: The Heroic Enthusiasts (Gli Eroici Furori) Part the SecondAn Ethical Poem
Creator: Bruno, Giordano, 1548-1600
Subject: (no data found)
ETextNum: 19833
BOOK 6:
Title: The Red Hand of Ulster
Creator: Birmingham, George A., 1865-1950
Subject: Ulster (Northern Ireland and Ireland) -- Fiction
ETextNum: 29533
BOOK 7:
Title: The Nursery, July 1877, XXII. No. 1A Monthly Magazine for Youngest Readers
Creator: Various
Subject: Children's literature, American -- Periodicals
ETextNum: 28135
BOOK 8:
Title: The Gospels in Four Part Harmony
Creator: Clontz, J.
Subject: Bible. N.T. Gospels -- Harmonies, English
ETextNum: 4319
BOOK 9:
Title: The Road to Frontenac
Creator: Merwin, Samuel, 1874-1936
Subject: Canada -- History -- To 1763 (New France) -- Fiction
ETextNum: 28958
BOOK 10:
Title: History of Education
Creator: Seeley, Levi, 1847-1928
Subject: Education -- History
ETextNum: 27963
BOOK 11:
Title: Ravensdene Court
Creator: Fletcher, J. S. (Joseph Smith), 1863-1935
Subject: Detective and mystery stories
ETextNum: 26324
BOOK 12:
Title: Casa Braccio, Volumes 1 and 2 (of 2)
Creator: Crawford, F. Marion (Francis Marion), 1854-1909
Subject: Italy -- Fiction
ETextNum: 26327
BOOK 13:
Title: Musical Memories
Creator: Saint-Sa+�ns, Camille, 1835-1921
Subject: Music -- History and criticism
ETextNum: 16459
BOOK 14:
Title: Lives of the Most Eminent Painters Sculptors and ArchitectsVol. 05 ( of 10)
Andrea da Fiesole to Lorenzo Lotto
Creator: Vasari, Giorgio, 1511-1574
Subject: Artists -- Italy -- Biography
ETextNum: 28421
BOOK 15:
Title: The Helpful Robots
Creator: Shea, Robert, 1933-1994
Subject: Science fiction
ETextNum: 28438
BOOK 16:
Title: A Letter to the Right Honorable the Lord Chancellor, on the Nature and
Interpretation of Unsoundness of Mind, and Imbecility of Intellect
Creator: Haslam, John, 1764-1844
Subject: Mental illness -- Jurisprudence
ETextNum: 27740
BOOK 17:
Title: Hold Up Your Heads, Girls! : Helps for Girls, in School and Out
Creator: Ryder, Annie H
Subject: Girls
ETextNum: 6636
BOOK 18:
Title: Blow The Man DownA Romance Of The Coast - 1916
Creator: Day, Holman, 1865-1935
Subject: Ship captains -- Fiction
ETextNum: 24793
BOOK 19:
Title: The Copper-Clad World
Creator: Vincent, Harl, 1893-1968
Subject: Science fiction
ETextNum: 28883
BOOK 20:
Title: The Cult of Incompetence
Creator: Faguet, +�mile, 1847-1916
Subject: Democracy
ETextNum: 27368
BOOK 21:
Title: The Works Of George MeredithA Linked Index to the Project Gutenberg Editions
Creator: Meredith, George, 1828-1909
Subject: Indexes
ETextNum: 28823
BOOK 22:
Title: The History of the Peloponnesian War
Creator: Thucydides, 455? BC-395 BC
Subject: Greece -- History -- Peloponnesian War, 431-404 B.C.
ETextNum: 26245
BOOK 23:
Title: Keene, Louis
Creator: Keene, Louis
Subject: World War, 1914-1918 -- Personal narratives, Canadian
ETextNum: 28964
BOOK 24:
Title: The Grecian Daughter
Creator: Murphy, Arthur, 1727-1805
Subject: English drama
ETextNum: 30271
FOUND BOOK 1:
Title: The Slant Book
Creator: Newell, Peter, 1862-1924
Subject: Children's poetry
ETextNum: 26271
FOUND BOOK 2:
Title: The Book of Tea
Creator: Okakura, Kakuzo, 1862-1913
Subject: Tea
ETextNum: 28911
FOUND BOOK 3:
Title: Journeys Through Bookland, Vol. 5
Creator: Sylvester, Charles Herbert
Subject: Children's literature
ETextNum: 11250
FOUND BOOK 4:
Title: The Tree of Appomattox
Creator: Altsheler, Joseph A. (Joseph Alexander), 1862-1919
Subject: (no data found)
ETextNum: 17677
FOUND BOOK 5:
Title: The Heroic Enthusiasts (Gli Eroici Furori) Part the SecondAn Ethical Poem
Creator: Bruno, Giordano, 1548-1600
Subject: (no data found)
ETextNum: 19833
FOUND BOOK 6:
Title: General John Regan
Creator: Birmingham, George A., 1865-1950
Subject: Ireland -- Fiction
ETextNum: 24073
FOUND BOOK 7:
Title: The American Missionary G�� Volume 54, No. 3, October, 1900
Creator: Various
Subject: Congregational churches -- Missions -- Periodicals
ETextNum: 28712
FOUND BOOK 8:
Title: The Gospels in Four Part Harmony
Creator: Clontz, J.
Subject: Bible. N.T. Gospels -- Harmonies, English
ETextNum: 4319
FOUND BOOK 9:
Title: The Road to Frontenac
Creator: Merwin, Samuel, 1874-1936
Subject: Canada -- History -- To 1763 (New France) -- Fiction
ETextNum: 28958
-------------------------------------------------------------------------------*/