VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Kids"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Klasa Kids
Implements Iterator
Private kidList As Collection
Private index As Integer

Public Sub init(Filename As String)
  Dim sline As String             'Wiersz wczytany z pliku
  Dim vbf As New vbFile           'Instancja klasy File
  Dim kd As Kid
  Set kidList = New Collection
  vbf.OpenForRead Filename        'Otwórz plik
  While Not vbf.fEof              'Wczytaj wiersz
    sline = vbf.readLine
    Set kd = New Kid
    kd.init sline                 'Umieść dane w instancji klasy Kid
    kidList.Add kd                'I dodaj ją do kolekcji
  Wend
  vbf.closeFile
  Iterator_moveFirst              'Przejdź do pierwszego elementu listy
End Sub
'-----
Private Function Iterator_hasMoreElements() As Boolean
  Iterator_hasMoreElements = index < kidList.Count
End Function
'-----
Private Sub Iterator_moveFirst()
  index = 1
End Sub
'-----
Private Function Iterator_nextElement() As Object
  Set Iterator_nextElement = kidList(index)
  index = index + 1
End Function
