34 bucket =
new List[size];
50 int count = num_buckets;
54 List *head = &bucket[count];
65void*
Bin::Get ( OLECHAR *text1, OLECHAR *text2 )
89void Bin::Add (
void *data, OLECHAR *text1, OLECHAR *text2 )
97 hash = calc_hash ( text1 );
98 item =
new BinItem ( data, hash, text1, text2 );
100 list = &bucket[hash%num_buckets];
109 sh_size1 = sh_size2 = 0;
113 sh_hash = calc_hash ( text1 );
117 sh_size1 = wcslen ( sh_text1 );
122 sh_size2 = wcslen ( sh_text2 );
125 sh_item = (
BinItem *) &bucket[sh_hash%num_buckets];
135 sh_item = (
BinItem *) sh_item->Next ();
140 if ( sh_item->Same ( sh_hash, sh_text1, sh_size1, sh_text2, sh_size2 ))
144 sh_item = (
BinItem *) sh_item->Next ();
156 for ( i=0; i< num_buckets; i++)
159 if ( ( bitem = (
BinItem *) bucket[i].Find ( item )))
206 if ( (text1 = new_text1) )
208 text1size = wcslen ( text1 );
215 if ( (text2 = new_text2) )
217 text2size = wcslen ( text2 );
225int BinItem::Same (
int chash, OLECHAR *ctext1,
int size1, OLECHAR *ctext2,
int size2 )
227 if ( hash != chash || text1size != size1 || text2size != size2 )
232 if ( wcsicmp ( text1, ctext1 ))
237 if ( text2 && ctext2 && wcsicmp ( text2, ctext2 ))
246int Bin::calc_hash ( OLECHAR *text )
266 bucket =
new List[size];
282 int count = num_buckets;
286 List *head = &bucket[count];
317 list = &bucket[
id%num_buckets];
328 item = (
BinIDItem *) bucket[
id%num_buckets].Next();
332 if ( item->
Same (
id ))
349 for ( i=0; i< num_buckets; i++)
352 if ( ( bitem = (
BinIDItem *) bucket[i].Find ( item )))
402 return id == compare_id;
void Add(void *item, OLECHAR *text1, OLECHAR *text2=NULL)
void * Get(OLECHAR *text1, OLECHAR *text2=NULL)
BinItem * GetNextBinItem(void)
BinItem * GetBinItem(OLECHAR *text1, OLECHAR *text2=NULL)
BinIDItem * GetBinIDItem(int id)
void Add(void *item, int id)
BinIDItem(void *data, int id)
int Same(int chash, OLECHAR *ctext1, int size1, OLECHAR *ctext2, int size2)
BinItem(void *data, int hash, OLECHAR *text1, OLECHAR *text2)
void AddToTail(ListNode *node)