-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFvPropertyChain.vb
More file actions
63 lines (55 loc) · 1.73 KB
/
FvPropertyChain.vb
File metadata and controls
63 lines (55 loc) · 1.73 KB
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
Imports System.Text
Public Class FvPropertyChain
Inherits List(Of FvProperty)
Public ReadOnly Property OriginalPath() As String
Get
Dim sb As New StringBuilder
For Each prop In Me
If sb.Length > 0 Then
sb.Append(".")
End If
sb.AppendFormat("{0}", prop.Name)
Next
Return sb.ToString()
End Get
End Property
Public ReadOnly Property Path() As String
Get
Dim sb As New StringBuilder
For Each prop In Me
If sb.Length > 0 Then
sb.Append(".")
End If
sb.AppendFormat("{0}", prop.Translation)
Next
Return sb.ToString()
End Get
End Property
Public Function CheckSimilarity(ByVal chainSpecified As FvPropertyChain) As Boolean
Dim i As Integer
For Each prop In Me
If chainSpecified.Count > i AndAlso prop.Name <> chainSpecified(i).Name Then
Return False
End If
i += 1
Next
Return True
End Function
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal source As FvPropertyChain)
MyBase.New(source)
End Sub
Public Sub New(ByVal path As String)
Me.New()
For Each part In path.Split(".")
Me.Add(New FvProperty(part, Nothing))
Next
End Sub
Public Function CreateNested(ByVal nestedProperty As FvProperty) As FvPropertyChain
Dim chain = New FvPropertyChain(Me)
chain.Add(nestedProperty)
Return chain
End Function
End Class