Imports System
Imports System.ComponentModel
Imports System.Collections

Public Class TimeSwimData
  Inherits SwimData
  '---------        
  Public Sub New(ByVal filename As String)
    MyBase.New(filename)
  End Sub
  '---------
  Public Sub New()
    MyBase.new()
  End Sub
  '---------
  'Metoda sortowania wymagana przez klasę bazową
  Public Overrides Sub sort()
    Dim i, j, max As Integer
    Dim sw As Swimmer
    max = swimmers.Count
    'Skupiuj do tablicy
    Dim sws(max) As Swimmer
    swimmers.CopyTo(sws)
    'Sotruj wg wyniku
    For i = 0 To max - 1
      For j = i To max - 1
        If sws(i).getTime > sws(j).getTime Then
          sw = sws(i)
          sws(i) = sws(j)
          sws(j) = sw
        End If
      Next j
    Next i
    'Skopiuj z powrotem do tablicy
    swimmers = New ArrayList()
    For i = 0 To max - 1
      swimmers.Add(sws(i))
    Next i
  End Sub

End Class
