Queue.st
changeset 904 f4791de2295b
parent 903 2e0a56e8892b
child 1121 e7136d381499
equal deleted inserted replaced
903:2e0a56e8892b 904:f4791de2295b
   247 ! !
   247 ! !
   248 
   248 
   249 !Queue methodsFor:'accessing-protocol compatibility'!
   249 !Queue methodsFor:'accessing-protocol compatibility'!
   250 
   250 
   251 addLast:someObject
   251 addLast:someObject
   252     "same as #nextPut: - for protocol compatibility with
   252     "same as #nextPut: - for protocol compatibility with other collections"
   253      other collections"
       
   254 
   253 
   255     self nextPut:someObject.
   254     self nextPut:someObject.
   256     ^ someObject
   255     ^ someObject
   257 
   256 
   258     "Created: / 27.8.1998 / 11:15:29 / cg"
   257     "Created: / 27.8.1998 / 11:15:29 / cg"
   259 !
   258 !
   260 
   259 
   261 removeFirst
   260 removeFirst
   262     "same as #next - for protocol compatibility with
   261     "same as #next - for protocol compatibility with other collections"
   263      other collections"
       
   264 
   262 
   265     ^ self next
   263     ^ self next
   266 
   264 
   267     "Created: / 27.8.1998 / 11:15:48 / cg"
   265     "Created: / 27.8.1998 / 11:15:48 / cg"
   268 ! !
   266 ! !
   304     "return the number of elements the queue can hold"
   302     "return the number of elements the queue can hold"
   305 
   303 
   306     ^ contentsArray size
   304     ^ contentsArray size
   307 !
   305 !
   308 
   306 
       
   307 size
       
   308     "return the number of elements in the queue"
       
   309 
       
   310     ^ tally
       
   311 ! !
       
   312 
       
   313 !Queue methodsFor:'testing'!
       
   314 
   309 isEmpty
   315 isEmpty
   310     "return true, if there are no elements in the queue"
   316     "return true, if there are no elements in the queue"
   311 
   317 
   312     ^ tally == 0
   318     ^ tally == 0
   313 !
   319 !
   315 isFull
   321 isFull
   316     "return true, if the queue is full i.e. if writing is not
   322     "return true, if the queue is full i.e. if writing is not
   317      possible"
   323      possible"
   318 
   324 
   319     ^ tally == contentsArray size
   325     ^ tally == contentsArray size
   320 !
       
   321 
       
   322 size
       
   323     "return the number of elements in the queue"
       
   324 
       
   325     ^ tally
       
   326 ! !
   326 ! !
   327 
   327 
   328 !Queue class methodsFor:'documentation'!
   328 !Queue class methodsFor:'documentation'!
   329 
   329 
   330 version
   330 version
   331     ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.25 2000-08-21 22:45:09 cg Exp $'
   331     ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.26 2000-08-22 13:49:13 cg Exp $'
   332 ! !
   332 ! !