1 |
#Region "Microsoft.VisualBasic::585af9b6e34291ded89ba898745a1541, Microsoft.VisualBasic.Core\ComponentModel\Ranges\Sequence.vb"
|
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 |
#End Region
|
45 |
|
46 |
Imports System.Runtime.CompilerServices
|
47 |
Imports System.Xml.Serialization
|
48 |
Imports Microsoft.VisualBasic.ComponentModel.Ranges.Model
|
49 |
|
50 |
Namespace ComponentModel.Ranges
|
51 |
|
52 |
<XmlType("numeric-sequence")>
|
53 |
Public Class Sequence : Implements IRanges(Of Double)
|
54 |
|
55 |
<XmlElement("range")>
|
56 |
Public Property Range As DoubleRange
|
57 |
<XmlAttribute>
|
58 |
Public Property n As Integer
|
59 |
|
60 |
Public ReadOnly Property Steps As Double
|
61 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
62 |
Get
|
63 |
Return Range.Length / n
|
64 |
End Get
|
65 |
End Property
|
66 |
|
67 |
Public ReadOnly Property Min As Double Implements IRange(Of Double).Min
|
68 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
69 |
Get
|
70 |
Return Range.Min
|
71 |
End Get
|
72 |
End Property
|
73 |
Public ReadOnly Property Max As Double Implements IRange(Of Double).Max
|
74 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
75 |
Get
|
76 |
Return Range.Max
|
77 |
End Get
|
78 |
End Property
|
79 |
|
80 |
Sub New(a#, b#, n%)
|
81 |
Me.Range = New DoubleRange(a, b)
|
82 |
Me.n = n
|
83 |
End Sub
|
84 |
|
85 |
Sub New()
|
86 |
|
87 |
End Sub
|
88 |
|
89 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
90 |
Public Function IsInside(x As Double) As Boolean Implements IRanges(Of Double).IsInside
|
91 |
Return Range.IsInside(x)
|
92 |
End Function
|
93 |
|
94 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
95 |
Public Function IsInside(range As IRanges(Of Double)) As Boolean Implements IRanges(Of Double).IsInside
|
96 |
Return range.IsInside(range)
|
97 |
End Function
|
98 |
|
99 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
100 |
Public Function IsOverlapping(range As IRanges(Of Double)) As Boolean Implements IRanges(Of Double).IsOverlapping
|
101 |
Return range.IsOverlapping(range)
|
102 |
End Function
|
103 |
|
104 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
105 |
Public Function ToArray() As Double()
|
106 |
Return Range.Enumerate(n)
|
107 |
End Function
|
108 |
|
109 |
Public Overrides Function ToString() As String
|
110 |
Return Range.ToString
|
111 |
End Function
|
112 |
End Class
|
113 |
End Namespace
|