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

Public Sub setSex(sx$)
  Sex = sx$ 'Przechowaj wybór p³ci
End Sub
 
Private Sub Class_Initialize()
  Sex = "F"
End Sub

Private Sub SwimData_Clone(swd As SwimData)
End Sub

Private Function SwimData_getNextSwimmer() As Swimmer
  Set SwimData_getNextSwimmer = swimmers(index)
End Function

Private Function SwimData_hasMoreElements() As Boolean
  Dim quit As Boolean
  Do
    index = index + 1
    quit = index > max
    If Not quit Then
      quit = swimmers(index).getSex = Sex
    End If
  Loop Until quit
  SwimData_hasMoreElements = index <= max
End Function

Private Sub SwimData_init(Filename As String)
End Sub

Private Sub SwimData_MoveFirst()
  index = 1
End Sub

Private Sub SwimData_setData(swcol As Collection)
  Set swimmers = swcol
End Sub

Private Sub SwimData_sort()
  Dim i As Integer, j As Integer
  Dim sw As Swimmer
  max = swimmers.Count
  ReDim sws(max) As Swimmer
  For i = 1 To max
    Set sws(i) = swimmers(i)
  Next i
  For i = 1 To max
    For j = i To max
      If sws(i).getTime > sws(j).getTime Then
        Set sw = sws(i)
        Set sws(i) = sws(j)
        Set sws(j) = sw
      End If
    Next j
  Next i
  For i = swimmers.Count To 1 Step -1
    swimmers.Remove i
  Next i
  
  For i = 1 To max
    swimmers.Add sws(i)
  Next i
End Sub
