多分支树的类模块(原创)
来源:互联网 发布:oracle数据库文本类型 编辑:程序博客网 时间:2024/04/29 13:50
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "Branch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Collection" ,"Branch"
Attribute VB_Ext_KEY = "Member0" ,"Branch"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
Public Key As String
Public Value As Variant
Public Parent As Branch
'局部变量,保存集合
Private mCol As Collection
Public Function AddChild(Optional Value, Optional sKey As String) As Branch
Set AddChild = New Branch
With AddChild
If IsObject(Value) Then
Set .Value = Value
Else
.Value = Value
End If
.Key = sKey
Set .Parent = Me
End With
If Key <> "" Then
mCol.Add AddChild, sKey
Else
mCol.Add AddChild
End If
End Function
Public Property Get Children(vntIndexKey As Variant) As Branch
Attribute Children.VB_UserMemId = 0
Set Children = mCol(vntIndexKey)
End Property
Public Property Get Count() As Long
Count = mCol.Count
End Property
Public Sub Remove(vntIndexKey As Variant)
mCol.Remove vntIndexKey
End Sub
Public Property Get NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
Set NewEnum = mCol.[_NewEnum]
End Property
Private Sub Class_Initialize()
Set mCol = New Collection
End Sub
Private Sub Class_Terminate()
Set mCol = Nothing
Set Value = Nothing
End Sub
Public Function FindChild(ByVal sKey As String) As Branch
If Key = sKey Then
Set FindChild = Me
Else
Dim i As Long
For i = 1 To mCol.Count
FindChild = mCol(i).FindChild(sKey)
If Not FindChild Is Nothing Then Exit Function
Next i
End If
End Function
Public Property Get Root() As Branch
Set Root = Me
Do While Not Root.Parent Is Nothing
Set Root = Root.Parent
Loop
End Property
- 多分支树的类模块(原创)
- 二叉树类模块(原创)
- [原创]一个取系统驱动器名称的类模块
- [原创]简易的文件粉碎模块
- 如何合并多个分支的不稳定模块的代码,展示当前的进展效果?
- git对submodule多模块的tag操作(并同步到远程分支)
- dojo之模块分支
- 写了个禁止关闭计算机的模块(原创:唐细刚 2005-5-29)
- 【原创】关于GPRS/WCDMA 模块的调试经验(作者:gooogleman)
- LINUX下PHP扩展模块的开发和测试(原创)
- 【git系列之E】git的分支操作(查看分支、切换分支、新建分支和删除分支)
- [原创]VB程序 - 处理字符和文件名称的代码模块
- 【原创】用GSM/GPS模块遥控航模的可行性分析
- 【原创】Tiny6410驱动模块的构建、加载和卸载
- 【python图像处理】python的图像处理模块Image【原创】
- (原创)画走势图的类
- 类的调用监控(原创)
- 文件删除的类(原创 vince6799)
- VC++基础知识——Edit的赋值取值问题!
- 枫桥夜泊VS京口夜泊
- [网络应用]必须掌握的八个DOS命令
- 为什么Runtime.exec("ls")没有任何输出?
- 如何产生签名applet,以使applet能够访问本地资源?
- 多分支树的类模块(原创)
- 二叉树类模块(原创)
- 网站测试技术介绍
- 金额数字(小写)转换成文字(大写)
- Google的秘密通道
- 增值平台已经初见成效了。
- hibernate高级特性_1
- Struts + Hibernate分页显示 v1.0
- IT从业人员必看的10个论坛