Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
6
Добавлен:
26.03.2015
Размер:
2.22 Кб
Скачать
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Trav2Node"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
' ************************************************
' Trav2Node.CLS
'
' Node class for N-ary tree.
' ************************************************
' Copyright (C) 1997 John Wiley & Sons, Inc.
' All rights reserved. See additional copyright
' information in RIGHTS.TXT.
' ************************************************
Option Explicit

Public Children As New Collection

Public Box As Label
' ************************************************
' Delete the descendant node. Return True if the
' node is deleted.
' ************************************************
Public Function DeleteDescendant(target As Trav2Node) As Boolean
Dim i As Integer
Dim child As Trav2Node

' See if it's one of our children.
For i = 1 To Children.Count
If Children.Item(i) Is target Then
Children.Remove i
DeleteDescendant = True
Exit Function
End If
Next i

' It's not one of our children. Recursively
' check the descendants.
For Each child In Children
If child.DeleteDescendant(target) Then
DeleteDescendant = True
Exit Function
End If
Next child
End Function
' ************************************************
' Find the node that corresponds to the Label.
' ************************************************
Public Function FindNode(ctl As Label) As Trav2Node
Dim node As Trav2Node
Dim child As Trav2Node

' See if we are the one.
If ctl = Box Then
Set FindNode = Me
Exit Function
End If

' See if a child can find it.
For Each child In Children
Set node = child.FindNode(ctl)
If Not (node Is Nothing) Then
Set FindNode = node
Exit Function
End If
Next child

Set FindNode = Nothing
End Function

' ************************************************
' Unload the node's label control.
' ************************************************
Private Sub Class_Terminate()
Unload Box
End Sub


Соседние файлы в папке CH6
  • #
    26.03.201556 б5TRAV1.vbw
  • #
    26.03.201512.62 Кб5Trav2.frm
  • #
    26.03.201518 б5TRAV2.FRX
  • #
    26.03.2015624 б5TRAV2.VBP
  • #
    26.03.201586 б5TRAV2.vbw
  • #
    26.03.20152.22 Кб6Trav2Node.cls
  • #
    26.03.201512 б5treesort.f2x
  • #
    26.03.201511 Кб5Treesort.frm
  • #
    26.03.2015512 б5TREESORT.FRT
  • #
    26.03.201512 б5TREESORT.FRX
  • #
    26.03.2015114 б6Treesort.log