-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTagsRelationship.cls
97 lines (83 loc) · 2.71 KB
/
TagsRelationship.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "TagsRelationship"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'@Folder("Operation.SummaryToWS")
' Class Module: TagsRelationship
' A class to contain the data of design Ws IO Tag <> summary tag conversion.
' Used in DesignWsGroup
Private mName As String
Private mIsPrint As Boolean
Private mTagRelation As Object
Private mIsDefaultInput As Object 'a dict to contains the information of 'Use Default Input' Data
Private mDefaultInput As Object 'a dict to contains the information of Default Input
' Class Initialization
Private Sub Class_Initialize()
mIsPrint = True
Set mTagRelation = CreateObject("Scripting.Dictionary")
Set mIsDefaultInput = CreateObject("Scripting.Dictionary")
Set mDefaultInput = CreateObject("Scripting.Dictionary")
End Sub
' Method to add a tag relationship
Public Function Add(designTag As String, summaryTag As String, isDefaultInput As Boolean, defaultInput As Variant) As Integer
Dim ret As Integer
If mTagRelation.Exists(designTag) Then
ret = -1
GoTo ExitFunc
End If
mTagRelation.Add designTag, summaryTag
mIsDefaultInput.Add designTag, isDefaultInput
mDefaultInput.Add designTag, defaultInput
ExitFunc:
Add = ret
End Function
' Method to get a summary tag from a design tag
Public Function GetSummaryTag(designTag As String) As String
If mTagRelation.Exists(designTag) Then
GetSummaryTag = mTagRelation(designTag)
Else
GetSummaryTag = "" ' Return empty if not found
End If
End Function
Public Property Get isDefaultInput() As Object
Set isDefaultInput = mIsDefaultInput
End Property
Public Property Get defaultInput() As Object
Set defaultInput = mDefaultInput
End Property
Public Property Get tagRelation() As Object
Set tagRelation = mTagRelation
End Property
' Method to remove a tag relationship
Public Sub Remove(designTag As String)
If mTagRelation.Exists(designTag) Then
mTagRelation.Remove designTag
End If
End Sub
' Method to print all tag relations (for debugging or display)
'Public Sub PrintTagRelations()
' Dim key As Variant
' For Each key In mTagRelation.keys
' Debug.Print "Design Tag: " & key & " => Summary Tag: " & mTagRelation(key)
' Next key
'End Sub
Public Property Get Name() As String
Name = mName
End Property
Public Property Let Name(value As String)
mName = value
End Property
Public Property Get isPrint() As Boolean
isPrint = mIsPrint
End Property
Public Property Let isPrint(value As Boolean)
mIsPrint = value
End Property
Public Sub Initialize(ByVal Name As String)
Me.Name = Name
End Sub