; Get
Return items.Count
End Get
End Property
''Indexer
Default Public Property Item(ByVal Index As Integer) As Object
Get
Return items(Index)
End Get
Set(ByVal value As Object)
items.Insert(Index, value)
End Set
End Property
End Class
''"Iterator"
Public MustInherit Class Iterator
Public MustOverride Function First() As Object
Public MustOverride Function [Next]() As Object
Public MustOverride Function IsDone() As Boolean
Public MustOverride Function CurrentItem() As Object
End Class
''"ConcreteIterator"
Public Class ConcreteIterator
Inherits Iterator
Private aggregate As ConcreteAggregate
Private current As Integer = 0
''Constructor
Public Sub New(ByVal aggregate As ConcreteAggregate)
Me.aggregate = aggregate
End Sub
Public Overrides Function First() As Object
Return aggregate(0)
End Function
Public Overrides Function [Next]() As Object
Dim ret As Object = Nothing
If current < aggregate.Count - 1 Then
ret = aggregate(System.Threading.Interlocked.Increment(current))
End If
Return ret
End Function
Public Overrides Function CurrentItem() As Object
Return aggregate(current)
End Function
Public Overrides Function&nbs