/Source Code/SongDatabase/Items/PlayListEnumerator.vb
Visual Basic | 62 lines | 22 code | 8 blank | 32 comment | 0 complexity | a7e992c2f04fc379c1734e534a9974d0 MD5 | raw file
- Namespace Items
-
- ''' <summary>
- ''' Allows play list items to be enumerated.
- ''' </summary>
- Public Class PlayListEnumerator
- Implements IEnumerator
-
- Private FPlayList As PlayList = Nothing
- Private FPosition As Integer = -1
-
- ''' <summary>
- ''' Gets the current element in the collection.
- ''' </summary>
- ''' <value></value>
- ''' <returns>
- ''' The current element in the collection.
- ''' </returns>
- ''' <exception cref="T:System.InvalidOperationException">
- ''' The enumerator is positioned before the first element of the collection or after the last element.
- ''' </exception>
- Public ReadOnly Property Current() As Object Implements System.Collections.IEnumerator.Current
- Get
- Return FPlayList(FPosition)
- End Get
- End Property
-
- ''' <summary>
- ''' Advances the enumerator to the next element of the collection.
- ''' </summary>
- ''' <returns>
- ''' true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
- ''' </returns>
- ''' <exception cref="T:System.InvalidOperationException">
- ''' The collection was modified after the enumerator was created.
- ''' </exception>
- Public Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
- FPosition += 1
- Return FPosition < FPlayList.Count
- End Function
-
- ''' <summary>
- ''' Sets the enumerator to its initial position, which is before the first element in the collection.
- ''' </summary>
- ''' <exception cref="T:System.InvalidOperationException">
- ''' The collection was modified after the enumerator was created.
- ''' </exception>
- Public Sub Reset() Implements System.Collections.IEnumerator.Reset
- FPosition = -1
- End Sub
-
- ''' <summary>
- ''' Initializes a new instance of the <see cref="PlayListEnumerator" /> class.
- ''' </summary>
- ''' <param name="playList">The play list.</param>
- Public Sub New(ByVal playList As PlayList)
- FPlayList = playList
- End Sub
-
- End Class
-
- End Namespace