home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
ClassSet.cls
< prev
next >
Wrap
Text File
|
1997-11-06
|
3KB
|
136 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "ClassSet"
'
' File : ClassSet.cls
'
' Project :
' Configuration :
' Phase :
' System :
'
Option Explicit
' Inheritance attributes
' Association attributes
' User defined attributes
Private quals_ As Collection
Private contents_ As Collection
' User defined methods
Public Sub ClassSet_Constructor()
' Start user section
Set contents = New Collection
Set quals = New Collection
' End user section
End Sub
Private Sub Class_Terminate()
' Start user section
' End user section
End Sub
Public Sub Class_Initialize()
ClassSet_Constructor
End Sub
Public Function Count() As Integer
Count = contents.Count
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 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 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
' Access methods
Private Property Get quals() As Collection
Set quals = quals_
End Property
Private Property Set quals(x As Collection)
Set quals_ = x
End Property
Private Property Get contents() As Collection
Set contents = contents_
End Property
Private Property Set contents(x As Collection)
Set contents_ = x
End Property
' Association methods