--- a/Queue.st Wed Jun 12 13:35:16 1996 +0200
+++ b/Queue.st Sat Jun 22 18:52:25 1996 +0200
@@ -17,7 +17,7 @@
category:'Collections-Ordered'
!
-!Queue class methodsFor:'documentation'!
+!Queue class methodsFor:'documentation'!
copyright
"
@@ -55,7 +55,7 @@
"
! !
-!Queue class methodsFor:'instance creation'!
+!Queue class methodsFor:'instance creation'!
new
"return a new queue with space for some elements"
@@ -143,6 +143,29 @@
(tally == 0) ifTrue:[^ nil].
^ contentsArray at:readPosition.
+!
+
+removeLast
+ "return the last value in the queue;
+ Return nil, if the queue is empty"
+
+ |value pos "{ Class: SmallInteger }"|
+
+ (tally == 0) ifTrue:[^ nil].
+
+ pos := writePosition.
+ pos == 1 ifTrue:[
+ pos := contentsArray size
+ ] ifFalse:[
+ pos := pos - 1.
+ ].
+
+ value := contentsArray at:pos.
+ writePosition := pos.
+ tally := tally - 1.
+ ^ value
+
+ "Created: 22.6.1996 / 18:49:41 / cg"
! !
!Queue methodsFor:'enumerating'!
@@ -200,8 +223,8 @@
^ tally
! !
-!Queue class methodsFor:'documentation'!
+!Queue class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.17 1996-05-18 15:32:39 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.18 1996-06-22 16:52:09 cg Exp $'
! !