VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "ClassSet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private contents As New Collection
Private quals    As New Collection

Public Property Get Count() As Integer
        Count = contents.Count
End Property

Public Function item(index As Variant) As Object
        Set item = contents.item(index)
End Function

Public Function key(index As Variant) As Variant
        Set key = quals.item(index)
End Function

Public Sub Add(obj As Object, Optional key As Variant)
        If IsMissing(key) Then
                contents.Add obj
                quals.Add "Nokey"
        Else
                contents.Add obj, key
                quals.Add key
        End If
End Sub

Public Sub Remove(item As Object)
        Dim ii As Integer
        For ii = 1 To contents.Count
               If item Is contents.item(ii) Then
                      contents.Remove (ii)
                      quals.Remove (ii)
                      Exit Sub
               End If
        Next ii
End Sub

Public Sub RemoveUsingKey(key As Variant)
        Dim ii As Integer
        For ii = 1 To quals.Count
               If key = quals.item(ii) Then
                      contents.Remove (ii)
                      quals.Remove (ii)
                      Exit Sub
               End If
        Next ii
End Sub
                
Public Function Contains(item As Object) As Boolean
        Dim ii As Integer
        For ii = 1 To contents.Count
              If item Is contents.item(ii) Then
                      Contains = True
                      Exit Function
              End If
        Next ii
        Contains = False
End Function

Public Function ContainsKey(key As Variant) As Boolean
        Dim ii As Integer
        For ii = 1 To quals.Count
              If key = quals.item(ii) Then
                      ContainsKey = True
                      Exit Function
              End If
        Next ii
        ContainsKey = False
End Function
