Collection.st
branchjv
changeset 19225 9e8abf62f932
parent 19042 b81f2c85df7d
parent 19177 873c60e3a4e7
child 19227 5e949760a4e8
equal deleted inserted replaced
19167:699eef1bc815 19225:9e8abf62f932
   273      Kludges around the stupid definition of OrderedCollection>>new:"
   273      Kludges around the stupid definition of OrderedCollection>>new:"
   274 
   274 
   275     ^ self newWithSize:n
   275     ^ self newWithSize:n
   276 ! !
   276 ! !
   277 
   277 
       
   278 
   278 !Collection class methodsFor:'Signal constants'!
   279 !Collection class methodsFor:'Signal constants'!
   279 
   280 
   280 emptyCollectionSignal
   281 emptyCollectionSignal
   281     "return the signal used to report non-allowed operation on empty collections"
   282     "return the signal used to report non-allowed operation on empty collections"
   282 
   283 
   524 intersection:aCollection
   525 intersection:aCollection
   525     ^ self intersect:aCollection
   526     ^ self intersect:aCollection
   526 
   527 
   527     "Created: / 22-10-2008 / 21:29:27 / cg"
   528     "Created: / 22-10-2008 / 21:29:27 / cg"
   528 ! !
   529 ! !
       
   530 
   529 
   531 
   530 !Collection methodsFor:'accessing'!
   532 !Collection methodsFor:'accessing'!
   531 
   533 
   532 anElement
   534 anElement
   533     "return any element from the collection, 
   535     "return any element from the collection, 
  1854      tuned for this kind of operation."
  1856      tuned for this kind of operation."
  1855 
  1857 
  1856     ^ SharedCollection for:self.
  1858     ^ SharedCollection for:self.
  1857 !
  1859 !
  1858 
  1860 
       
  1861 asSignedByteArray
       
  1862     "return a new ByteArray with the collection's elements
       
  1863      (which must convert to 8bit integers in the range -128..127)."
       
  1864 
       
  1865     ^ self asIntegerArray:SignedByteArray
       
  1866 
       
  1867     "
       
  1868         #( 1 2 3 4 -128 -5 -6) asSignedByteArray
       
  1869     "
       
  1870 !
       
  1871 
  1859 asSignedIntegerArray
  1872 asSignedIntegerArray
  1860     "return a new SignedIntegerArray with the collection's elements
  1873     "return a new SignedIntegerArray with the collection's elements
  1861      (which must convert to 32bit signed integers in the range -16r80000000..16r7FFFFFFF)."
  1874      (which must convert to 32bit signed integers in the range -16r80000000..16r7FFFFFFF)."
  1862 
  1875 
  1863     ^ self asIntegerArray:SignedIntegerArray
  1876     ^ self asIntegerArray:SignedIntegerArray
  2031     ^ aString
  2044     ^ aString
  2032 
  2045 
  2033     "
  2046     "
  2034       #(16r440 16r443 16r441 16r441 16r43A 16r438 16r439 16r20 16r44F 16r437 16r44B 16r43A) asUnicodeString
  2047       #(16r440 16r443 16r441 16r441 16r43A 16r438 16r439 16r20 16r44F 16r437 16r44B 16r43A) asUnicodeString
  2035     "
  2048     "
       
  2049 !
       
  2050 
       
  2051 asUnsignedByteArray
       
  2052     "return a new ByteArray with the collection's elements
       
  2053      (which must convert to 8bit integers in the range 0..255)."
       
  2054 
       
  2055     ^ self asIntegerArray:ByteArray
  2036 !
  2056 !
  2037 
  2057 
  2038 asWordArray
  2058 asWordArray
  2039     "return a new WordArray with the collection's elements
  2059     "return a new WordArray with the collection's elements
  2040      (which must convert to integers in the range 0..16rFFFF)."
  2060      (which must convert to integers in the range 0..16rFFFF)."
  5805     "dispatch for visitor pattern; send #visitCollection:with: to aVisitor"
  5825     "dispatch for visitor pattern; send #visitCollection:with: to aVisitor"
  5806 
  5826 
  5807     ^ aVisitor visitCollection:self with:aParameter
  5827     ^ aVisitor visitCollection:self with:aParameter
  5808 ! !
  5828 ! !
  5809 
  5829 
       
  5830 
  5810 !Collection class methodsFor:'documentation'!
  5831 !Collection class methodsFor:'documentation'!
  5811 
  5832 
  5812 version
  5833 version
  5813     ^ '$Header$'
  5834     ^ '$Header$'
  5814 !
  5835 !