-
Notifications
You must be signed in to change notification settings - Fork 8
/
Hash.h
44 lines (35 loc) · 916 Bytes
/
Hash.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
////////////////////////////////////////////////////////////////////////
//Title: Hash.h
//Author: Kristina Klinkner
//Date: March 20, 2002
//Description: Header file for Hash.cpp
//
////////////////////////////////////////////////////////////////////////
#ifndef __HASH_H
#define __HASH_H
#define HASHSIZE 359
#include "Common.h"
#include "States.h"
//Forward declarations
class StringElem;
class State;
class HashTable {
private:
struct HashTableEntry {
StringElem* m_stringPtr;
State* m_statePtr;
HashTableEntry* m_nextPtr;
};
HashTableEntry* m_data[HASHSIZE];
int Hash(ulong key);
ulong CreateKey(char* string);
public:
HashTable();
~HashTable();
void Insert(StringElem* elem, State* state);
State* WhichState(char* string);
int WhichStateNumber(char* string);
void Print();
void RemoveString(char* string);
};
#endif