-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclsQueue.cls
46 lines (40 loc) · 1.04 KB
/
clsQueue.cls
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
45
46
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsQueue"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private colQueue As New Collection
Public Function Dequeue() As String
If (colQueue.Count > 0) Then
Dequeue = colQueue.Item(1)
colQueue.Remove 1
Else
Dequeue = vbNullString
End If
End Function
Public Function Peek() As String
If (colQueue.Count > 0) Then
Peek = colQueue.Item(1)
Else
Peek = vbNullString
End If
End Function
Public Function Count() As Long
Count = colQueue.Count
End Function
Public Sub Clear()
Set colQueue = New Collection
End Sub
Public Sub Enqueue(ByVal strValue As String)
If (LenB(strValue) > 0) Then
colQueue.Add strValue
End If
End Sub