Ignore:
Timestamp:
Apr 4, 2007, 6:53:48 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

GCHandleの追加、String.Compareなどの追加、gc.sbpの修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Collections/ArrayList.ab

    r195 r203  
    3737            Debug
    3838        End If
     39        capacity = size
    3940    End Sub
    4041
     
    4243        If This.capacity < capacity Then
    4344            This.capacity = capacity
    44             Realloc( capacity )
     45            Realloc(capacity)
    4546        End If
    4647    End Sub
     
    9697    /*Override*/ Virtual Sub Operator []=(index As Long, object As Object)
    9798        If 0 <= index And index < size Then
    98             pObject[i] = object
     99            pObject[index] = object
    99100        Else
    100101            'Throw OutOfRangeException?
     
    114115    End Sub
    115116/*
    116     Sub ArrayList(ByRef c As ICollection)
     117    Sub ArrayList(c As ICollection)
    117118        ' 未実装
    118119        Debug
     
    127128    End Sub
    128129
    129 '   Sub Operator =(ByRef a As ArrayList)
     130'   Sub Operator =(a As ArrayList)
    130131
    131132    /*Override*/ Virtual Function Add( object As Object ) As Long
     
    136137    End Function
    137138
    138     Virtual Sub AddRange(ByRef c As ICollection)
    139         ' TODO: 実装
    140     End Sub
    141 
    142     Const Virtual Function BinarySearch(x As *Object)
    143         ' TODO: 実装
    144     End Function
    145 
    146     Const Virtual Function BinarySearch(x As *Object, ByRef c As IComparer) As Long
    147         ' TODO: 実装
    148     End Function
    149 
    150     Const Virtual Function BinarySearch(index As Long, count As Long, x As *Object, ByRef c As IComparer) As Long
    151         ' TODO: 実装
     139    Virtual Sub AddRange(c As ICollection)
     140        ' TODO: 実装
     141    End Sub
     142
     143    Const Virtual Function BinarySearch(x As Object)
     144        ' TODO: 実装
     145    End Function
     146
     147    Const Virtual Function BinarySearch(x As Object, c As IComparer) As Long
     148        Return BinarySearch(0, size, x, c)
     149    End Function
     150
     151    Const Virtual Function BinarySearch(index As Long, count As Long, x As Object, c As IComparer) As Long
     152        Dim l = index
     153        Dim r = index + ELM(count)
     154        While l <= r
     155            Dim mid = (l + r) >> 2
     156            Dim ret = c.Compare(pObject[mid], x)
     157            If ret = 0 Then
     158                Return mid
     159            Else If ret < 0 Then 'pObject[mid] < x
     160                If l = r Then
     161                    If mid + 1 <= index + ELM(count) Then
     162                        Return Not (mid + 1)
     163                    Else
     164                        Return count
     165                    End If
     166                End If
     167                l = mid + 1
     168            Else 'pObject[mid] > x
     169                If l = r And mid + 1 <= index + ELM(count) Then
     170                    Return Not mid
     171                End If
     172                r = mid - 1
     173            End If
     174        Wend
     175        If l = index Then
     176            Return Not index
     177        Else 'r = index + ELM(count)
     178            Return Not count
     179        End If
    152180    End Function
    153181
     
    172200
    173201    ' CopyTo
    174     /*Const*/ /*Override*/ Virtual Function GetEnumerator() As *IEnumerator
    175         'Return GetEnumerator(index, count)
    176     End Function
    177 
    178     Const Virtual Function GetEnumerator(index As Long, count As Long) As *IEnumerator
    179         ' TODO: 実装
    180     End Function
    181 
    182     Virtual Function GetRange(index As Long, count As Long) As *ArrayList
     202
     203'   
     204'   /*Const*/ /*Override*/ Virtual Function GetEnumerator() As IEnumerator
     205'       'Return GetEnumerator(index, count)
     206'   End Function
     207
     208'   Const Virtual Function GetEnumerator(index As Long, count As Long) As IEnumerator
     209'       ' TODO: 実装
     210'   End Function
     211
     212    Virtual Function GetRange(index As Long, count As Long) As ArrayList
    183213        ' TODO: 実装
    184214    End Function
     
    210240    End Sub
    211241
    212     Virtual Sub InsertRange(index As Long, ByRef c As ICollection)
     242    Virtual Sub InsertRange(index As Long, c As ICollection)
    213243        ' TODO: 実装
    214244    End Sub
     
    253283    End Sub
    254284
    255     Virtual Sub SetRange(index As Long, ByRef c As ICollection)
     285    Virtual Sub SetRange(index As Long, c As ICollection)
    256286        ' TODO: 実装
    257287    End Sub
     
    261291    End Sub
    262292
    263     Virtual Sub Sort(ByRef c As IComparer)
     293    Virtual Sub Sort(c As IComparer)
    264294        Sort(0, size, c)
    265295    End Sub
    266296
    267     Virtual Sub Sort(index As Long, count As Long, ByRef c As IComparer)
     297    Virtual Sub Sort(index As Long, count As Long, c As IComparer)
    268298        ' TODO: 実装
    269299    End Sub
     
    280310    ' --------------------------------
    281311    ' static methods
    282     Static Function Adapter(ByRef l As IList) As *ArrayList
    283         ' TODO: 実装
    284     End Function
    285 
    286     Static Function FixedSize(ByRef l As ArrayList) As *ArrayList
    287         ' TODO: 実装
    288     End Function
    289 
    290     Static Function FixedSize(ByRef l As IList) As *IList
     312    Static Function Adapter(l As IList) As ArrayList
     313        ' TODO: 実装
     314    End Function
     315
     316    Static Function FixedSize(l As ArrayList) As ArrayList
     317        ' TODO: 実装
     318    End Function
     319
     320    Static Function FixedSize(l As IList) As IList
    291321        Return FixedSize(Adapter(VarPtr(i)))
    292322    End Function
    293323
    294     Static Function ReadOnly(ByRef l As ArrayList) As *ArrayList
    295         ' TODO: 実装
    296     End Function
    297 
    298     Static Function ReadOnly(ByRef l As IList) As *IList
     324    Static Function ReadOnly(l As ArrayList) As ArrayList
     325        ' TODO: 実装
     326    End Function
     327
     328    Static Function ReadOnly(l As IList) As IList
    299329        Return ReadOnly(Adapter(VarPtr(i)))
    300330    End Function
    301331
    302     Static Function Repeat(ByRef x As Object, c As Long) As *ArrayList
     332    Static Function Repeat(x As Object, c As Long) As ArrayList
    303333        Repeat = New ArrayList(c)
    304334        Dim i As Long
     
    308338    End Function
    309339
    310     Static Function Synchronized(ByRef l As ArrayList) As *ArrayList
    311         ' TODO: 実装
    312     End Function
    313 
    314     Static Function Synchronized(ByRef l As IList) As *IList
     340    Static Function Synchronized(l As ArrayList) As ArrayList
     341        ' TODO: 実装
     342    End Function
     343
     344    Static Function Synchronized(l As IList) As IList
    315345        Return Synchronized(Adapter(VarPtr(i)))
    316346    End Function
Note: See TracChangeset for help on using the changeset viewer.