使用VB6编写的hashtable类(2)_VB.net_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

使用VB6编写的hashtable类(2)

作者:黑客防线网安VB教程基地 来源:黑客防线网安VB教程基地 浏览次数:0

本篇关键词:编写使用ThenLastNdx
黑客防线网安网讯:  Dim ndx As Long If Len(Key) = 0 Then Err.Raise 1001, , "Invalid key" If mIgnoreCase Then Key = UCase$(Key) HCode = HashCode(Key) Mod mHashSize ndx = hashTbl(HCode) Do While...

  Dim ndx As Long

If Len(Key) = 0 Then Err.Raise 1001, , "Invalid key"

If mIgnoreCase Then Key = UCase$(Key)
HCode = HashCode(Key) Mod mHashSize
ndx = hashTbl(HCode)

Do While ndx
If slotTable(ndx).Key = Key Then Exit Do
LastNdx = ndx
ndx = slotTable(ndx).nextItem
Loop

If ndx = 0 And Create Then
ndx = GetFreeSlot()
PrepareSlot ndx, Key, HCode, LastNdx
Else
Create = False
End If
GetSlotIndex = ndx

End Function

Private Function GetFreeSlot() As Long
If FreeNdx = 0 Then ExpandSlotTable mChunkSize
GetFreeSlot = FreeNdx
FreeNdx = slotTable(GetFreeSlot).nextItem
slotTable(GetFreeSlot).nextItem = 0
mCount = mCount + 1
End Function

Private Sub PrepareSlot(ByVal index As Long, ByVal Key As String, ByVal HCode As Long, ByVal LastNdx As Long)
If mIgnoreCase Then Key = UCase$(Key)
slotTable(index).Key = Key

If LastNdx Then

slotTable(LastNdx).nextItem = index
Else
hashTbl(HCode) = index
End If
End Sub

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-14844-1.html
网站维护教程更新时间:2012-04-03 01:15:27  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer