RunArray.st
changeset 966 dd7e0a32bcc1
parent 906 30c1ab2aee8d
child 1325 1c503fd677a7
equal deleted inserted replaced
965:21f25a87c5c6 966:dd7e0a32bcc1
    48  is all done on its own.
    48  is all done on its own.
    49 	Some of this could be made faster by adding a cache of the start and finish
    49 	Some of this could be made faster by adding a cache of the start and finish
    50  indices of each run, but since I envisage that most additions etc. will be to
    50  indices of each run, but since I envisage that most additions etc. will be to
    51  and from the end those are not included. In addition I have implemented the
    51  and from the end those are not included. In addition I have implemented the
    52  bare essentials of this for what I need it for - i.e. add to the end and take
    52  bare essentials of this for what I need it for - i.e. add to the end and take
    53  off the beginning.'!
    53  off the beginning.'
       
    54 !
    54 
    55 
    55 !RunArray class methodsFor:'documentation'!
    56 !RunArray class methodsFor:'documentation'!
    56 
    57 
    57 copyright
    58 copyright
    58 "
    59 "
   858     "If I contain oldObject return its index, otherwise create an error   
   859     "If I contain oldObject return its index, otherwise create an error   
   859      notifier. It will answer with the position of the very first element of  
   860      notifier. It will answer with the position of the very first element of  
   860      that value.
   861      that value.
   861      OBSOLETE: this is a leftover from earlier times; use #indexOf:ifAbsent:"
   862      OBSOLETE: this is a leftover from earlier times; use #indexOf:ifAbsent:"
   862 
   863 
       
   864     <resource:#obsolete>
       
   865 
   863     |idx|
   866     |idx|
   864 
   867 
   865     self obsoleteMethodWarning:'use #indexOf:ifAbsent:'.
   868     self obsoleteMethodWarning:'use #indexOf:ifAbsent:'.
   866     idx := self indexOf:oldObject ifAbsent:0.
   869     idx := self indexOf:oldObject ifAbsent:0.
   867     idx ~~ 0 ifTrue:[^ idx].
   870     idx ~~ 0 ifTrue:[^ idx].
   883 find:oldObject ifAbsent:exceptionBlock 
   886 find:oldObject ifAbsent:exceptionBlock 
   884     "If I contain oldObject return its index, otherwise execute the 
   887     "If I contain oldObject return its index, otherwise execute the 
   885      exception block. It will answer with the position of the very first 
   888      exception block. It will answer with the position of the very first 
   886      element of that value.
   889      element of that value.
   887      OBSOLETE: this is a leftover from earlier times; use #indexOf:ifAbsent:"
   890      OBSOLETE: this is a leftover from earlier times; use #indexOf:ifAbsent:"
       
   891 
       
   892     <resource:#obsolete>
   888 
   893 
   889     self obsoleteMethodWarning:'use #indexOf:'.
   894     self obsoleteMethodWarning:'use #indexOf:'.
   890     ^ self indexOf:oldObject ifAbsent:exceptionBlock
   895     ^ self indexOf:oldObject ifAbsent:exceptionBlock
   891 
   896 
   892     "Modified: / 30.10.1997 / 15:49:54 / cg"
   897     "Modified: / 30.10.1997 / 15:49:54 / cg"
  1248 ! !
  1253 ! !
  1249 
  1254 
  1250 !RunArray class methodsFor:'documentation'!
  1255 !RunArray class methodsFor:'documentation'!
  1251 
  1256 
  1252 version
  1257 version
  1253     ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.19 2000-08-22 13:57:19 cg Exp $'
  1258     ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.20 2001-05-17 22:29:23 stefan Exp $'
  1254 ! !
  1259 ! !