Ignore:
Timestamp:
Aug 8, 2008, 12:15:30 AM (16 years ago)
Author:
dai
Message:
  • ForeachがIDisposableを実装したIEnumerator<T>を取り扱うように変更
  • #120(列挙体のUnicode対応)の修正
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Queue.ab

    r577 r579  
    1818    Sub Queue ()
    1919        This.items = GC_malloc( 1 )
    20         Reset()
    2120    End Sub
    2221
    2322    Sub Queue ( capacity As Long )
    2423        This.items = GC_malloc( 1 )
    25         Reset()
    2624        If capacity > 0 Then
    2725            This.size = capacity
     
    6462    */
    6563    Override Function GetEnumerator () As IEnumerator<T>
    66         Return This
     64        Return New Detail.PointerEnumerator(items, count)
    6765    End Function
    6866
     
    116114        End If
    117115    End Sub
    118 
    119 
    120     '------------------------
    121     '   IEnumeratorの実装
    122     '------------------------
    123     currentIndexForEnumerator As Long
    124 
    125     Override Function Current () As T
    126         If This.currentIndexForEnumerator = -1 Then
    127             ' MoveNextメソッドがReset後、一度も呼び出されなかった
    128             Return Nothing
    129         End If
    130         Return This.items[ This.currentIndexForEnumerator ]
    131     End Function
    132 
    133     Override Function MoveNext() As Boolean
    134         If This.currentIndexForEnumerator + 1 >= This.size Then
    135             ' 上限に達した
    136             Return False
    137         End If
    138 
    139         This.currentIndexForEnumerator ++
    140         Return True
    141     End Function
    142 
    143     Override Sub Reset ()
    144         This.currentIndexForEnumerator = -1
    145     End Sub
    146116End Class
    147117
Note: See TracChangeset for help on using the changeset viewer.