Changeset 582 for trunk/ab5.0


Ignore:
Timestamp:
Aug 9, 2008, 1:44:45 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

非Genericコレクションインタフェースの扱いを大幅に縮小。Queue/Stackの実装インタフェースの修正。

Location:
trunk/ab5.0/ablib/src/Classes/System/Collections
Files:
7 edited

Legend:

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

    r440 r582  
    11' Classes/System/Collections/ArrayList.ab
    2 
    3 #require <Classes/System/Collections/misc.ab>
    42
    53Namespace System
     
    140138        size++
    141139    End Function
    142 
    143     Virtual Sub AddRange(c As ICollection)
    144         ' TODO: 実装
    145     End Sub
    146 
     140/*
    147141    Const Virtual Function BinarySearch(x As Object) As Long
    148142        ' TODO: 実装
     
    183177        End If
    184178    End Function
    185 
     179*/
    186180    /*Override*/ Virtual Sub Clear()
    187181        size = 0
     
    245239    End Sub
    246240
    247     Virtual Sub InsertRange(index As Long, c As ICollection)
    248         ' TODO: 実装
    249     End Sub
    250 
    251241    /*Const*/ Virtual Function LastIndexOf(object As Object) As Long
    252242        LastIndexOf(object, 0, size)
     
    286276    End Sub
    287277
    288     Virtual Sub SetRange(index As Long, c As ICollection)
    289         ' TODO: 実装
    290     End Sub
    291 
    292278    Virtual Sub Sort()
    293         ' TODO: 実装
    294     End Sub
    295 
    296     Virtual Sub Sort(c As IComparer)
    297         Sort(0, size, c)
    298     End Sub
    299 
    300     Virtual Sub Sort(index As Long, count As Long, c As IComparer)
    301279        ' TODO: 実装
    302280    End Sub
     
    309287    Override Function ToString() As String
    310288        Return "System.Collections.ArrayList"
    311     End Function
    312 
    313     ' --------------------------------
    314     ' static methods
    315     Static Function Adapter(l As IList) As ArrayList
    316         ' TODO: 実装
    317     End Function
    318 
    319     Static Function FixedSize(l As ArrayList) As ArrayList
    320         ' TODO: 実装
    321     End Function
    322 
    323     Static Function FixedSize(l As IList) As IList
    324         ' TODO: 実装
    325         'Return FixedSize(Adapter(l))
    326     End Function
    327 
    328     Static Function ReadOnly(l As ArrayList) As ArrayList
    329         ' TODO: 実装
    330     End Function
    331 
    332     Static Function ReadOnly(l As IList) As IList
    333         ' TODO: 実装
    334         'Return ReadOnly(Adapter(l))
    335289    End Function
    336290
     
    342296        Next
    343297    End Function
    344 
    345     Static Function Synchronized(l As ArrayList) As ArrayList
    346         ' TODO: 実装
    347     End Function
    348 
    349     Static Function Synchronized(l As IList) As IList
    350         ' TODO: 実装
    351         'Return Synchronized(Adapter(l))
    352     End Function
    353 
    354298End Class
    355299
  • trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Dictionary.ab

    r542 r582  
    11'Classes/System/Collections/Generic/Dictionary.ab
    2 
    3 '#require <Classes/System/Collections/Generic/EqualityComparer.ab>
    42
    53Namespace System
  • trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/List.ab

    r579 r582  
    9696    */
    9797    Override Sub Operator[] ( index As Long, item As T )
     98        Item[index] = item
     99    End Sub
     100    Override Function Operator[] ( index As Long ) As T
     101        Return Item[index]
     102    End Function
     103
     104    /*!
     105    @brief  インデクサ
     106    @author Egtra
     107    @date   2008/08/04
     108    @param  インデックス
     109    */
     110    Override Sub Item( index As Long, item As T )
    98111        If 0 <= index And index < capacity Then
    99112            items[index]=item
     
    102115        End If
    103116    End Sub
    104     Override Function Operator[] ( index As Long ) As T
     117    Override Function Item( index As Long ) As T
    105118        If 0 <= index And index < capacity Then
    106119            Return items[index]
     
    109122        End If
    110123    End Function
    111 
    112124    /*!
    113125    @brief  ポインタ型へのキャスト
  • trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Queue.ab

    r579 r582  
    55
    66Class Queue<T>
    7     Implements IEnumerable<T>, IEnumerator<T>, System.Collections.ICollection
     7    Implements IEnumerable<T>
    88
    99    items As *T
     
    2828    End Sub
    2929
    30     /*!
    31     @brief  Queueに格納されている要素の数を取得
    32     @author NoWest
    33     @date   2008/07/20
    34     */
    35     Override Function Count () As Long
    36         Return This.count
    37     End Function
    38 
    3930Public
    40     /*!
    41     @brief  Queueからすべての要素を削除する
    42     @author NoWest
    43     @date   2008/07/20
    44     */
    45     Sub Clear ()
    46         This.count = 0
    47     End Sub
    48 
    4931    'ある要素が Queue内に存在するかどうかを判断
    5032/*  Override Function Contains ( item As T ) As Boolean
  • trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Stack.ab

    r579 r582  
    55
    66Class Stack<T>
    7     Implements IEnumerable<T>, IEnumerator<T>, System.Collections.ICollection
     7    Implements IEnumerable<T>
    88
    99    items As *T
     
    2727        End If
    2828    End Sub
    29 
    30     /*!
    31     @brief  Stackに格納されている要素の数を取得
    32     @author NoWest
    33     @date   2008/07/20
    34     */
    35     Override Function Count () As Long
    36         Return This.count
    37     End Function
    3829
    3930Public
  • trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/misc.ab

    r579 r582  
    4242    Abstract Function Operator[] ( index As Long ) As T
    4343
    44     ' Methods
     44    Abstract Sub Item ( index As Long, item As T )
     45    Abstract Function Item ( index As Long ) As T
     46
    4547    Abstract Function IndexOf ( item As T ) As Long
    4648    Abstract Sub Insert ( index As Long, item As T )
  • trunk/ab5.0/ablib/src/Classes/System/Collections/misc.ab

    r577 r582  
    11' Classes/System/Collections/misc.ab
    2 
    3 #ifndef __SYSTEM_COLLECTIONS_MISC_AB__
    4 #define __SYSTEM_COLLECTIONS_MISC_AB__
    52
    63Namespace System
    74Namespace Collections
    8 
    9 Interface ICollection
    10     Inherits IEnumerable
    11     ' Properties
    12     Function Count() As Long
    13     '/*Const*/ Function IsSynchronized() As Boolean
    14     ' Function SyncRoot() As ...
    15     ' Methods
    16     ' Sub CopyTo(ByRef array As ..., index As Long)
    17 End Interface
    18 
    19 Interface IComparer
    20     ' Methods
    21     Function Compare(ByRef x As Object, ByRef y As Object) As Long
    22 End Interface
    23 
    24 Interface IDictionary
    25     Inherits ICollection /*, IEnumerable */
    26     ' Methods
    27     Sub Add(ByRef key As Object, ByRef value As Object)
    28     Sub Clear()
    29     /*Const*/ Function Contains(ByRef key As Object) As Boolean
    30 '   /*Const*/ Function GetEnumerator() As *IDictionaryEnumerator
    31     /*Const*/ Function Remove(ByRef key As Object) As Boolean
    32     ' Properties
    33     /*Const*/ Function IsFixedSize() As Boolean
    34     /*Const*/ Function IsReadOnly() As Boolean
    35 '   /*Const*/ Function Operator [](ByRef key As Object) As *Object
    36 '   Sub Operator []=(ByRef key As Object, ByRef value As Object)
    37     /*Const*/ Function Keys() As *ICollection
    38     /*Const*/ Function Values() As ICollection
    39 End Interface
    40 
    41 Interface IDictionaryEnumerator
    42     Inherits IEnumerator
    43     ' Properties
    44     /*Const*/ Function Entry() As DictionaryEntry
    45     /*Const*/ Function Key() As *Object
    46     /*Const*/ Function Value() As *Object
    47 End Interface
    485
    496Interface IEnumerable
     
    6017End Interface
    6118
    62 Interface IEqualityComparer
    63     ' Methods
    64     Function Equals(ByRef x As Object, ByRef y As Object) As Boolean
    65     Function GetHashCode(ByRef obj As Object) As Long
    66 End Interface
    67 
    6819Interface IList
    69     Inherits ICollection /*, IEnumerable */
     20    'Inherits /*, IEnumerable */
    7021    ' Methods
    7122    'Function Add(value As *Object) As Long
     
    8334End Interface
    8435
    85 Class DictionaryEntry
    86 Public
    87     ' /*Const*/ructors
    88     Sub DictionaryEntry()
    89         k = 0
    90         v = 0
    91     End Sub
    92 
    93     Sub DictionaryEntry(ByRef key As Object, ByRef value As Object)
    94         k = VarPtr(key)
    95         v = VarPtr(value)
    96     End Sub
    97 
    98     ' Properties
    99     /*Const*/ Function Key() As *Object
    100         Return k
    101     End Function
    102 
    103     Sub Key(ByRef key As Object)
    104         k = VarPtr(key)
    105     End Sub
    106 
    107     /*Const*/ Function Value() As *Object
    108         Return v
    109     End Function
    110 
    111     Sub Value(ByRef value As Object)
    112         v = VarPtr(value)
    113     End Sub
    114 Private
    115     k As *Object
    116     v As *Object
    117 End Class
    118 
    11936End Namespace 'Collections
    12037End Namespace 'System
    121 
    122 #endif '__SYSTEM_COLLECTIONS_MISC_AB__
Note: See TracChangeset for help on using the changeset viewer.